mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add geolocation support (issue #365).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@780 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
35
cef1/cef.gyp
35
cef1/cef.gyp
@ -485,7 +485,6 @@
|
|||||||
'<(DEPTH)/breakpad/breakpad.gyp:breakpad_handler',
|
'<(DEPTH)/breakpad/breakpad.gyp:breakpad_handler',
|
||||||
'<(DEPTH)/third_party/angle/src/build_angle.gyp:libEGL',
|
'<(DEPTH)/third_party/angle/src/build_angle.gyp:libEGL',
|
||||||
'<(DEPTH)/third_party/angle/src/build_angle.gyp:libGLESv2',
|
'<(DEPTH)/third_party/angle/src/build_angle.gyp:libGLESv2',
|
||||||
'<(DEPTH)/ui/views/views.gyp:views',
|
|
||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'<@(includes_win)',
|
'<@(includes_win)',
|
||||||
@ -496,6 +495,7 @@
|
|||||||
'link_settings': {
|
'link_settings': {
|
||||||
'libraries': [
|
'libraries': [
|
||||||
'-lcomctl32.lib',
|
'-lcomctl32.lib',
|
||||||
|
'-llocationapi.lib',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'msvs_settings': {
|
'msvs_settings': {
|
||||||
@ -724,6 +724,8 @@
|
|||||||
'libcef/download_util.cc',
|
'libcef/download_util.cc',
|
||||||
'libcef/download_util.h',
|
'libcef/download_util.h',
|
||||||
'libcef/external_protocol_handler.h',
|
'libcef/external_protocol_handler.h',
|
||||||
|
'libcef/geolocation_client.cc',
|
||||||
|
'libcef/geolocation_client.h',
|
||||||
'libcef/http_header_utils.cc',
|
'libcef/http_header_utils.cc',
|
||||||
'libcef/http_header_utils.h',
|
'libcef/http_header_utils.h',
|
||||||
'libcef/nplugin_impl.cc',
|
'libcef/nplugin_impl.cc',
|
||||||
@ -760,6 +762,18 @@
|
|||||||
'<(DEPTH)/chrome/browser/net/sqlite_persistent_cookie_store.h',
|
'<(DEPTH)/chrome/browser/net/sqlite_persistent_cookie_store.h',
|
||||||
# DevTools resource IDs generated by grit
|
# DevTools resource IDs generated by grit
|
||||||
'<(grit_out_dir)/grit/devtools_resources_map.cc',
|
'<(grit_out_dir)/grit/devtools_resources_map.cc',
|
||||||
|
# Geolocation implementation
|
||||||
|
'<(DEPTH)/content/browser/geolocation/device_data_provider.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/empty_device_data_provider.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/geolocation_provider.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/location_arbitrator.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/location_provider.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/network_location_provider.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/network_location_request.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/wifi_data_provider_common.cc',
|
||||||
|
'<(DEPTH)/content/common/net/url_fetcher.cc',
|
||||||
|
'<(DEPTH)/content/common/net/url_request_user_data.cc',
|
||||||
|
'<(DEPTH)/content/public/common/geoposition.cc',
|
||||||
],
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['OS=="win"', {
|
['OS=="win"', {
|
||||||
@ -767,7 +781,6 @@
|
|||||||
'<(DEPTH)/breakpad/breakpad.gyp:breakpad_handler',
|
'<(DEPTH)/breakpad/breakpad.gyp:breakpad_handler',
|
||||||
'<(DEPTH)/third_party/angle/src/build_angle.gyp:libEGL',
|
'<(DEPTH)/third_party/angle/src/build_angle.gyp:libEGL',
|
||||||
'<(DEPTH)/third_party/angle/src/build_angle.gyp:libGLESv2',
|
'<(DEPTH)/third_party/angle/src/build_angle.gyp:libGLESv2',
|
||||||
'<(DEPTH)/ui/views/views.gyp:views',
|
|
||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'<@(includes_win)',
|
'<@(includes_win)',
|
||||||
@ -790,6 +803,11 @@
|
|||||||
'libcef/web_drop_target_win.h',
|
'libcef/web_drop_target_win.h',
|
||||||
'libcef/webview_host_win.cc',
|
'libcef/webview_host_win.cc',
|
||||||
'libcef/webwidget_host_win.cc',
|
'libcef/webwidget_host_win.cc',
|
||||||
|
# Geolocation implementation
|
||||||
|
'<(DEPTH)/content/browser/geolocation/wifi_data_provider_common_win.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/wifi_data_provider_win.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/win7_location_api_win.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/win7_location_provider_win.cc',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
[ 'OS=="mac"', {
|
[ 'OS=="mac"', {
|
||||||
@ -818,9 +836,18 @@
|
|||||||
'<(DEPTH)/third_party/mozilla/NSString+Utils.mm',
|
'<(DEPTH)/third_party/mozilla/NSString+Utils.mm',
|
||||||
'<(DEPTH)/third_party/mozilla/NSURL+Utils.h',
|
'<(DEPTH)/third_party/mozilla/NSURL+Utils.h',
|
||||||
'<(DEPTH)/third_party/mozilla/NSURL+Utils.m',
|
'<(DEPTH)/third_party/mozilla/NSURL+Utils.m',
|
||||||
|
# Geolocation implementation
|
||||||
|
'<(DEPTH)/content/browser/geolocation/core_location_data_provider_mac.mm',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/core_location_provider_mac.mm',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/wifi_data_provider_corewlan_mac.mm',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/wifi_data_provider_mac.cc',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
|
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
|
||||||
|
'dependencies': [
|
||||||
|
'<(DEPTH)/build/linux/system.gyp:dbus',
|
||||||
|
'<(DEPTH)/dbus/dbus.gyp:dbus',
|
||||||
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'<@(includes_linux)',
|
'<@(includes_linux)',
|
||||||
'libcef/browser_impl_gtk.cc',
|
'libcef/browser_impl_gtk.cc',
|
||||||
@ -840,6 +867,10 @@
|
|||||||
'<(DEPTH)/ui/base/dragdrop/os_exchange_data.h',
|
'<(DEPTH)/ui/base/dragdrop/os_exchange_data.h',
|
||||||
'<(DEPTH)/ui/base/dragdrop/os_exchange_data_provider_gtk.cc',
|
'<(DEPTH)/ui/base/dragdrop/os_exchange_data_provider_gtk.cc',
|
||||||
'<(DEPTH)/ui/base/dragdrop/os_exchange_data_provider_gtk.h',
|
'<(DEPTH)/ui/base/dragdrop/os_exchange_data_provider_gtk.h',
|
||||||
|
# Geolocation implementation
|
||||||
|
'<(DEPTH)/content/browser/geolocation/gps_location_provider_linux.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/libgps_wrapper_linux.cc',
|
||||||
|
'<(DEPTH)/content/browser/geolocation/wifi_data_provider_linux.cc',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
'include/cef_find_handler.h',
|
'include/cef_find_handler.h',
|
||||||
'include/cef_focus_handler.h',
|
'include/cef_focus_handler.h',
|
||||||
'include/cef_frame.h',
|
'include/cef_frame.h',
|
||||||
|
'include/cef_geolocation_handler.h',
|
||||||
'include/cef_jsdialog_handler.h',
|
'include/cef_jsdialog_handler.h',
|
||||||
'include/cef_keyboard_handler.h',
|
'include/cef_keyboard_handler.h',
|
||||||
'include/cef_life_span_handler.h',
|
'include/cef_life_span_handler.h',
|
||||||
@ -66,6 +67,7 @@
|
|||||||
'include/capi/cef_find_handler_capi.h',
|
'include/capi/cef_find_handler_capi.h',
|
||||||
'include/capi/cef_focus_handler_capi.h',
|
'include/capi/cef_focus_handler_capi.h',
|
||||||
'include/capi/cef_frame_capi.h',
|
'include/capi/cef_frame_capi.h',
|
||||||
|
'include/capi/cef_geolocation_handler_capi.h',
|
||||||
'include/capi/cef_jsdialog_handler_capi.h',
|
'include/capi/cef_jsdialog_handler_capi.h',
|
||||||
'include/capi/cef_keyboard_handler_capi.h',
|
'include/capi/cef_keyboard_handler_capi.h',
|
||||||
'include/capi/cef_life_span_handler_capi.h',
|
'include/capi/cef_life_span_handler_capi.h',
|
||||||
@ -130,6 +132,10 @@
|
|||||||
'libcef_dll/ctocpp/focus_handler_ctocpp.h',
|
'libcef_dll/ctocpp/focus_handler_ctocpp.h',
|
||||||
'libcef_dll/cpptoc/frame_cpptoc.cc',
|
'libcef_dll/cpptoc/frame_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/frame_cpptoc.h',
|
'libcef_dll/cpptoc/frame_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/geolocation_callback_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/geolocation_callback_cpptoc.h',
|
||||||
|
'libcef_dll/ctocpp/geolocation_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/geolocation_handler_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc',
|
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.h',
|
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/keyboard_handler_ctocpp.cc',
|
'libcef_dll/ctocpp/keyboard_handler_ctocpp.cc',
|
||||||
@ -242,6 +248,10 @@
|
|||||||
'libcef_dll/cpptoc/focus_handler_cpptoc.h',
|
'libcef_dll/cpptoc/focus_handler_cpptoc.h',
|
||||||
'libcef_dll/ctocpp/frame_ctocpp.cc',
|
'libcef_dll/ctocpp/frame_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/frame_ctocpp.h',
|
'libcef_dll/ctocpp/frame_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/geolocation_callback_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/geolocation_callback_ctocpp.h',
|
||||||
|
'libcef_dll/cpptoc/geolocation_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/geolocation_handler_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc',
|
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.h',
|
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/keyboard_handler_cpptoc.cc',
|
'libcef_dll/cpptoc/keyboard_handler_cpptoc.cc',
|
||||||
|
@ -137,6 +137,13 @@ typedef struct _cef_client_t {
|
|||||||
///
|
///
|
||||||
struct _cef_drag_handler_t* (CEF_CALLBACK *get_drag_handler)(
|
struct _cef_drag_handler_t* (CEF_CALLBACK *get_drag_handler)(
|
||||||
struct _cef_client_t* self);
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Return the handler for geolocation permissions requests. If no handler is
|
||||||
|
// provided geolocation access will be denied by default.
|
||||||
|
///
|
||||||
|
struct _cef_geolocation_handler_t* (CEF_CALLBACK *get_geolocation_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
} cef_client_t;
|
} cef_client_t;
|
||||||
|
|
||||||
|
|
||||||
|
104
cef1/include/capi/cef_geolocation_handler_capi.h
Normal file
104
cef1/include/capi/cef_geolocation_handler_capi.h
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool and should not edited
|
||||||
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_
|
||||||
|
#define CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "include/capi/cef_base_capi.h"
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
// Callback structure used for asynchronous continuation of geolocation
|
||||||
|
// permission requests.
|
||||||
|
///
|
||||||
|
typedef struct _cef_geolocation_callback_t {
|
||||||
|
///
|
||||||
|
// Base structure.
|
||||||
|
///
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Call to allow or deny geolocation access.
|
||||||
|
///
|
||||||
|
void (CEF_CALLBACK *cont)(struct _cef_geolocation_callback_t* self,
|
||||||
|
int allow);
|
||||||
|
} cef_geolocation_callback_t;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
// Implement this structure to handle events related to geolocation permission
|
||||||
|
// requests. The functions of this structure will be called on the browser
|
||||||
|
// process IO thread.
|
||||||
|
///
|
||||||
|
typedef struct _cef_geolocation_handler_t {
|
||||||
|
///
|
||||||
|
// Base structure.
|
||||||
|
///
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Called when a page requests permission to access geolocation information.
|
||||||
|
// |requesting_url| is the URL requesting permission and |request_id| is the
|
||||||
|
// unique ID for the permission request. Call
|
||||||
|
// cef_geolocation_callback_t::Continue to allow or deny the permission
|
||||||
|
// request.
|
||||||
|
///
|
||||||
|
void (CEF_CALLBACK *on_request_geolocation_permission)(
|
||||||
|
struct _cef_geolocation_handler_t* self, struct _cef_browser_t* browser,
|
||||||
|
const cef_string_t* requesting_url, int request_id,
|
||||||
|
struct _cef_geolocation_callback_t* callback);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Called when a geolocation access request is canceled. |requesting_url| is
|
||||||
|
// the URL that originally requested permission and |request_id| is the unique
|
||||||
|
// ID for the permission request.
|
||||||
|
///
|
||||||
|
void (CEF_CALLBACK *on_cancel_geolocation_permission)(
|
||||||
|
struct _cef_geolocation_handler_t* self, struct _cef_browser_t* browser,
|
||||||
|
const cef_string_t* requesting_url, int request_id);
|
||||||
|
} cef_geolocation_handler_t;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_
|
@ -43,6 +43,7 @@
|
|||||||
#include "include/cef_drag_handler.h"
|
#include "include/cef_drag_handler.h"
|
||||||
#include "include/cef_find_handler.h"
|
#include "include/cef_find_handler.h"
|
||||||
#include "include/cef_focus_handler.h"
|
#include "include/cef_focus_handler.h"
|
||||||
|
#include "include/cef_geolocation_handler.h"
|
||||||
#include "include/cef_jsdialog_handler.h"
|
#include "include/cef_jsdialog_handler.h"
|
||||||
#include "include/cef_keyboard_handler.h"
|
#include "include/cef_keyboard_handler.h"
|
||||||
#include "include/cef_life_span_handler.h"
|
#include "include/cef_life_span_handler.h"
|
||||||
@ -171,6 +172,15 @@ class CefClient : public virtual CefBase {
|
|||||||
virtual CefRefPtr<CefDragHandler> GetDragHandler() {
|
virtual CefRefPtr<CefDragHandler> GetDragHandler() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
// Return the handler for geolocation permissions requests. If no handler is
|
||||||
|
// provided geolocation access will be denied by default.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CEF_CLIENT_H_
|
#endif // CEF_INCLUDE_CEF_CLIENT_H_
|
||||||
|
94
cef1/include/cef_geolocation_handler.h
Normal file
94
cef1/include/cef_geolocation_handler.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// The contents of this file must follow a specific format in order to
|
||||||
|
// support the CEF translator tool. See the translator.README.txt file in the
|
||||||
|
// tools directory for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_
|
||||||
|
#define CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/cef_base.h"
|
||||||
|
#include "include/cef_browser.h"
|
||||||
|
|
||||||
|
///
|
||||||
|
// Callback interface used for asynchronous continuation of geolocation
|
||||||
|
// permission requests.
|
||||||
|
///
|
||||||
|
/*--cef(source=library)--*/
|
||||||
|
class CefGeolocationCallback : public virtual CefBase {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
// Call to allow or deny geolocation access.
|
||||||
|
///
|
||||||
|
/*--cef(capi_name=cont)--*/
|
||||||
|
virtual void Continue(bool allow) =0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
// Implement this interface to handle events related to geolocation permission
|
||||||
|
// requests. The methods of this class will be called on the browser process IO
|
||||||
|
// thread.
|
||||||
|
///
|
||||||
|
/*--cef(source=client)--*/
|
||||||
|
class CefGeolocationHandler : public virtual CefBase {
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
// Called when a page requests permission to access geolocation information.
|
||||||
|
// |requesting_url| is the URL requesting permission and |request_id| is the
|
||||||
|
// unique ID for the permission request. Call CefGeolocationCallback::Continue
|
||||||
|
// to allow or deny the permission request.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual void OnRequestGeolocationPermission(
|
||||||
|
CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& requesting_url,
|
||||||
|
int request_id,
|
||||||
|
CefRefPtr<CefGeolocationCallback> callback) {
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
// Called when a geolocation access request is canceled. |requesting_url| is
|
||||||
|
// the URL that originally requested permission and |request_id| is the unique
|
||||||
|
// ID for the permission request.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual void OnCancelGeolocationPermission(
|
||||||
|
CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& requesting_url,
|
||||||
|
int request_id) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_
|
@ -364,6 +364,12 @@ void CefBrowserImpl::CloseDevTools() {
|
|||||||
base::Bind(&CefBrowserImpl::UIT_CloseDevTools, this));
|
base::Bind(&CefBrowserImpl::UIT_CloseDevTools, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebKit::WebGeolocationClient* CefBrowserImpl::UIT_GetGeolocationClient() {
|
||||||
|
if (!geolocation_client_)
|
||||||
|
geolocation_client_ = new CefGeolocationClient(this);
|
||||||
|
return geolocation_client_;
|
||||||
|
}
|
||||||
|
|
||||||
bool CefBrowserImpl::GetSize(PaintElementType type, int& width, int& height) {
|
bool CefBrowserImpl::GetSize(PaintElementType type, int& width, int& height) {
|
||||||
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
||||||
NOTREACHED() << "called on invalid thread";
|
NOTREACHED() << "called on invalid thread";
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "libcef/browser_navigation_controller.h"
|
#include "libcef/browser_navigation_controller.h"
|
||||||
#include "libcef/browser_request_context_proxy.h"
|
#include "libcef/browser_request_context_proxy.h"
|
||||||
#include "libcef/cef_thread.h"
|
#include "libcef/cef_thread.h"
|
||||||
|
#include "libcef/geolocation_client.h"
|
||||||
#include "libcef/tracker.h"
|
#include "libcef/tracker.h"
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "libcef/printing/win_printing_context.h"
|
#include "libcef/printing/win_printing_context.h"
|
||||||
@ -314,6 +315,7 @@ class CefBrowserImpl : public CefBrowser {
|
|||||||
void UIT_SetZoomLevel(double zoomLevel);
|
void UIT_SetZoomLevel(double zoomLevel);
|
||||||
void UIT_ShowDevTools();
|
void UIT_ShowDevTools();
|
||||||
void UIT_CloseDevTools();
|
void UIT_CloseDevTools();
|
||||||
|
WebKit::WebGeolocationClient* UIT_GetGeolocationClient();
|
||||||
|
|
||||||
void UIT_VisitDOM(CefRefPtr<CefFrame> frame,
|
void UIT_VisitDOM(CefRefPtr<CefFrame> frame,
|
||||||
CefRefPtr<CefDOMVisitor> visitor);
|
CefRefPtr<CefDOMVisitor> visitor);
|
||||||
@ -386,6 +388,9 @@ class CefBrowserImpl : public CefBrowser {
|
|||||||
|
|
||||||
scoped_ptr<BrowserRequestContextProxy> request_context_proxy_;
|
scoped_ptr<BrowserRequestContextProxy> request_context_proxy_;
|
||||||
|
|
||||||
|
// The geolocation client attached to this view, lazily initialized.
|
||||||
|
scoped_refptr<CefGeolocationClient> geolocation_client_;
|
||||||
|
|
||||||
CefString title_;
|
CefString title_;
|
||||||
|
|
||||||
double zoom_level_;
|
double zoom_level_;
|
||||||
|
@ -46,10 +46,10 @@ BrowserWebKitInit::BrowserWebKitInit()
|
|||||||
WebKit::WebRuntimeFeatures::enablePushState(true);
|
WebKit::WebRuntimeFeatures::enablePushState(true);
|
||||||
WebKit::WebRuntimeFeatures::enableIndexedDatabase(true);
|
WebKit::WebRuntimeFeatures::enableIndexedDatabase(true);
|
||||||
WebKit::WebRuntimeFeatures::enableFileSystem(true);
|
WebKit::WebRuntimeFeatures::enableFileSystem(true);
|
||||||
|
WebKit::WebRuntimeFeatures::enableGeolocation(true);
|
||||||
|
|
||||||
// TODO(cef): Enable these once the implementation supports it.
|
// TODO(cef): Enable these once the implementation supports it.
|
||||||
WebKit::WebRuntimeFeatures::enableNotifications(false);
|
WebKit::WebRuntimeFeatures::enableNotifications(false);
|
||||||
WebKit::WebRuntimeFeatures::enableGeolocation(false);
|
|
||||||
WebKit::WebRuntimeFeatures::enableSpeechInput(false);
|
WebKit::WebRuntimeFeatures::enableSpeechInput(false);
|
||||||
WebKit::WebRuntimeFeatures::enableTouch(false);
|
WebKit::WebRuntimeFeatures::enableTouch(false);
|
||||||
WebKit::WebRuntimeFeatures::enableDeviceMotion(false);
|
WebKit::WebRuntimeFeatures::enableDeviceMotion(false);
|
||||||
|
@ -490,6 +490,10 @@ int BrowserWebViewDelegate::historyForwardListCount() {
|
|||||||
- current_index - 1;
|
- current_index - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebKit::WebGeolocationClient* BrowserWebViewDelegate::geolocationClient() {
|
||||||
|
return browser_->UIT_GetGeolocationClient();
|
||||||
|
}
|
||||||
|
|
||||||
// WebPermissionClient -------------------------------------------------------
|
// WebPermissionClient -------------------------------------------------------
|
||||||
|
|
||||||
bool BrowserWebViewDelegate::allowScriptExtension(
|
bool BrowserWebViewDelegate::allowScriptExtension(
|
||||||
|
@ -133,6 +133,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||||||
virtual void navigateBackForwardSoon(int offset) OVERRIDE;
|
virtual void navigateBackForwardSoon(int offset) OVERRIDE;
|
||||||
virtual int historyBackListCount() OVERRIDE;
|
virtual int historyBackListCount() OVERRIDE;
|
||||||
virtual int historyForwardListCount() OVERRIDE;
|
virtual int historyForwardListCount() OVERRIDE;
|
||||||
|
virtual WebKit::WebGeolocationClient* geolocationClient() OVERRIDE;
|
||||||
|
|
||||||
// WebKit::WebWidgetClient
|
// WebKit::WebWidgetClient
|
||||||
virtual void didInvalidateRect(const WebKit::WebRect& rect) OVERRIDE;
|
virtual void didInvalidateRect(const WebKit::WebRect& rect) OVERRIDE;
|
||||||
|
352
cef1/libcef/geolocation_client.cc
Normal file
352
cef1/libcef/geolocation_client.cc
Normal file
@ -0,0 +1,352 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
||||||
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "libcef/geolocation_client.h"
|
||||||
|
#include "libcef/browser_impl.h"
|
||||||
|
#include "libcef/cef_context.h"
|
||||||
|
#include "libcef/cef_thread.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
|
#include "base/logging.h"
|
||||||
|
#include "content/browser/geolocation/arbitrator_dependency_factory.h"
|
||||||
|
#include "content/browser/geolocation/geolocation_observer.h"
|
||||||
|
#include "content/browser/geolocation/geolocation_provider.h"
|
||||||
|
#include "content/browser/geolocation/location_provider.h"
|
||||||
|
#include "content/public/browser/access_token_store.h"
|
||||||
|
#include "content/public/common/geoposition.h"
|
||||||
|
#include "content/public/common/content_switches.h"
|
||||||
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationPermissionRequest.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationPermissionRequestManager.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationClient.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationPosition.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationError.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
||||||
|
|
||||||
|
using WebKit::WebGeolocationController;
|
||||||
|
using WebKit::WebGeolocationError;
|
||||||
|
using WebKit::WebGeolocationPermissionRequest;
|
||||||
|
using WebKit::WebGeolocationPermissionRequestManager;
|
||||||
|
using WebKit::WebGeolocationPosition;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class CefURLRequestContextGetter : public net::URLRequestContextGetter {
|
||||||
|
public:
|
||||||
|
CefURLRequestContextGetter() {}
|
||||||
|
|
||||||
|
virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE {
|
||||||
|
return _Context->request_context();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual scoped_refptr<base::SingleThreadTaskRunner>
|
||||||
|
GetNetworkTaskRunner() const OVERRIDE {
|
||||||
|
return CefThread::GetMessageLoopProxyForThread(CefThread::IO);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetter);
|
||||||
|
};
|
||||||
|
|
||||||
|
// In-memory store for access tokens used by geolocation.
|
||||||
|
class CefAccessTokenStore : public content::AccessTokenStore {
|
||||||
|
public:
|
||||||
|
CefAccessTokenStore() {}
|
||||||
|
|
||||||
|
virtual void LoadAccessTokens(
|
||||||
|
const LoadAccessTokensCallbackType& callback) OVERRIDE {
|
||||||
|
if (!request_context_getter_)
|
||||||
|
request_context_getter_ = new CefURLRequestContextGetter;
|
||||||
|
callback.Run(access_token_set_, request_context_getter_);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void SaveAccessToken(
|
||||||
|
const GURL& server_url, const string16& access_token) OVERRIDE {
|
||||||
|
access_token_set_[server_url] = access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
AccessTokenSet access_token_set_;
|
||||||
|
scoped_refptr<CefURLRequestContextGetter> request_context_getter_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefAccessTokenStore);
|
||||||
|
};
|
||||||
|
|
||||||
|
void NotifyArbitratorPermissionGranted() {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
|
||||||
|
GeolocationProvider::GetInstance()->OnPermissionGranted();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
|
// CefGeolocationCallback implementation.
|
||||||
|
class CefGeolocationCallbackImpl : public CefGeolocationCallback {
|
||||||
|
public:
|
||||||
|
CefGeolocationCallbackImpl(CefGeolocationClient* client, int bridge_id)
|
||||||
|
: client_(client),
|
||||||
|
bridge_id_(bridge_id) {}
|
||||||
|
|
||||||
|
virtual void Continue(bool allow) OVERRIDE {
|
||||||
|
if (CefThread::CurrentlyOn(CefThread::UI)) {
|
||||||
|
if (client_) {
|
||||||
|
client_->OnPermissionSet(bridge_id_, allow);
|
||||||
|
client_ = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
|
base::Bind(&CefGeolocationCallbackImpl::Continue, this, allow));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
scoped_refptr<CefGeolocationClient> client_;
|
||||||
|
int bridge_id_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefGeolocationCallbackImpl);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CefGeolocationClient::CefGeolocationClient(CefBrowserImpl* browser)
|
||||||
|
: browser_(browser),
|
||||||
|
pending_permissions_(new WebGeolocationPermissionRequestManager()),
|
||||||
|
enable_high_accuracy_(false),
|
||||||
|
updating_(false),
|
||||||
|
location_provider_(NULL) {
|
||||||
|
}
|
||||||
|
|
||||||
|
CefGeolocationClient::~CefGeolocationClient() {}
|
||||||
|
|
||||||
|
void CefGeolocationClient::geolocationDestroyed() {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::UI));
|
||||||
|
|
||||||
|
controller_.reset();
|
||||||
|
DCHECK(!updating_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationClient::startUpdating() {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::UI));
|
||||||
|
|
||||||
|
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
||||||
|
base::Bind(&CefGeolocationClient::OnStartUpdating, this,
|
||||||
|
enable_high_accuracy_));
|
||||||
|
updating_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationClient::stopUpdating() {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::UI));
|
||||||
|
|
||||||
|
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
||||||
|
base::Bind(&CefGeolocationClient::OnStopUpdating, this));
|
||||||
|
updating_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationClient::setEnableHighAccuracy(bool enable_high_accuracy) {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::UI));
|
||||||
|
|
||||||
|
// GeolocationController calls setEnableHighAccuracy(true) before
|
||||||
|
// startUpdating in response to the first high-accuracy Geolocation
|
||||||
|
// subscription. When the last high-accuracy Geolocation unsubscribes
|
||||||
|
// it calls setEnableHighAccuracy(false) after stopUpdating.
|
||||||
|
bool has_changed = enable_high_accuracy_ != enable_high_accuracy;
|
||||||
|
enable_high_accuracy_ = enable_high_accuracy;
|
||||||
|
// We have a different accuracy requirement. Request browser to update.
|
||||||
|
if (updating_ && has_changed)
|
||||||
|
startUpdating();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationClient::setController(
|
||||||
|
WebGeolocationController* controller) {
|
||||||
|
controller_.reset(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefGeolocationClient::lastPosition(WebGeolocationPosition&) {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::UI));
|
||||||
|
|
||||||
|
// The latest position is stored in the browser, not the renderer, so we
|
||||||
|
// would have to fetch it synchronously to give a good value here. The
|
||||||
|
// WebCore::GeolocationController already caches the last position it
|
||||||
|
// receives, so there is not much benefit to more position caching here.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationClient::requestPermission(
|
||||||
|
const WebGeolocationPermissionRequest& permissionRequest) {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::UI));
|
||||||
|
|
||||||
|
int bridge_id = pending_permissions_->add(permissionRequest);
|
||||||
|
string16 origin = permissionRequest.securityOrigin().toString();
|
||||||
|
|
||||||
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefGeolocationHandler> handler =
|
||||||
|
client->GetGeolocationHandler();
|
||||||
|
if (handler.get()) {
|
||||||
|
CefRefPtr<CefGeolocationCallbackImpl> callbackPtr(
|
||||||
|
new CefGeolocationCallbackImpl(this, bridge_id));
|
||||||
|
|
||||||
|
handler->OnRequestGeolocationPermission(browser_, origin, bridge_id,
|
||||||
|
callbackPtr.get());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disallow geolocation access by default.
|
||||||
|
OnPermissionSet(bridge_id, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationClient::cancelPermissionRequest(
|
||||||
|
const WebGeolocationPermissionRequest& permissionRequest) {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::UI));
|
||||||
|
|
||||||
|
int bridge_id;
|
||||||
|
if (!pending_permissions_->remove(permissionRequest, bridge_id))
|
||||||
|
return;
|
||||||
|
string16 origin = permissionRequest.securityOrigin().toString();
|
||||||
|
|
||||||
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefGeolocationHandler> handler =
|
||||||
|
client->GetGeolocationHandler();
|
||||||
|
if (handler.get())
|
||||||
|
handler->OnCancelGeolocationPermission(browser_, origin, bridge_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationClient::OnStartUpdating(bool enable_high_accuracy) {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
|
||||||
|
|
||||||
|
if (!location_provider_)
|
||||||
|
location_provider_ = GeolocationProvider::GetInstance();
|
||||||
|
|
||||||
|
// Re-add to re-establish our options, in case they changed.
|
||||||
|
location_provider_->AddObserver(
|
||||||
|
this, GeolocationObserverOptions(enable_high_accuracy));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationClient::OnStopUpdating() {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
|
||||||
|
|
||||||
|
if (location_provider_) {
|
||||||
|
location_provider_->RemoveObserver(this);
|
||||||
|
location_provider_ = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationClient::OnLocationUpdate(
|
||||||
|
const content::Geoposition& position) {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
|
||||||
|
|
||||||
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
|
base::Bind(&CefGeolocationClient::OnPositionUpdated, this, position));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Permission for using geolocation has been set.
|
||||||
|
void CefGeolocationClient::OnPermissionSet(int bridge_id, bool is_allowed) {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::UI));
|
||||||
|
|
||||||
|
WebGeolocationPermissionRequest permissionRequest;
|
||||||
|
if (!pending_permissions_->remove(bridge_id, permissionRequest))
|
||||||
|
return;
|
||||||
|
permissionRequest.setIsAllowed(is_allowed);
|
||||||
|
|
||||||
|
if (is_allowed) {
|
||||||
|
CefThread::PostTask(
|
||||||
|
CefThread::IO, FROM_HERE,
|
||||||
|
base::Bind(&NotifyArbitratorPermissionGranted));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have an updated geolocation position or error code.
|
||||||
|
void CefGeolocationClient::OnPositionUpdated(
|
||||||
|
const content::Geoposition& geoposition) {
|
||||||
|
DCHECK(CefThread::CurrentlyOn(CefThread::UI));
|
||||||
|
|
||||||
|
// It is possible for the browser process to have queued an update message
|
||||||
|
// before receiving the stop updating message.
|
||||||
|
if (!updating_)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (geoposition.Validate()) {
|
||||||
|
controller_->positionChanged(
|
||||||
|
WebGeolocationPosition(
|
||||||
|
geoposition.timestamp.ToDoubleT(),
|
||||||
|
geoposition.latitude, geoposition.longitude,
|
||||||
|
geoposition.accuracy,
|
||||||
|
// Lowest point on land is at approximately -400 meters.
|
||||||
|
geoposition.altitude > -10000.,
|
||||||
|
geoposition.altitude,
|
||||||
|
geoposition.altitude_accuracy >= 0.,
|
||||||
|
geoposition.altitude_accuracy,
|
||||||
|
geoposition.heading >= 0. && geoposition.heading <= 360.,
|
||||||
|
geoposition.heading,
|
||||||
|
geoposition.speed >= 0.,
|
||||||
|
geoposition.speed));
|
||||||
|
} else {
|
||||||
|
WebGeolocationError::Error code;
|
||||||
|
switch (geoposition.error_code) {
|
||||||
|
case content::Geoposition::ERROR_CODE_PERMISSION_DENIED:
|
||||||
|
code = WebGeolocationError::ErrorPermissionDenied;
|
||||||
|
break;
|
||||||
|
case content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE:
|
||||||
|
code = WebGeolocationError::ErrorPositionUnavailable;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
NOTREACHED() << geoposition.error_code;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
controller_->errorOccurred(
|
||||||
|
WebGeolocationError(
|
||||||
|
code, WebKit::WebString::fromUTF8(geoposition.error_message)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Replacement for content/browser/geolocation/arbitrator_dependency_factory.cc
|
||||||
|
|
||||||
|
// GeolocationArbitratorDependencyFactory
|
||||||
|
GeolocationArbitratorDependencyFactory::
|
||||||
|
~GeolocationArbitratorDependencyFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultGeolocationArbitratorDependencyFactory
|
||||||
|
DefaultGeolocationArbitratorDependencyFactory::
|
||||||
|
~DefaultGeolocationArbitratorDependencyFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultGeolocationArbitratorDependencyFactory::GetTimeNow
|
||||||
|
DefaultGeolocationArbitratorDependencyFactory::GetTimeFunction() {
|
||||||
|
return base::Time::Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
content::AccessTokenStore*
|
||||||
|
DefaultGeolocationArbitratorDependencyFactory::NewAccessTokenStore() {
|
||||||
|
return new CefAccessTokenStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
LocationProviderBase*
|
||||||
|
DefaultGeolocationArbitratorDependencyFactory::NewNetworkLocationProvider(
|
||||||
|
content::AccessTokenStore* access_token_store,
|
||||||
|
net::URLRequestContextGetter* context,
|
||||||
|
const GURL& url,
|
||||||
|
const string16& access_token) {
|
||||||
|
return ::NewNetworkLocationProvider(access_token_store, context,
|
||||||
|
url, access_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
LocationProviderBase*
|
||||||
|
DefaultGeolocationArbitratorDependencyFactory::NewSystemLocationProvider() {
|
||||||
|
return ::NewSystemLocationProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Extract from content/public/common/content_switches.cc.
|
||||||
|
|
||||||
|
namespace switches {
|
||||||
|
|
||||||
|
const char kExperimentalLocationFeatures[] = "experimental-location-features";
|
||||||
|
|
||||||
|
} // namespace switches
|
88
cef1/libcef/geolocation_client.h
Normal file
88
cef1/libcef/geolocation_client.h
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
||||||
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_GEOLOCATION_CLIENT_H_
|
||||||
|
#define CEF_LIBCEF_GEOLOCATION_CLIENT_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "base/memory/ref_counted.h"
|
||||||
|
#include "base/memory/scoped_ptr.h"
|
||||||
|
#include "content/browser/geolocation/geolocation_observer.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationClient.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationController.h"
|
||||||
|
|
||||||
|
class CefBrowserImpl;
|
||||||
|
class CefGeolocationCallbackImpl;
|
||||||
|
class GeolocationProvider;
|
||||||
|
struct Geoposition;
|
||||||
|
|
||||||
|
namespace WebKit {
|
||||||
|
class WebGeolocationController;
|
||||||
|
class WebGeolocationPermissionRequest;
|
||||||
|
class WebGeolocationPermissionRequestManager;
|
||||||
|
class WebGeolocationPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delegate for Geolocation messages used by WebKit.
|
||||||
|
class CefGeolocationClient
|
||||||
|
: public WebKit::WebGeolocationClient,
|
||||||
|
public GeolocationObserver,
|
||||||
|
public base::RefCountedThreadSafe<CefGeolocationClient> {
|
||||||
|
public:
|
||||||
|
explicit CefGeolocationClient(CefBrowserImpl* browser);
|
||||||
|
virtual ~CefGeolocationClient();
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class CefGeolocationCallbackImpl;
|
||||||
|
|
||||||
|
// WebGeolocationClient methods.
|
||||||
|
virtual void geolocationDestroyed();
|
||||||
|
virtual void startUpdating();
|
||||||
|
virtual void stopUpdating();
|
||||||
|
virtual void setEnableHighAccuracy(bool enable_high_accuracy);
|
||||||
|
virtual void setController(WebKit::WebGeolocationController* controller);
|
||||||
|
virtual bool lastPosition(WebKit::WebGeolocationPosition& position);
|
||||||
|
virtual void requestPermission(
|
||||||
|
const WebKit::WebGeolocationPermissionRequest& permissionRequest);
|
||||||
|
virtual void cancelPermissionRequest(
|
||||||
|
const WebKit::WebGeolocationPermissionRequest& permissionRequest);
|
||||||
|
|
||||||
|
// Called to continue processing on the IO thread.
|
||||||
|
void OnStartUpdating(bool enable_high_accuracy);
|
||||||
|
void OnStopUpdating();
|
||||||
|
|
||||||
|
// GeolocationObserver methods.
|
||||||
|
virtual void OnLocationUpdate(const content::Geoposition& position) OVERRIDE;
|
||||||
|
|
||||||
|
// Permission for using geolocation has been set.
|
||||||
|
void OnPermissionSet(int bridge_id, bool is_allowed);
|
||||||
|
|
||||||
|
// We have an updated geolocation position or error code.
|
||||||
|
void OnPositionUpdated(const content::Geoposition& geoposition);
|
||||||
|
|
||||||
|
// The following members are only accessed on the UI thread.
|
||||||
|
|
||||||
|
// The |browser_| pointer is guaranteed to outlive this object.
|
||||||
|
CefBrowserImpl* browser_;
|
||||||
|
|
||||||
|
// The controller_ is valid for the lifetime of the underlying
|
||||||
|
// WebCore::GeolocationController. geolocationDestroyed() is
|
||||||
|
// invoked when the underlying object is destroyed.
|
||||||
|
scoped_ptr<WebKit::WebGeolocationController> controller_;
|
||||||
|
|
||||||
|
scoped_ptr<WebKit::WebGeolocationPermissionRequestManager>
|
||||||
|
pending_permissions_;
|
||||||
|
bool enable_high_accuracy_;
|
||||||
|
bool updating_;
|
||||||
|
|
||||||
|
// The following members are only accessed on the IO thread.
|
||||||
|
|
||||||
|
// Only set whilst we are registered with the arbitrator.
|
||||||
|
GeolocationProvider* location_provider_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefGeolocationClient);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_GEOLOCATION_CLIENT_H_
|
@ -15,6 +15,7 @@
|
|||||||
#include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/find_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/find_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
|
||||||
@ -253,6 +254,22 @@ struct _cef_drag_handler_t* CEF_CALLBACK client_get_drag_handler(
|
|||||||
return CefDragHandlerCppToC::Wrap(_retval);
|
return CefDragHandlerCppToC::Wrap(_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct _cef_geolocation_handler_t* CEF_CALLBACK client_get_geolocation_handler(
|
||||||
|
struct _cef_client_t* self) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefRefPtr<CefGeolocationHandler> _retval = CefClientCppToC::Get(
|
||||||
|
self)->GetGeolocationHandler();
|
||||||
|
|
||||||
|
// Return type: refptr_same
|
||||||
|
return CefGeolocationHandlerCppToC::Wrap(_retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// CONSTRUCTOR - Do not edit by hand.
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
@ -272,6 +289,7 @@ CefClientCppToC::CefClientCppToC(CefClient* cls)
|
|||||||
struct_.struct_.get_v8context_handler = client_get_v8context_handler;
|
struct_.struct_.get_v8context_handler = client_get_v8context_handler;
|
||||||
struct_.struct_.get_render_handler = client_get_render_handler;
|
struct_.struct_.get_render_handler = client_get_render_handler;
|
||||||
struct_.struct_.get_drag_handler = client_get_drag_handler;
|
struct_.struct_.get_drag_handler = client_get_drag_handler;
|
||||||
|
struct_.struct_.get_geolocation_handler = client_get_geolocation_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
45
cef1/libcef_dll/cpptoc/geolocation_callback_cpptoc.cc
Normal file
45
cef1/libcef_dll/cpptoc/geolocation_callback_cpptoc.cc
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CEF_CALLBACK geolocation_callback_cont(
|
||||||
|
struct _cef_geolocation_callback_t* self, int allow) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefGeolocationCallbackCppToC::Get(self)->Continue(
|
||||||
|
allow?true:false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefGeolocationCallbackCppToC::CefGeolocationCallbackCppToC(
|
||||||
|
CefGeolocationCallback* cls)
|
||||||
|
: CefCppToC<CefGeolocationCallbackCppToC, CefGeolocationCallback,
|
||||||
|
cef_geolocation_callback_t>(cls) {
|
||||||
|
struct_.struct_.cont = geolocation_callback_cont;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefGeolocationCallbackCppToC, CefGeolocationCallback,
|
||||||
|
cef_geolocation_callback_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
37
cef1/libcef_dll/cpptoc/geolocation_callback_cpptoc.h
Normal file
37
cef1/libcef_dll/cpptoc/geolocation_callback_cpptoc.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_CALLBACK_CPPTOC_H_
|
||||||
|
#define CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_CALLBACK_CPPTOC_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef BUILDING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||||
|
#else // BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef_geolocation_handler.h"
|
||||||
|
#include "include/capi/cef_geolocation_handler_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed DLL-side only.
|
||||||
|
class CefGeolocationCallbackCppToC
|
||||||
|
: public CefCppToC<CefGeolocationCallbackCppToC, CefGeolocationCallback,
|
||||||
|
cef_geolocation_callback_t> {
|
||||||
|
public:
|
||||||
|
explicit CefGeolocationCallbackCppToC(CefGeolocationCallback* cls);
|
||||||
|
virtual ~CefGeolocationCallbackCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
#endif // CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_CALLBACK_CPPTOC_H_
|
||||||
|
|
91
cef1/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc
Normal file
91
cef1/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CEF_CALLBACK geolocation_handler_on_request_geolocation_permission(
|
||||||
|
struct _cef_geolocation_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_string_t* requesting_url, int request_id,
|
||||||
|
cef_geolocation_callback_t* callback) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
|
// Verify param: browser; type: refptr_diff
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!browser)
|
||||||
|
return;
|
||||||
|
// Verify param: requesting_url; type: string_byref_const
|
||||||
|
DCHECK(requesting_url);
|
||||||
|
if (!requesting_url)
|
||||||
|
return;
|
||||||
|
// Verify param: callback; type: refptr_diff
|
||||||
|
DCHECK(callback);
|
||||||
|
if (!callback)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefGeolocationHandlerCppToC::Get(self)->OnRequestGeolocationPermission(
|
||||||
|
CefBrowserCToCpp::Wrap(browser),
|
||||||
|
CefString(requesting_url),
|
||||||
|
request_id,
|
||||||
|
CefGeolocationCallbackCToCpp::Wrap(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK geolocation_handler_on_cancel_geolocation_permission(
|
||||||
|
struct _cef_geolocation_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_string_t* requesting_url, int request_id) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
|
// Verify param: browser; type: refptr_diff
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!browser)
|
||||||
|
return;
|
||||||
|
// Verify param: requesting_url; type: string_byref_const
|
||||||
|
DCHECK(requesting_url);
|
||||||
|
if (!requesting_url)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefGeolocationHandlerCppToC::Get(self)->OnCancelGeolocationPermission(
|
||||||
|
CefBrowserCToCpp::Wrap(browser),
|
||||||
|
CefString(requesting_url),
|
||||||
|
request_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefGeolocationHandlerCppToC::CefGeolocationHandlerCppToC(
|
||||||
|
CefGeolocationHandler* cls)
|
||||||
|
: CefCppToC<CefGeolocationHandlerCppToC, CefGeolocationHandler,
|
||||||
|
cef_geolocation_handler_t>(cls) {
|
||||||
|
struct_.struct_.on_request_geolocation_permission =
|
||||||
|
geolocation_handler_on_request_geolocation_permission;
|
||||||
|
struct_.struct_.on_cancel_geolocation_permission =
|
||||||
|
geolocation_handler_on_cancel_geolocation_permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefGeolocationHandlerCppToC, CefGeolocationHandler,
|
||||||
|
cef_geolocation_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
37
cef1/libcef_dll/cpptoc/geolocation_handler_cpptoc.h
Normal file
37
cef1/libcef_dll/cpptoc/geolocation_handler_cpptoc.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_HANDLER_CPPTOC_H_
|
||||||
|
#define CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_HANDLER_CPPTOC_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef_geolocation_handler.h"
|
||||||
|
#include "include/capi/cef_geolocation_handler_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefGeolocationHandlerCppToC
|
||||||
|
: public CefCppToC<CefGeolocationHandlerCppToC, CefGeolocationHandler,
|
||||||
|
cef_geolocation_handler_t> {
|
||||||
|
public:
|
||||||
|
explicit CefGeolocationHandlerCppToC(CefGeolocationHandler* cls);
|
||||||
|
virtual ~CefGeolocationHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_HANDLER_CPPTOC_H_
|
||||||
|
|
@ -15,6 +15,7 @@
|
|||||||
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/find_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/find_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/focus_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/focus_handler_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
|
||||||
@ -211,6 +212,20 @@ CefRefPtr<CefDragHandler> CefClientCToCpp::GetDragHandler() {
|
|||||||
return CefDragHandlerCToCpp::Wrap(_retval);
|
return CefDragHandlerCToCpp::Wrap(_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CefRefPtr<CefGeolocationHandler> CefClientCToCpp::GetGeolocationHandler() {
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, get_geolocation_handler))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
cef_geolocation_handler_t* _retval = struct_->get_geolocation_handler(
|
||||||
|
struct_);
|
||||||
|
|
||||||
|
// Return type: refptr_same
|
||||||
|
return CefGeolocationHandlerCToCpp::Wrap(_retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCToCpp<CefClientCToCpp, CefClient,
|
template<> long CefCToCpp<CefClientCToCpp, CefClient,
|
||||||
|
@ -46,6 +46,7 @@ class CefClientCToCpp
|
|||||||
virtual CefRefPtr<CefV8ContextHandler> GetV8ContextHandler() OVERRIDE;
|
virtual CefRefPtr<CefV8ContextHandler> GetV8ContextHandler() OVERRIDE;
|
||||||
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE;
|
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE;
|
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE;
|
||||||
|
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BUILDING_CEF_SHARED
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
34
cef1/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc
Normal file
34
cef1/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// VIRTUAL METHODS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CefGeolocationCallbackCToCpp::Continue(bool allow) {
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, cont))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
struct_->cont(struct_,
|
||||||
|
allow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCToCpp<CefGeolocationCallbackCToCpp, CefGeolocationCallback,
|
||||||
|
cef_geolocation_callback_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
42
cef1/libcef_dll/ctocpp/geolocation_callback_ctocpp.h
Normal file
42
cef1/libcef_dll/ctocpp/geolocation_callback_ctocpp.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_
|
||||||
|
#define CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef_geolocation_handler.h"
|
||||||
|
#include "include/capi/cef_geolocation_handler_capi.h"
|
||||||
|
#include "libcef_dll/ctocpp/ctocpp.h"
|
||||||
|
|
||||||
|
// Wrap a C structure with a C++ class.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefGeolocationCallbackCToCpp
|
||||||
|
: public CefCToCpp<CefGeolocationCallbackCToCpp, CefGeolocationCallback,
|
||||||
|
cef_geolocation_callback_t> {
|
||||||
|
public:
|
||||||
|
explicit CefGeolocationCallbackCToCpp(cef_geolocation_callback_t* str)
|
||||||
|
: CefCToCpp<CefGeolocationCallbackCToCpp, CefGeolocationCallback,
|
||||||
|
cef_geolocation_callback_t>(str) {}
|
||||||
|
virtual ~CefGeolocationCallbackCToCpp() {}
|
||||||
|
|
||||||
|
// CefGeolocationCallback methods
|
||||||
|
virtual void Continue(bool allow) OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_
|
||||||
|
|
78
cef1/libcef_dll/ctocpp/geolocation_handler_ctocpp.cc
Normal file
78
cef1/libcef_dll/ctocpp/geolocation_handler_ctocpp.cc
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// VIRTUAL METHODS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CefGeolocationHandlerCToCpp::OnRequestGeolocationPermission(
|
||||||
|
CefRefPtr<CefBrowser> browser, const CefString& requesting_url,
|
||||||
|
int request_id, CefRefPtr<CefGeolocationCallback> callback) {
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, on_request_geolocation_permission))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: browser; type: refptr_diff
|
||||||
|
DCHECK(browser.get());
|
||||||
|
if (!browser.get())
|
||||||
|
return;
|
||||||
|
// Verify param: requesting_url; type: string_byref_const
|
||||||
|
DCHECK(!requesting_url.empty());
|
||||||
|
if (requesting_url.empty())
|
||||||
|
return;
|
||||||
|
// Verify param: callback; type: refptr_diff
|
||||||
|
DCHECK(callback.get());
|
||||||
|
if (!callback.get())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
struct_->on_request_geolocation_permission(struct_,
|
||||||
|
CefBrowserCppToC::Wrap(browser),
|
||||||
|
requesting_url.GetStruct(),
|
||||||
|
request_id,
|
||||||
|
CefGeolocationCallbackCppToC::Wrap(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefGeolocationHandlerCToCpp::OnCancelGeolocationPermission(
|
||||||
|
CefRefPtr<CefBrowser> browser, const CefString& requesting_url,
|
||||||
|
int request_id) {
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, on_cancel_geolocation_permission))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Verify param: browser; type: refptr_diff
|
||||||
|
DCHECK(browser.get());
|
||||||
|
if (!browser.get())
|
||||||
|
return;
|
||||||
|
// Verify param: requesting_url; type: string_byref_const
|
||||||
|
DCHECK(!requesting_url.empty());
|
||||||
|
if (requesting_url.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
struct_->on_cancel_geolocation_permission(struct_,
|
||||||
|
CefBrowserCppToC::Wrap(browser),
|
||||||
|
requesting_url.GetStruct(),
|
||||||
|
request_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCToCpp<CefGeolocationHandlerCToCpp, CefGeolocationHandler,
|
||||||
|
cef_geolocation_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
46
cef1/libcef_dll/ctocpp/geolocation_handler_ctocpp.h
Normal file
46
cef1/libcef_dll/ctocpp/geolocation_handler_ctocpp.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool. If making changes by
|
||||||
|
// hand only do so within the body of existing method and function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_
|
||||||
|
#define CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef BUILDING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||||
|
#else // BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef_geolocation_handler.h"
|
||||||
|
#include "include/capi/cef_geolocation_handler_capi.h"
|
||||||
|
#include "libcef_dll/ctocpp/ctocpp.h"
|
||||||
|
|
||||||
|
// Wrap a C structure with a C++ class.
|
||||||
|
// This class may be instantiated and accessed DLL-side only.
|
||||||
|
class CefGeolocationHandlerCToCpp
|
||||||
|
: public CefCToCpp<CefGeolocationHandlerCToCpp, CefGeolocationHandler,
|
||||||
|
cef_geolocation_handler_t> {
|
||||||
|
public:
|
||||||
|
explicit CefGeolocationHandlerCToCpp(cef_geolocation_handler_t* str)
|
||||||
|
: CefCToCpp<CefGeolocationHandlerCToCpp, CefGeolocationHandler,
|
||||||
|
cef_geolocation_handler_t>(str) {}
|
||||||
|
virtual ~CefGeolocationHandlerCToCpp() {}
|
||||||
|
|
||||||
|
// CefGeolocationHandler methods
|
||||||
|
virtual void OnRequestGeolocationPermission(CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& requesting_url, int request_id,
|
||||||
|
CefRefPtr<CefGeolocationCallback> callback) OVERRIDE;
|
||||||
|
virtual void OnCancelGeolocationPermission(CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& requesting_url, int request_id) OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
#endif // CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_
|
||||||
|
|
@ -31,6 +31,7 @@
|
|||||||
#include "libcef_dll/cpptoc/domnode_cpptoc.h"
|
#include "libcef_dll/cpptoc/domnode_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
|
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/post_data_cpptoc.h"
|
#include "libcef_dll/cpptoc/post_data_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/post_data_element_cpptoc.h"
|
#include "libcef_dll/cpptoc/post_data_element_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
||||||
@ -57,6 +58,7 @@
|
|||||||
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/find_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/find_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/focus_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/focus_handler_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
|
||||||
@ -129,6 +131,8 @@ CEF_EXPORT void cef_shutdown() {
|
|||||||
DCHECK_EQ(CefFindHandlerCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefFindHandlerCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefFocusHandlerCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefFocusHandlerCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefFrameCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefFrameCppToC::DebugObjCt, 0);
|
||||||
|
DCHECK_EQ(CefGeolocationCallbackCppToC::DebugObjCt, 0);
|
||||||
|
DCHECK_EQ(CefGeolocationHandlerCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefJSDialogHandlerCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefJSDialogHandlerCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefKeyboardHandlerCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefKeyboardHandlerCToCpp::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefLifeSpanHandlerCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefLifeSpanHandlerCToCpp::DebugObjCt, 0);
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/find_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/find_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
|
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
|
||||||
@ -62,6 +63,7 @@
|
|||||||
#include "libcef_dll/ctocpp/domnode_ctocpp.h"
|
#include "libcef_dll/ctocpp/domnode_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
|
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/post_data_ctocpp.h"
|
#include "libcef_dll/ctocpp/post_data_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/post_data_element_ctocpp.h"
|
#include "libcef_dll/ctocpp/post_data_element_ctocpp.h"
|
||||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||||
@ -131,6 +133,8 @@ CEF_GLOBAL void CefShutdown() {
|
|||||||
DCHECK_EQ(CefFindHandlerCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefFindHandlerCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefFocusHandlerCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefFocusHandlerCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefFrameCToCpp::DebugObjCt, 0);
|
DCHECK_EQ(CefFrameCToCpp::DebugObjCt, 0);
|
||||||
|
DCHECK_EQ(CefGeolocationCallbackCToCpp::DebugObjCt, 0);
|
||||||
|
DCHECK_EQ(CefGeolocationHandlerCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefJSDialogHandlerCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefJSDialogHandlerCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefKeyboardHandlerCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefKeyboardHandlerCppToC::DebugObjCt, 0);
|
||||||
DCHECK_EQ(CefLifeSpanHandlerCppToC::DebugObjCt, 0);
|
DCHECK_EQ(CefLifeSpanHandlerCppToC::DebugObjCt, 0);
|
||||||
|
@ -654,3 +654,7 @@ void RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
NewCefRunnableFunction(&UIT_RunPluginInfoTest, browser));
|
NewCefRunnableFunction(&UIT_RunPluginInfoTest, browser));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunGeolocationTest(CefRefPtr<CefBrowser> browser) {
|
||||||
|
browser->GetMainFrame()->LoadURL("http://html5demos.com/geo");
|
||||||
|
}
|
||||||
|
@ -52,6 +52,7 @@ void RunDOMAccessTest(CefRefPtr<CefBrowser> browser);
|
|||||||
void RunDragDropTest(CefRefPtr<CefBrowser> browser);
|
void RunDragDropTest(CefRefPtr<CefBrowser> browser);
|
||||||
void RunModalDialogTest(CefRefPtr<CefBrowser> browser);
|
void RunModalDialogTest(CefRefPtr<CefBrowser> browser);
|
||||||
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser);
|
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser);
|
||||||
|
void RunGeolocationTest(CefRefPtr<CefBrowser> browser);
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
void RunTransparentPopupTest(CefRefPtr<CefBrowser> browser);
|
void RunTransparentPopupTest(CefRefPtr<CefBrowser> browser);
|
||||||
|
@ -96,6 +96,7 @@ BEGIN
|
|||||||
MENUITEM "WebGL", ID_TESTS_WEBGL
|
MENUITEM "WebGL", ID_TESTS_WEBGL
|
||||||
MENUITEM "HTML5 Video", ID_TESTS_HTML5VIDEO
|
MENUITEM "HTML5 Video", ID_TESTS_HTML5VIDEO
|
||||||
MENUITEM "Drag && Drop", ID_TESTS_DRAGDROP
|
MENUITEM "Drag && Drop", ID_TESTS_DRAGDROP
|
||||||
|
MENUITEM "Geolocation", ID_TESTS_GEOLOCATION
|
||||||
MENUITEM "Zoom In", ID_TESTS_ZOOM_IN
|
MENUITEM "Zoom In", ID_TESTS_ZOOM_IN
|
||||||
MENUITEM "Zoom Out", ID_TESTS_ZOOM_OUT
|
MENUITEM "Zoom Out", ID_TESTS_ZOOM_OUT
|
||||||
MENUITEM "Reset Zoom", ID_TESTS_ZOOM_RESET
|
MENUITEM "Reset Zoom", ID_TESTS_ZOOM_RESET
|
||||||
|
@ -197,6 +197,15 @@ gboolean DragDropActivated(GtkWidget* widget) {
|
|||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean GeolocationActivated(GtkWidget* widget) {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
||||||
|
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||||
|
RunGeolocationTest(browser);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE; // Don't stop this message.
|
||||||
|
}
|
||||||
|
|
||||||
gboolean ShowDevtoolsActivated(GtkWidget* widget) {
|
gboolean ShowDevtoolsActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
||||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||||
@ -305,8 +314,10 @@ GtkWidget* CreateMenuBar() {
|
|||||||
G_CALLBACK(ZoomOutActivated));
|
G_CALLBACK(ZoomOutActivated));
|
||||||
AddMenuEntry(debug_menu, "Zoom Reset",
|
AddMenuEntry(debug_menu, "Zoom Reset",
|
||||||
G_CALLBACK(ZoomResetActivated));
|
G_CALLBACK(ZoomResetActivated));
|
||||||
AddMenuEntry(debug_menu, "Test DragDrop",
|
AddMenuEntry(debug_menu, "Drag & Drop",
|
||||||
G_CALLBACK(DragDropActivated));
|
G_CALLBACK(DragDropActivated));
|
||||||
|
AddMenuEntry(debug_menu, "Geolocation",
|
||||||
|
G_CALLBACK(GeolocationActivated));
|
||||||
AddMenuEntry(debug_menu, "Show DevTools",
|
AddMenuEntry(debug_menu, "Show DevTools",
|
||||||
G_CALLBACK(ShowDevtoolsActivated));
|
G_CALLBACK(ShowDevtoolsActivated));
|
||||||
AddMenuEntry(debug_menu, "Plugin Info",
|
AddMenuEntry(debug_menu, "Plugin Info",
|
||||||
|
@ -207,6 +207,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
- (IBAction)testWebGL:(id)sender;
|
- (IBAction)testWebGL:(id)sender;
|
||||||
- (IBAction)testHTML5Video:(id)sender;
|
- (IBAction)testHTML5Video:(id)sender;
|
||||||
- (IBAction)testDragDrop:(id)sender;
|
- (IBAction)testDragDrop:(id)sender;
|
||||||
|
- (IBAction)testGeolocation:(id)sender;
|
||||||
- (IBAction)testZoomIn:(id)sender;
|
- (IBAction)testZoomIn:(id)sender;
|
||||||
- (IBAction)testZoomOut:(id)sender;
|
- (IBAction)testZoomOut:(id)sender;
|
||||||
- (IBAction)testZoomReset:(id)sender;
|
- (IBAction)testZoomReset:(id)sender;
|
||||||
@ -290,6 +291,9 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
[testMenu addItemWithTitle:@"Drag & Drop"
|
[testMenu addItemWithTitle:@"Drag & Drop"
|
||||||
action:@selector(testDragDrop:)
|
action:@selector(testDragDrop:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
|
[testMenu addItemWithTitle:@"Geolocation"
|
||||||
|
action:@selector(testGeolocation:)
|
||||||
|
keyEquivalent:@""];
|
||||||
[testMenu addItemWithTitle:@"Zoom In"
|
[testMenu addItemWithTitle:@"Zoom In"
|
||||||
action:@selector(testZoomIn:)
|
action:@selector(testZoomIn:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
@ -500,6 +504,11 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
RunDragDropTest(g_handler->GetBrowser());
|
RunDragDropTest(g_handler->GetBrowser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction)testGeolocation:(id)sender {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
RunGeolocationTest(g_handler->GetBrowser());
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction)testZoomIn:(id)sender {
|
- (IBAction)testZoomIn:(id)sender {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
||||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||||
|
@ -524,6 +524,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunDragDropTest(browser);
|
RunDragDropTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
|
case ID_TESTS_GEOLOCATION: // Test geolocation
|
||||||
|
if (browser.get())
|
||||||
|
RunGeolocationTest(browser);
|
||||||
|
return 0;
|
||||||
case ID_TESTS_XMLHTTPREQUEST: // Test XMLHttpRequest
|
case ID_TESTS_XMLHTTPREQUEST: // Test XMLHttpRequest
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunXMLHTTPRequestTest(browser);
|
RunXMLHTTPRequestTest(browser);
|
||||||
|
@ -302,6 +302,15 @@ bool ClientHandler::OnBeforeScriptExtensionLoad(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientHandler::OnRequestGeolocationPermission(
|
||||||
|
CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& requesting_url,
|
||||||
|
int request_id,
|
||||||
|
CefRefPtr<CefGeolocationCallback> callback) {
|
||||||
|
// Allow geolocation access from all websites.
|
||||||
|
callback->Continue(true);
|
||||||
|
}
|
||||||
|
|
||||||
void ClientHandler::NotifyDownloadComplete(const CefString& fileName) {
|
void ClientHandler::NotifyDownloadComplete(const CefString& fileName) {
|
||||||
SetLastDownloadFile(fileName);
|
SetLastDownloadFile(fileName);
|
||||||
SendNotification(NOTIFY_DOWNLOAD_COMPLETE);
|
SendNotification(NOTIFY_DOWNLOAD_COMPLETE);
|
||||||
|
@ -30,6 +30,7 @@ class ClientHandler : public CefClient,
|
|||||||
public CefV8ContextHandler,
|
public CefV8ContextHandler,
|
||||||
public CefDragHandler,
|
public CefDragHandler,
|
||||||
public CefPermissionHandler,
|
public CefPermissionHandler,
|
||||||
|
public CefGeolocationHandler,
|
||||||
public DownloadListener {
|
public DownloadListener {
|
||||||
public:
|
public:
|
||||||
ClientHandler();
|
ClientHandler();
|
||||||
@ -66,6 +67,9 @@ class ClientHandler : public CefClient,
|
|||||||
virtual CefRefPtr<CefPermissionHandler> GetPermissionHandler() OVERRIDE {
|
virtual CefRefPtr<CefPermissionHandler> GetPermissionHandler() OVERRIDE {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
// CefLifeSpanHandler methods
|
// CefLifeSpanHandler methods
|
||||||
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
|
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
|
||||||
@ -164,6 +168,13 @@ class ClientHandler : public CefClient,
|
|||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& extensionName) OVERRIDE;
|
const CefString& extensionName) OVERRIDE;
|
||||||
|
|
||||||
|
// CefGeolocationHandler methods.
|
||||||
|
virtual void OnRequestGeolocationPermission(
|
||||||
|
CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& requesting_url,
|
||||||
|
int request_id,
|
||||||
|
CefRefPtr<CefGeolocationCallback> callback) OVERRIDE;
|
||||||
|
|
||||||
// DownloadListener methods
|
// DownloadListener methods
|
||||||
virtual void NotifyDownloadComplete(const CefString& fileName) OVERRIDE;
|
virtual void NotifyDownloadComplete(const CefString& fileName) OVERRIDE;
|
||||||
virtual void NotifyDownloadError(const CefString& fileName) OVERRIDE;
|
virtual void NotifyDownloadError(const CefString& fileName) OVERRIDE;
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
#define ID_TESTS_JAVASCRIPT_INVOKE 32798
|
#define ID_TESTS_JAVASCRIPT_INVOKE 32798
|
||||||
#define ID_TESTS_GETIMAGE 32799
|
#define ID_TESTS_GETIMAGE 32799
|
||||||
#define ID_TESTS_PLUGIN_INFO 32800
|
#define ID_TESTS_PLUGIN_INFO 32800
|
||||||
|
#define ID_TESTS_GEOLOCATION 32801
|
||||||
#define IDC_STATIC -1
|
#define IDC_STATIC -1
|
||||||
#define IDS_LOGO 1000
|
#define IDS_LOGO 1000
|
||||||
#define IDS_UIPLUGIN 1001
|
#define IDS_UIPLUGIN 1001
|
||||||
|
Reference in New Issue
Block a user