From ac86b611391b606170351bae322be1dd18d5a38b Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 12 Feb 2018 18:51:11 -0500 Subject: [PATCH] Remove geolocation API support (issue #2380) --- BUILD.gn | 9 - cef_paths.gypi | 18 +- cef_paths2.gypi | 1 - include/capi/cef_client_capi.h | 10 +- include/capi/cef_geolocation_capi.h | 79 ---- include/capi/cef_geolocation_handler_capi.h | 106 ------ include/cef_client.h | 10 - include/cef_geolocation.h | 66 ---- include/cef_geolocation_handler.h | 92 ----- include/internal/cef_types.h | 68 ---- include/internal/cef_types_wrappers.h | 31 -- libcef/browser/browser_context_impl.cc | 5 +- libcef/browser/browser_context_impl.h | 1 - libcef/browser/geolocation_impl.cc | 107 ------ .../browser/permissions/permission_context.cc | 250 ------------ .../browser/permissions/permission_context.h | 96 ----- .../browser/permissions/permission_manager.cc | 356 ------------------ .../browser/permissions/permission_manager.h | 100 ----- libcef/browser/permissions/permission_util.cc | 59 --- libcef/browser/permissions/permission_util.h | 19 - libcef_dll/cpptoc/client_cpptoc.cc | 20 +- .../cpptoc/geolocation_callback_cpptoc.cc | 63 ---- .../cpptoc/geolocation_callback_cpptoc.h | 37 -- .../cpptoc/geolocation_handler_cpptoc.cc | 109 ------ .../cpptoc/geolocation_handler_cpptoc.h | 37 -- .../cpptoc/get_geolocation_callback_cpptoc.cc | 74 ---- .../cpptoc/get_geolocation_callback_cpptoc.h | 37 -- libcef_dll/ctocpp/client_ctocpp.cc | 18 +- libcef_dll/ctocpp/client_ctocpp.h | 3 +- .../ctocpp/geolocation_callback_ctocpp.cc | 56 --- .../ctocpp/geolocation_callback_ctocpp.h | 40 -- .../ctocpp/geolocation_handler_ctocpp.cc | 99 ----- .../ctocpp/geolocation_handler_ctocpp.h | 46 --- .../ctocpp/get_geolocation_callback_ctocpp.cc | 59 --- .../ctocpp/get_geolocation_callback_ctocpp.h | 40 -- libcef_dll/libcef_dll.cc | 28 +- libcef_dll/wrapper/libcef_dll_wrapper.cc | 28 +- libcef_dll/wrapper_types.h | 5 +- tests/cefclient/browser/client_handler.cc | 12 - tests/cefclient/browser/client_handler.h | 11 - tests/cefclient/resources/other_tests.html | 1 - tests/ceftests/geolocation_unittest.cc | 230 ----------- tests/ceftests/test_handler.h | 4 - 43 files changed, 9 insertions(+), 2531 deletions(-) delete mode 100644 include/capi/cef_geolocation_capi.h delete mode 100644 include/capi/cef_geolocation_handler_capi.h delete mode 100644 include/cef_geolocation.h delete mode 100644 include/cef_geolocation_handler.h delete mode 100644 libcef/browser/geolocation_impl.cc delete mode 100644 libcef/browser/permissions/permission_context.cc delete mode 100644 libcef/browser/permissions/permission_context.h delete mode 100644 libcef/browser/permissions/permission_manager.cc delete mode 100644 libcef/browser/permissions/permission_manager.h delete mode 100644 libcef/browser/permissions/permission_util.cc delete mode 100644 libcef/browser/permissions/permission_util.h delete mode 100644 libcef_dll/cpptoc/geolocation_callback_cpptoc.cc delete mode 100644 libcef_dll/cpptoc/geolocation_callback_cpptoc.h delete mode 100644 libcef_dll/cpptoc/geolocation_handler_cpptoc.cc delete mode 100644 libcef_dll/cpptoc/geolocation_handler_cpptoc.h delete mode 100644 libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc delete mode 100644 libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h delete mode 100644 libcef_dll/ctocpp/geolocation_callback_ctocpp.cc delete mode 100644 libcef_dll/ctocpp/geolocation_callback_ctocpp.h delete mode 100644 libcef_dll/ctocpp/geolocation_handler_ctocpp.cc delete mode 100644 libcef_dll/ctocpp/geolocation_handler_ctocpp.h delete mode 100644 libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc delete mode 100644 libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h delete mode 100644 tests/ceftests/geolocation_unittest.cc diff --git a/BUILD.gn b/BUILD.gn index d53061992..7574a48c2 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -373,7 +373,6 @@ static_library("libcef_static") { "libcef/browser/file_dialog_manager.h", "libcef/browser/frame_host_impl.cc", "libcef/browser/frame_host_impl.h", - "libcef/browser/geolocation_impl.cc", "libcef/browser/image_impl.cc", "libcef/browser/image_impl.h", "libcef/browser/javascript_dialog_runner.h", @@ -442,12 +441,6 @@ static_library("libcef_static") { "libcef/browser/osr/web_contents_view_osr.cc", "libcef/browser/osr/web_contents_view_osr.h", "libcef/browser/path_util_impl.cc", - "libcef/browser/permissions/permission_context.cc", - "libcef/browser/permissions/permission_context.h", - "libcef/browser/permissions/permission_manager.cc", - "libcef/browser/permissions/permission_manager.h", - "libcef/browser/permissions/permission_util.cc", - "libcef/browser/permissions/permission_util.h", "libcef/browser/plugins/plugin_service_filter.cc", "libcef/browser/plugins/plugin_service_filter.h", "libcef/browser/prefs/browser_prefs.cc", @@ -696,8 +689,6 @@ static_library("libcef_static") { "//content/public/utility", "//crypto", "//device/base", - "//device/geolocation", - "//device/geolocation/public/interfaces", "//extensions/browser", "//extensions/browser/api:api_registration", "//extensions/common/api", diff --git a/cef_paths.gypi b/cef_paths.gypi index 99899c989..710b8ca47 100644 --- a/cef_paths.gypi +++ b/cef_paths.gypi @@ -8,7 +8,7 @@ # by hand. See the translator.README.txt file in the tools directory for # more information. # -# $hash=5f69924ad7517dee8adf933a7c013616ebb94c36$ +# $hash=bede6f61d0f5b45669b8e924144e4200c41f869b$ # { @@ -38,8 +38,6 @@ 'include/cef_find_handler.h', 'include/cef_focus_handler.h', 'include/cef_frame.h', - 'include/cef_geolocation.h', - 'include/cef_geolocation_handler.h', 'include/cef_image.h', 'include/cef_jsdialog_handler.h', 'include/cef_keyboard_handler.h', @@ -131,8 +129,6 @@ 'include/capi/cef_find_handler_capi.h', 'include/capi/cef_focus_handler_capi.h', 'include/capi/cef_frame_capi.h', - 'include/capi/cef_geolocation_capi.h', - 'include/capi/cef_geolocation_handler_capi.h', 'include/capi/cef_image_capi.h', 'include/capi/cef_jsdialog_handler_capi.h', 'include/capi/cef_keyboard_handler_capi.h', @@ -286,14 +282,8 @@ 'libcef_dll/ctocpp/focus_handler_ctocpp.h', 'libcef_dll/cpptoc/frame_cpptoc.cc', '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/cpptoc/get_extension_resource_callback_cpptoc.cc', 'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h', - 'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc', - 'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h', 'libcef_dll/cpptoc/image_cpptoc.cc', 'libcef_dll/cpptoc/image_cpptoc.h', 'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc', @@ -572,14 +562,8 @@ 'libcef_dll/cpptoc/focus_handler_cpptoc.h', 'libcef_dll/ctocpp/frame_ctocpp.cc', '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/ctocpp/get_extension_resource_callback_ctocpp.cc', 'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h', - 'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc', - 'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h', 'libcef_dll/ctocpp/image_ctocpp.cc', 'libcef_dll/ctocpp/image_ctocpp.h', 'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc', diff --git a/cef_paths2.gypi b/cef_paths2.gypi index 2203acbd3..eb9b4d2b1 100644 --- a/cef_paths2.gypi +++ b/cef_paths2.gypi @@ -442,7 +442,6 @@ 'tests/ceftests/extensions/view_unittest.cc', 'tests/ceftests/file_util_unittest.cc', 'tests/ceftests/frame_unittest.cc', - 'tests/ceftests/geolocation_unittest.cc', 'tests/ceftests/image_unittest.cc', 'tests/ceftests/image_util.cc', 'tests/ceftests/image_util.h', diff --git a/include/capi/cef_client_capi.h b/include/capi/cef_client_capi.h index 1dba97ab2..5603646f6 100644 --- a/include/capi/cef_client_capi.h +++ b/include/capi/cef_client_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=2a93a2e7a17c81d39ad1b8c1c1aa93d5d90b1100$ +// $hash=1dbb0adf7ac5fd42b5a79d271834781664a7fd47$ // #ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ @@ -48,7 +48,6 @@ #include "include/capi/cef_drag_handler_capi.h" #include "include/capi/cef_find_handler_capi.h" #include "include/capi/cef_focus_handler_capi.h" -#include "include/capi/cef_geolocation_handler_capi.h" #include "include/capi/cef_jsdialog_handler_capi.h" #include "include/capi/cef_keyboard_handler_capi.h" #include "include/capi/cef_life_span_handler_capi.h" @@ -115,13 +114,6 @@ typedef struct _cef_client_t { struct _cef_focus_handler_t*(CEF_CALLBACK* get_focus_handler)( 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); - /// // Return the handler for JavaScript dialogs. If no handler is provided the // default implementation will be used. diff --git a/include/capi/cef_geolocation_capi.h b/include/capi/cef_geolocation_capi.h deleted file mode 100644 index 76bf4cb44..000000000 --- a/include/capi/cef_geolocation_capi.h +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=2af1552c0d2dada94c325be8249bfd889b22ca58$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_GEOLOCATION_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_GEOLOCATION_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Implement this structure to receive geolocation updates. The functions of -// this structure will be called on the browser process UI thread. -/// -typedef struct _cef_get_geolocation_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called with the 'best available' location information or, if the location - // update failed, with error information. - /// - void(CEF_CALLBACK* on_location_update)( - struct _cef_get_geolocation_callback_t* self, - const struct _cef_geoposition_t* position); -} cef_get_geolocation_callback_t; - -/// -// Request a one-time geolocation update. This function bypasses any user -// permission checks so should only be used by code that is allowed to access -// location information. -/// -CEF_EXPORT int cef_get_geolocation(cef_get_geolocation_callback_t* callback); - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_GEOLOCATION_CAPI_H_ diff --git a/include/capi/cef_geolocation_handler_capi.h b/include/capi/cef_geolocation_handler_capi.h deleted file mode 100644 index 86fee9931..000000000 --- a/include/capi/cef_geolocation_handler_capi.h +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=33573a1b0f1caa917899c087b9febe83c2cfd41f$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_browser_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Callback structure used for asynchronous continuation of geolocation -// permission requests. -/// -typedef struct _cef_geolocation_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_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 UI thread. -/// -typedef struct _cef_geolocation_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_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. Return true (1) and call - // cef_geolocation_callback_t::cont() either in this function or at a later - // time to continue or cancel the request. Return false (0) to cancel the - // request immediately. - /// - int(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. |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, - int request_id); -} cef_geolocation_handler_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_ diff --git a/include/cef_client.h b/include/cef_client.h index a365491c5..59173c778 100644 --- a/include/cef_client.h +++ b/include/cef_client.h @@ -46,7 +46,6 @@ #include "include/cef_drag_handler.h" #include "include/cef_find_handler.h" #include "include/cef_focus_handler.h" -#include "include/cef_geolocation_handler.h" #include "include/cef_jsdialog_handler.h" #include "include/cef_keyboard_handler.h" #include "include/cef_life_span_handler.h" @@ -108,15 +107,6 @@ class CefClient : public virtual CefBaseRefCounted { /*--cef()--*/ virtual CefRefPtr GetFocusHandler() { return NULL; } - /// - // Return the handler for geolocation permissions requests. If no handler is - // provided geolocation access will be denied by default. - /// - /*--cef()--*/ - virtual CefRefPtr GetGeolocationHandler() { - return NULL; - } - /// // Return the handler for JavaScript dialogs. If no handler is provided the // default implementation will be used. diff --git a/include/cef_geolocation.h b/include/cef_geolocation.h deleted file mode 100644 index 5ad7777eb..000000000 --- a/include/cef_geolocation.h +++ /dev/null @@ -1,66 +0,0 @@ -// 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_H_ -#define CEF_INCLUDE_CEF_GEOLOCATION_H_ -#pragma once - -#include "include/cef_base.h" - -/// -// Implement this interface to receive geolocation updates. The methods of this -// class will be called on the browser process UI thread. -/// -/*--cef(source=client)--*/ -class CefGetGeolocationCallback : public virtual CefBaseRefCounted { - public: - /// - // Called with the 'best available' location information or, if the location - // update failed, with error information. - /// - /*--cef()--*/ - virtual void OnLocationUpdate(const CefGeoposition& position) = 0; -}; - -/// -// Request a one-time geolocation update. This function bypasses any user -// permission checks so should only be used by code that is allowed to access -// location information. -/// -/*--cef()--*/ -bool CefGetGeolocation(CefRefPtr callback); - -#endif // CEF_INCLUDE_CEF_GEOLOCATION_H_ diff --git a/include/cef_geolocation_handler.h b/include/cef_geolocation_handler.h deleted file mode 100644 index d43c9c891..000000000 --- a/include/cef_geolocation_handler.h +++ /dev/null @@ -1,92 +0,0 @@ -// 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 CefBaseRefCounted { - 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 UI -// thread. -/// -/*--cef(source=client)--*/ -class CefGeolocationHandler : public virtual CefBaseRefCounted { - 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. Return true and call - // CefGeolocationCallback::Continue() either in this method or at a later - // time to continue or cancel the request. Return false to cancel the request - // immediately. - /// - /*--cef()--*/ - virtual bool OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) { - return false; - } - - /// - // Called when a geolocation access request is canceled. |request_id| is the - // unique ID for the permission request. - /// - /*--cef()--*/ - virtual void OnCancelGeolocationPermission(CefRefPtr browser, - int request_id) {} -}; - -#endif // CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_ diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index 54df8f540..ebee15c18 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -2046,74 +2046,6 @@ typedef enum { FILE_DIALOG_HIDEREADONLY_FLAG = 0x02000000, } cef_file_dialog_mode_t; -/// -// Geoposition error codes. -/// -typedef enum { - GEOPOSITON_ERROR_NONE = 0, - GEOPOSITON_ERROR_PERMISSION_DENIED, - GEOPOSITON_ERROR_POSITION_UNAVAILABLE, - GEOPOSITON_ERROR_TIMEOUT, -} cef_geoposition_error_code_t; - -/// -// Structure representing geoposition information. The properties of this -// structure correspond to those of the JavaScript Position object although -// their types may differ. -/// -typedef struct _cef_geoposition_t { - /// - // Latitude in decimal degrees north (WGS84 coordinate frame). - /// - double latitude; - - /// - // Longitude in decimal degrees west (WGS84 coordinate frame). - /// - double longitude; - - /// - // Altitude in meters (above WGS84 datum). - /// - double altitude; - - /// - // Accuracy of horizontal position in meters. - /// - double accuracy; - - /// - // Accuracy of altitude in meters. - /// - double altitude_accuracy; - - /// - // Heading in decimal degrees clockwise from true north. - /// - double heading; - - /// - // Horizontal component of device velocity in meters per second. - /// - double speed; - - /// - // Time of position measurement in milliseconds since Epoch in UTC time. This - // is taken from the host computer's system clock. - /// - cef_time_t timestamp; - - /// - // Error code, see enum above. - /// - cef_geoposition_error_code_t error_code; - - /// - // Human-readable error message. - /// - cef_string_t error_message; -} cef_geoposition_t; - /// // Print job color mode values. /// diff --git a/include/internal/cef_types_wrappers.h b/include/internal/cef_types_wrappers.h index 091c8e980..147926e90 100644 --- a/include/internal/cef_types_wrappers.h +++ b/include/internal/cef_types_wrappers.h @@ -832,37 +832,6 @@ struct CefCookieTraits { /// typedef CefStructBase CefCookie; -struct CefGeopositionTraits { - typedef cef_geoposition_t struct_type; - - static inline void init(struct_type* s) {} - - static inline void clear(struct_type* s) { - cef_string_clear(&s->error_message); - } - - static inline void set(const struct_type* src, - struct_type* target, - bool copy) { - target->latitude = src->latitude; - target->longitude = src->longitude; - target->altitude = src->altitude; - target->accuracy = src->accuracy; - target->altitude_accuracy = src->altitude_accuracy; - target->heading = src->heading; - target->speed = src->speed; - target->timestamp = src->timestamp; - target->error_code = src->error_code; - cef_string_set(src->error_message.str, src->error_message.length, - &target->error_message, copy); - } -}; - -/// -// Class representing a geoposition. -/// -typedef CefStructBase CefGeoposition; - struct CefCursorInfoTraits { typedef cef_cursor_info_t struct_type; diff --git a/libcef/browser/browser_context_impl.cc b/libcef/browser/browser_context_impl.cc index d3cad7e6b..38985b4c3 100644 --- a/libcef/browser/browser_context_impl.cc +++ b/libcef/browser/browser_context_impl.cc @@ -12,7 +12,6 @@ #include "libcef/browser/context.h" #include "libcef/browser/download_manager_delegate.h" #include "libcef/browser/extensions/extension_system.h" -#include "libcef/browser/permissions/permission_manager.h" #include "libcef/browser/prefs/browser_prefs.h" #include "libcef/browser/request_context_impl.h" #include "libcef/browser/ssl_host_state_delegate.h" @@ -420,9 +419,7 @@ CefBrowserContextImpl::GetSSLHostStateDelegate() { } content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() { - if (!permission_manager_.get()) - permission_manager_.reset(new CefPermissionManager(this)); - return permission_manager_.get(); + return nullptr; } content::BackgroundFetchDelegate* diff --git a/libcef/browser/browser_context_impl.h b/libcef/browser/browser_context_impl.h index c0e5b77fd..bd8558a9b 100644 --- a/libcef/browser/browser_context_impl.h +++ b/libcef/browser/browser_context_impl.h @@ -121,7 +121,6 @@ class CefBrowserContextImpl : public CefBrowserContext, std::unique_ptr download_manager_delegate_; scoped_refptr url_request_getter_; - std::unique_ptr permission_manager_; std::unique_ptr ssl_host_state_delegate_; scoped_refptr host_content_settings_map_; std::unique_ptr visitedlink_master_; diff --git a/libcef/browser/geolocation_impl.cc b/libcef/browser/geolocation_impl.cc deleted file mode 100644 index ec6ff5b85..000000000 --- a/libcef/browser/geolocation_impl.cc +++ /dev/null @@ -1,107 +0,0 @@ -// 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. - -#include "include/cef_geolocation.h" -#include "libcef/browser/context.h" -#include "libcef/browser/thread_util.h" -#include "libcef/common/time_util.h" - -#include "base/logging.h" -#include "device/geolocation/geolocation_provider.h" -#include "device/geolocation/public/interfaces/geoposition.mojom.h" - -namespace { - -class CefLocationRequest - : public base::RefCountedThreadSafe { - public: - explicit CefLocationRequest(CefRefPtr callback) - : callback_(callback) { - CEF_REQUIRE_UIT(); - geo_callback_ = base::Bind(&CefLocationRequest::OnLocationUpdate, this); - device::GeolocationProvider* provider = - device::GeolocationProvider::GetInstance(); - subscription_ = provider->AddLocationUpdateCallback(geo_callback_, true); - provider->UserDidOptIntoLocationServices(); - } - - private: - friend class base::RefCountedThreadSafe; - - ~CefLocationRequest() {} - - void OnLocationUpdate(const device::mojom::Geoposition& position) { - CEF_REQUIRE_UIT(); - if (callback_.get()) { - CefGeoposition cef_position; - SetPosition(position, cef_position); - callback_->OnLocationUpdate(cef_position); - callback_ = NULL; - } - subscription_.reset(); - geo_callback_.Reset(); - } - - void SetPosition(const device::mojom::Geoposition& source, - CefGeoposition& target) { - target.latitude = source.latitude; - target.longitude = source.longitude; - target.altitude = source.altitude; - target.accuracy = source.accuracy; - target.altitude_accuracy = source.altitude_accuracy; - target.heading = source.heading; - target.speed = source.speed; - cef_time_from_basetime(source.timestamp, target.timestamp); - - switch (source.error_code) { - case device::mojom::Geoposition::ErrorCode::NONE: - target.error_code = GEOPOSITON_ERROR_NONE; - break; - case device::mojom::Geoposition::ErrorCode::PERMISSION_DENIED: - target.error_code = GEOPOSITON_ERROR_PERMISSION_DENIED; - break; - case device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE: - target.error_code = GEOPOSITON_ERROR_POSITION_UNAVAILABLE; - break; - case device::mojom::Geoposition::ErrorCode::TIMEOUT: - target.error_code = GEOPOSITON_ERROR_TIMEOUT; - break; - } - - CefString(&target.error_message) = source.error_message; - } - - CefRefPtr callback_; - device::GeolocationProvider::LocationUpdateCallback geo_callback_; - std::unique_ptr subscription_; - - DISALLOW_COPY_AND_ASSIGN(CefLocationRequest); -}; - -} // namespace - -bool CefGetGeolocation(CefRefPtr callback) { - if (!CONTEXT_STATE_VALID()) { - NOTREACHED() << "context not valid"; - return false; - } - - if (!callback.get()) { - NOTREACHED() << "invalid parameter"; - return false; - } - - if (CEF_CURRENTLY_ON_UIT()) { - if (device::GeolocationProvider::GetInstance()) { - // Will be released after the callback executes. - new CefLocationRequest(callback); - return true; - } - return false; - } else { - CEF_POST_TASK(CEF_UIT, - base::Bind(base::IgnoreResult(CefGetGeolocation), callback)); - return true; - } -} diff --git a/libcef/browser/permissions/permission_context.cc b/libcef/browser/permissions/permission_context.cc deleted file mode 100644 index b36382fc8..000000000 --- a/libcef/browser/permissions/permission_context.cc +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2015 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. - -#include "libcef/browser/permissions/permission_context.h" - -#include "include/cef_client.h" -#include "include/cef_geolocation_handler.h" -#include "libcef/browser/browser_context.h" -#include "libcef/browser/browser_host_impl.h" -#include "libcef/browser/permissions/permission_util.h" -#include "libcef/browser/thread_util.h" - -#include "components/content_settings/core/browser/host_content_settings_map.h" -#include "content/public/browser/permission_type.h" -#include "content/public/browser/web_contents.h" -#include "content/public/common/origin_util.h" -#include "device/geolocation/geolocation_provider.h" - -namespace { - -// Whether the permission should be restricted to secure origins. -bool IsRestrictedToSecureOrigins(content::PermissionType permission) { - return false; -} - -class CefGeolocationCallbackImpl : public CefGeolocationCallback { - public: - typedef CefPermissionContext::PermissionDecidedCallback CallbackType; - - explicit CefGeolocationCallbackImpl(const CallbackType& callback) - : callback_(callback) {} - - void Continue(bool allow) override { - if (CEF_CURRENTLY_ON_UIT()) { - if (!callback_.is_null()) { - if (allow) { - device::GeolocationProvider::GetInstance() - ->UserDidOptIntoLocationServices(); - } - - callback_.Run(allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); - callback_.Reset(); - } - } else { - CEF_POST_TASK(CEF_UIT, base::Bind(&CefGeolocationCallbackImpl::Continue, - this, allow)); - } - } - - void Disconnect() { callback_.Reset(); } - - private: - CallbackType callback_; - - IMPLEMENT_REFCOUNTING(CefGeolocationCallbackImpl); - DISALLOW_COPY_AND_ASSIGN(CefGeolocationCallbackImpl); -}; - -} // namespace - -CefPermissionContext::CefPermissionContext(CefBrowserContext* profile) - : profile_(profile), weak_ptr_factory_(this) {} - -bool CefPermissionContext::SupportsPermission( - content::PermissionType permission) { - // Only Geolocation permissions are currently supported. - return permission == content::PermissionType::GEOLOCATION; -} - -void CefPermissionContext::RequestPermission( - content::PermissionType permission, - content::WebContents* web_contents, - const PermissionRequestID& id, - const GURL& requesting_frame, - const BrowserPermissionCallback& callback) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - DecidePermission(permission, web_contents, id, requesting_frame.GetOrigin(), - web_contents->GetLastCommittedURL().GetOrigin(), callback); -} - -void CefPermissionContext::CancelPermissionRequest( - content::PermissionType permission, - content::WebContents* web_contents, - const PermissionRequestID& id) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(permission == content::PermissionType::GEOLOCATION); - - CefRefPtr browser = - CefBrowserHostImpl::GetBrowserForContents(web_contents); - if (browser.get()) { - CefRefPtr client = browser->GetClient(); - if (client.get()) { - CefRefPtr handler = - client->GetGeolocationHandler(); - if (handler.get()) - handler->OnCancelGeolocationPermission(browser.get(), id.request_id()); - } - } -} - -void CefPermissionContext::ResetPermission(content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin) { - profile_->GetHostContentSettingsMap()->SetContentSettingCustomScope( - ContentSettingsPattern::FromURLNoWildcard(requesting_origin), - ContentSettingsPattern::FromURLNoWildcard(embedding_origin), - permission_util::PermissionTypeToContentSetting(permission), - std::string(), CONTENT_SETTING_DEFAULT); -} - -ContentSetting CefPermissionContext::GetPermissionStatus( - content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin) const { - if (IsRestrictedToSecureOrigins(permission) && - !content::IsOriginSecure(requesting_origin)) { - return CONTENT_SETTING_BLOCK; - } - - return profile_->GetHostContentSettingsMap()->GetContentSetting( - requesting_origin, embedding_origin, - permission_util::PermissionTypeToContentSetting(permission), - std::string()); -} - -void CefPermissionContext::DecidePermission( - content::PermissionType permission, - content::WebContents* web_contents, - const PermissionRequestID& id, - const GURL& requesting_origin, - const GURL& embedding_origin, - const BrowserPermissionCallback& callback) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - if (!requesting_origin.is_valid() || !embedding_origin.is_valid()) { - NotifyPermissionSet(permission, id, requesting_origin, embedding_origin, - callback, false /* persist */, CONTENT_SETTING_BLOCK); - return; - } - - if (IsRestrictedToSecureOrigins(permission) && - !content::IsOriginSecure(requesting_origin)) { - NotifyPermissionSet(permission, id, requesting_origin, embedding_origin, - callback, false /* persist */, CONTENT_SETTING_BLOCK); - return; - } - - ContentSetting content_setting = - profile_->GetHostContentSettingsMap()->GetContentSetting( - requesting_origin, embedding_origin, - permission_util::PermissionTypeToContentSetting(permission), - std::string()); - - if (content_setting == CONTENT_SETTING_ALLOW || - content_setting == CONTENT_SETTING_BLOCK) { - NotifyPermissionSet(permission, id, requesting_origin, embedding_origin, - callback, false /* persist */, content_setting); - return; - } - - QueryPermission(permission, id, requesting_origin, embedding_origin, - base::Bind(&CefPermissionContext::NotifyPermissionSet, - weak_ptr_factory_.GetWeakPtr(), permission, id, - requesting_origin, embedding_origin, callback, - false /* persist */)); -} - -void CefPermissionContext::QueryPermission( - content::PermissionType permission, - const PermissionRequestID& id, - const GURL& requesting_origin, - const GURL& embedding_origin, - const PermissionDecidedCallback& callback) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(permission == content::PermissionType::GEOLOCATION); - - bool proceed = false; - - CefRefPtr browser = - CefBrowserHostImpl::GetBrowserForFrame(id.render_process_id(), - id.render_frame_id()); - if (browser.get()) { - CefRefPtr client = browser->GetClient(); - if (client.get()) { - CefRefPtr handler = - client->GetGeolocationHandler(); - if (handler.get()) { - CefRefPtr callbackImpl( - new CefGeolocationCallbackImpl(callback)); - - // Notify the handler. - proceed = handler->OnRequestGeolocationPermission( - browser.get(), requesting_origin.spec(), id.request_id(), - callbackImpl.get()); - if (!proceed) - callbackImpl->Disconnect(); - } - } - } - - if (!proceed) { - // Disallow geolocation access by default. - callback.Run(CONTENT_SETTING_BLOCK); - } -} - -void CefPermissionContext::NotifyPermissionSet( - content::PermissionType permission, - const PermissionRequestID& id, - const GURL& requesting_origin, - const GURL& embedding_origin, - const BrowserPermissionCallback& callback, - bool persist, - ContentSetting content_setting) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - if (persist) { - UpdateContentSetting(permission, requesting_origin, embedding_origin, - content_setting); - } - - if (content_setting == CONTENT_SETTING_DEFAULT) { - content_setting = - profile_->GetHostContentSettingsMap()->GetDefaultContentSetting( - permission_util::PermissionTypeToContentSetting(permission), - nullptr); - } - - DCHECK_NE(content_setting, CONTENT_SETTING_DEFAULT); - callback.Run(content_setting); -} - -void CefPermissionContext::UpdateContentSetting( - content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin, - ContentSetting content_setting) { - DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); - DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); - DCHECK(content_setting == CONTENT_SETTING_ALLOW || - content_setting == CONTENT_SETTING_BLOCK); - - profile_->GetHostContentSettingsMap()->SetContentSettingCustomScope( - ContentSettingsPattern::FromURLNoWildcard(requesting_origin), - ContentSettingsPattern::FromURLNoWildcard(embedding_origin), - permission_util::PermissionTypeToContentSetting(permission), - std::string(), content_setting); -} diff --git a/libcef/browser/permissions/permission_context.h b/libcef/browser/permissions/permission_context.h deleted file mode 100644 index 1fba37406..000000000 --- a/libcef/browser/permissions/permission_context.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2015 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. - -#ifndef CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_H_ -#define CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_H_ - -#include "base/callback_forward.h" -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "chrome/browser/permissions/permission_request_id.h" -#include "components/content_settings/core/common/content_settings.h" - -class CefBrowserContext; - -namespace content { -enum class PermissionType; -class WebContents; -}; // namespace content - -// Based on chrome/browser/permissions/permission_context_base.h -class CefPermissionContext { - public: - explicit CefPermissionContext(CefBrowserContext* profile); - - using BrowserPermissionCallback = base::Callback; - using PermissionDecidedCallback = base::Callback; - - // Returns true if support exists for querying the embedder about the - // specified permission type. - bool SupportsPermission(content::PermissionType permission); - - // The renderer is requesting permission to push messages. - // When the answer to a permission request has been determined, |callback| - // should be called with the result. - void RequestPermission(content::PermissionType permission, - content::WebContents* web_contents, - const PermissionRequestID& id, - const GURL& requesting_frame, - const BrowserPermissionCallback& callback); - - // Withdraw an existing permission request, no op if the permission request - // was already cancelled by some other means. - void CancelPermissionRequest(content::PermissionType permission, - content::WebContents* web_contents, - const PermissionRequestID& id); - - // Resets the permission to its default value. - void ResetPermission(content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin); - - // Returns whether the permission has been granted, denied... - ContentSetting GetPermissionStatus(content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin) const; - - private: - // Decide whether the permission should be granted. - // Calls PermissionDecided if permission can be decided non-interactively, - // or NotifyPermissionSet if permission decided by presenting an infobar. - void DecidePermission(content::PermissionType permission, - content::WebContents* web_contents, - const PermissionRequestID& id, - const GURL& requesting_origin, - const GURL& embedding_origin, - const BrowserPermissionCallback& callback); - - void QueryPermission(content::PermissionType permission, - const PermissionRequestID& id, - const GURL& requesting_origin, - const GURL& embedding_origin, - const PermissionDecidedCallback& callback); - - void NotifyPermissionSet(content::PermissionType permission, - const PermissionRequestID& id, - const GURL& requesting_origin, - const GURL& embedding_origin, - const BrowserPermissionCallback& callback, - bool persist, - ContentSetting content_setting); - - // Store the decided permission as a content setting. - void UpdateContentSetting(content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin, - ContentSetting content_setting); - - CefBrowserContext* profile_; - - base::WeakPtrFactory weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(CefPermissionContext); -}; - -#endif // CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_H_ diff --git a/libcef/browser/permissions/permission_manager.cc b/libcef/browser/permissions/permission_manager.cc deleted file mode 100644 index 94c070fdf..000000000 --- a/libcef/browser/permissions/permission_manager.cc +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2015 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/browser/permissions/permission_manager.h" - -#include "libcef/browser/browser_context.h" -#include "libcef/browser/permissions/permission_util.h" - -#include "base/callback.h" -#include "components/content_settings/core/browser/host_content_settings_map.h" -#include "content/public/browser/permission_type.h" -#include "content/public/browser/render_frame_host.h" -#include "content/public/browser/render_process_host.h" -#include "content/public/browser/web_contents.h" - -using blink::mojom::PermissionStatus; -using content::PermissionType; - -namespace { - -// Helper method to convert ContentSetting to PermissionStatus. -PermissionStatus ContentSettingToPermissionStatus(ContentSetting setting) { - switch (setting) { - case CONTENT_SETTING_ALLOW: - case CONTENT_SETTING_SESSION_ONLY: - return PermissionStatus::GRANTED; - case CONTENT_SETTING_BLOCK: - return PermissionStatus::DENIED; - case CONTENT_SETTING_ASK: - return PermissionStatus::ASK; - case CONTENT_SETTING_DETECT_IMPORTANT_CONTENT: - case CONTENT_SETTING_DEFAULT: - case CONTENT_SETTING_NUM_SETTINGS: - break; - } - - NOTREACHED(); - return PermissionStatus::DENIED; -} - -// Helper method to convert PermissionStatus to ContentSetting. -ContentSetting PermissionStatusToContentSetting(PermissionStatus status) { - switch (status) { - case PermissionStatus::GRANTED: - return CONTENT_SETTING_ALLOW; - case PermissionStatus::DENIED: - return CONTENT_SETTING_BLOCK; - case PermissionStatus::ASK: - return CONTENT_SETTING_ASK; - } - - NOTREACHED(); - return CONTENT_SETTING_BLOCK; -} - -// Wrap a callback taking a PermissionStatus to pass it as a callback taking a -// ContentSetting. -void ContentSettingToPermissionStatusCallbackWrapper( - const base::Callback& callback, - ContentSetting setting) { - callback.Run(ContentSettingToPermissionStatus(setting)); -} - -// Returns whether the permission has a constant PermissionStatus value (i.e. -// always approved or always denied). -bool IsConstantPermission(PermissionType type) { - switch (type) { - case PermissionType::MIDI: - return true; - default: - return false; - } -} - -void PermissionRequestResponseCallbackWrapper( - const base::Callback& callback, - const std::vector& vector) { - DCHECK_EQ(vector.size(), 1ul); - callback.Run(vector[0]); -} - -// Function used for handling permission types which do not change their -// value i.e. they are always approved or always denied etc. -// CONTENT_SETTING_DEFAULT is returned if the permission needs further handling. -// This function should only be called when IsConstantPermission has returned -// true for the PermissionType. -ContentSetting GetContentSettingForConstantPermission(PermissionType type) { - DCHECK(IsConstantPermission(type)); - switch (type) { - case PermissionType::MIDI: - return CONTENT_SETTING_ALLOW; - default: - return CONTENT_SETTING_DEFAULT; - } -} - -PermissionStatus GetPermissionStatusForConstantPermission(PermissionType type) { - return ContentSettingToPermissionStatus( - GetContentSettingForConstantPermission(type)); -} - -} // anonymous namespace - -class CefPermissionManager::PendingRequest { - public: - PendingRequest( - content::RenderFrameHost* render_frame_host, - const std::vector permissions, - const base::Callback&)>& - callback) - : render_process_id_(render_frame_host->GetProcess()->GetID()), - render_frame_id_(render_frame_host->GetRoutingID()), - callback_(callback), - permissions_(permissions), - results_(permissions.size(), PermissionStatus::DENIED), - remaining_results_(permissions.size()) {} - - void SetPermissionStatus(int permission_id, PermissionStatus status) { - DCHECK(!IsComplete()); - - results_[permission_id] = status; - --remaining_results_; - } - - bool IsComplete() const { return remaining_results_ == 0; } - - int render_process_id() const { return render_process_id_; } - int render_frame_id() const { return render_frame_id_; } - - const base::Callback&)> callback() - const { - return callback_; - } - - std::vector permissions() const { return permissions_; } - - std::vector results() const { return results_; } - - private: - int render_process_id_; - int render_frame_id_; - const base::Callback&)> callback_; - std::vector permissions_; - std::vector results_; - size_t remaining_results_; -}; - -struct CefPermissionManager::Subscription { - PermissionType permission; - GURL requesting_origin; - GURL embedding_origin; - base::Callback callback; - ContentSetting current_value; -}; - -CefPermissionManager::CefPermissionManager(CefBrowserContext* profile) - : profile_(profile), context_(profile), weak_ptr_factory_(this) {} - -CefPermissionManager::~CefPermissionManager() { - if (!subscriptions_.IsEmpty()) - profile_->GetHostContentSettingsMap()->RemoveObserver(this); -} - -int CefPermissionManager::RequestPermission( - PermissionType permission, - content::RenderFrameHost* render_frame_host, - const GURL& requesting_origin, - bool user_gesture, - const base::Callback& callback) { - return RequestPermissions( - std::vector(1, permission), render_frame_host, - requesting_origin, user_gesture, - base::Bind(&PermissionRequestResponseCallbackWrapper, callback)); -} - -int CefPermissionManager::RequestPermissions( - const std::vector& permissions, - content::RenderFrameHost* render_frame_host, - const GURL& requesting_origin, - bool user_gesture, - const base::Callback&)>& - callback) { - if (permissions.empty()) { - callback.Run(std::vector()); - return kNoPendingOperation; - } - - content::WebContents* web_contents = - content::WebContents::FromRenderFrameHost(render_frame_host); - GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); - - std::unique_ptr pending_request = - base::MakeUnique(render_frame_host, permissions, - callback); - int request_id = pending_requests_.Add(std::move(pending_request)); - - const PermissionRequestID request(render_frame_host, request_id); - - for (size_t i = 0; i < permissions.size(); ++i) { - const PermissionType permission = permissions[i]; - - if (IsConstantPermission(permission) || - !context_.SupportsPermission(permission)) { - OnPermissionsRequestResponseStatus( - request_id, i, - GetPermissionStatus(permission, requesting_origin, embedding_origin)); - continue; - } - - context_.RequestPermission( - permission, web_contents, request, requesting_origin, - base::Bind( - &ContentSettingToPermissionStatusCallbackWrapper, - base::Bind( - &CefPermissionManager::OnPermissionsRequestResponseStatus, - weak_ptr_factory_.GetWeakPtr(), request_id, i))); - } - - // The request might have been resolved already. - if (!pending_requests_.Lookup(request_id)) - return kNoPendingOperation; - - return request_id; -} - -void CefPermissionManager::OnPermissionsRequestResponseStatus( - int request_id, - int permission_id, - PermissionStatus status) { - PendingRequest* pending_request = pending_requests_.Lookup(request_id); - pending_request->SetPermissionStatus(permission_id, status); - - if (!pending_request->IsComplete()) - return; - - pending_request->callback().Run(pending_request->results()); - pending_requests_.Remove(request_id); -} - -void CefPermissionManager::CancelPermissionRequest(int request_id) { - PendingRequest* pending_request = pending_requests_.Lookup(request_id); - if (!pending_request) - return; - - content::RenderFrameHost* render_frame_host = - content::RenderFrameHost::FromID(pending_request->render_process_id(), - pending_request->render_frame_id()); - DCHECK(render_frame_host); - content::WebContents* web_contents = - content::WebContents::FromRenderFrameHost(render_frame_host); - DCHECK(web_contents); - - const PermissionRequestID request(pending_request->render_process_id(), - pending_request->render_frame_id(), - request_id); - for (PermissionType permission : pending_request->permissions()) { - if (!context_.SupportsPermission(permission)) - continue; - context_.CancelPermissionRequest(permission, web_contents, request); - } - pending_requests_.Remove(request_id); -} - -void CefPermissionManager::ResetPermission(PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin) { - if (!context_.SupportsPermission(permission)) - return; - context_.ResetPermission(permission, requesting_origin, embedding_origin); -} - -PermissionStatus CefPermissionManager::GetPermissionStatus( - PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin) { - if (IsConstantPermission(permission)) - return GetPermissionStatusForConstantPermission(permission); - - if (!context_.SupportsPermission(permission)) - return PermissionStatus::DENIED; - - return ContentSettingToPermissionStatus(context_.GetPermissionStatus( - permission, requesting_origin, embedding_origin)); -} - -int CefPermissionManager::SubscribePermissionStatusChange( - PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin, - const base::Callback& callback) { - if (subscriptions_.IsEmpty()) - profile_->GetHostContentSettingsMap()->AddObserver(this); - - std::unique_ptr subscription = base::MakeUnique(); - subscription->permission = permission; - subscription->requesting_origin = requesting_origin; - subscription->embedding_origin = embedding_origin; - subscription->callback = callback; - - subscription->current_value = PermissionStatusToContentSetting( - GetPermissionStatus(permission, subscription->requesting_origin, - subscription->embedding_origin)); - - return subscriptions_.Add(std::move(subscription)); -} - -void CefPermissionManager::UnsubscribePermissionStatusChange( - int subscription_id) { - // Whether |subscription_id| is known will be checked by the Remove() call. - subscriptions_.Remove(subscription_id); - - if (subscriptions_.IsEmpty()) - profile_->GetHostContentSettingsMap()->RemoveObserver(this); -} - -void CefPermissionManager::OnContentSettingChanged( - const ContentSettingsPattern& primary_pattern, - const ContentSettingsPattern& secondary_pattern, - ContentSettingsType content_type, - std::string resource_identifier) { - std::list callbacks; - - for (SubscriptionsMap::iterator iter(&subscriptions_); !iter.IsAtEnd(); - iter.Advance()) { - Subscription* subscription = iter.GetCurrentValue(); - if (permission_util::PermissionTypeToContentSetting( - subscription->permission) != content_type) { - continue; - } - - if (primary_pattern.IsValid() && - !primary_pattern.Matches(subscription->requesting_origin)) - continue; - if (secondary_pattern.IsValid() && - !secondary_pattern.Matches(subscription->embedding_origin)) - continue; - - ContentSetting new_value = - PermissionStatusToContentSetting(GetPermissionStatus( - subscription->permission, subscription->requesting_origin, - subscription->embedding_origin)); - if (subscription->current_value == new_value) - continue; - - subscription->current_value = new_value; - - // Add the callback to |callbacks| which will be run after the loop to - // prevent re-entrance issues. - callbacks.push_back(base::Bind( - subscription->callback, ContentSettingToPermissionStatus(new_value))); - } - - for (const auto& callback : callbacks) - callback.Run(); -} diff --git a/libcef/browser/permissions/permission_manager.h b/libcef/browser/permissions/permission_manager.h deleted file mode 100644 index 6fb8d2b85..000000000 --- a/libcef/browser/permissions/permission_manager.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2015 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_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ -#define CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ - -#include "libcef/browser/permissions/permission_context.h" - -#include "base/callback_forward.h" -#include "base/containers/id_map.h" -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "components/content_settings/core/browser/content_settings_observer.h" -#include "components/content_settings/core/common/content_settings.h" -#include "components/keyed_service/core/keyed_service.h" -#include "content/public/browser/permission_manager.h" - -class CefBrowserContext; - -namespace content { -enum class PermissionType; -class WebContents; -}; // namespace content - -// Implementation based on chrome/browser/permissions/permission_manager.h -class CefPermissionManager : public KeyedService, - public content::PermissionManager, - public content_settings::Observer { - public: - explicit CefPermissionManager(CefBrowserContext* profile); - ~CefPermissionManager() override; - - // content::CefPermissionManager implementation. - int RequestPermission( - content::PermissionType permission, - content::RenderFrameHost* render_frame_host, - const GURL& requesting_origin, - bool user_gesture, - const base::Callback& callback) - override; - int RequestPermissions( - const std::vector& permissions, - content::RenderFrameHost* render_frame_host, - const GURL& requesting_origin, - bool user_gesture, - const base::Callback< - void(const std::vector&)>& callback) - override; - void CancelPermissionRequest(int request_id) override; - void ResetPermission(content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin) override; - blink::mojom::PermissionStatus GetPermissionStatus( - content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin) override; - int SubscribePermissionStatusChange( - content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin, - const base::Callback& callback) - override; - void UnsubscribePermissionStatusChange(int subscription_id) override; - - private: - class PendingRequest; - using PendingRequestsMap = base::IDMap>; - - struct Subscription; - using SubscriptionsMap = base::IDMap>; - - // Called when a permission was decided for a given PendingRequest. The - // PendingRequest is identified by its |request_id| and the permission is - // identified by its |permission_id|. If the PendingRequest contains more than - // one permission, it will wait for the remaining permissions to be resolved. - // When all the permissions have been resolved, the PendingRequest's callback - // is run. - void OnPermissionsRequestResponseStatus( - int request_id, - int permission_id, - blink::mojom::PermissionStatus status); - - // content_settings::Observer implementation. - void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, - const ContentSettingsPattern& secondary_pattern, - ContentSettingsType content_type, - std::string resource_identifier) override; - - CefBrowserContext* profile_; - PendingRequestsMap pending_requests_; - SubscriptionsMap subscriptions_; - CefPermissionContext context_; - - base::WeakPtrFactory weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(CefPermissionManager); -}; - -#endif // CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_ diff --git a/libcef/browser/permissions/permission_util.cc b/libcef/browser/permissions/permission_util.cc deleted file mode 100644 index 95d37a0c8..000000000 --- a/libcef/browser/permissions/permission_util.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015 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/browser/permissions/permission_util.h" - -#include "base/logging.h" - -using content::PermissionType; - -namespace permission_util { - -// Copied from chrome/browser/permissions/permission_manager.cc. -ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) { - switch (permission) { - case PermissionType::MIDI: - return CONTENT_SETTINGS_TYPE_MIDI; - case PermissionType::MIDI_SYSEX: - return CONTENT_SETTINGS_TYPE_MIDI_SYSEX; - case PermissionType::NOTIFICATIONS: - return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; - case PermissionType::GEOLOCATION: - return CONTENT_SETTINGS_TYPE_GEOLOCATION; - case PermissionType::PROTECTED_MEDIA_IDENTIFIER: -#if defined(OS_ANDROID) || defined(OS_CHROMEOS) - return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; -#else - NOTIMPLEMENTED(); - break; -#endif - case PermissionType::DURABLE_STORAGE: - return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE; - case PermissionType::AUDIO_CAPTURE: - return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC; - case PermissionType::VIDEO_CAPTURE: - return CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; - case PermissionType::BACKGROUND_SYNC: - return CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC; - case PermissionType::FLASH: - return CONTENT_SETTINGS_TYPE_PLUGINS; - case PermissionType::SENSORS: - return CONTENT_SETTINGS_TYPE_SENSORS; - case PermissionType::ACCESSIBILITY_EVENTS: - return CONTENT_SETTINGS_TYPE_ACCESSIBILITY_EVENTS; - case PermissionType::CLIPBOARD_READ: - return CONTENT_SETTINGS_TYPE_CLIPBOARD_READ; - case PermissionType::CLIPBOARD_WRITE: - return CONTENT_SETTINGS_TYPE_CLIPBOARD_WRITE; - case PermissionType::NUM: - // This will hit the NOTREACHED below. - break; - } - - NOTREACHED() << "Unknown content setting for permission " - << static_cast(permission); - return CONTENT_SETTINGS_TYPE_DEFAULT; -} - -} // namespace permission_util diff --git a/libcef/browser/permissions/permission_util.h b/libcef/browser/permissions/permission_util.h deleted file mode 100644 index e3c5d4d5e..000000000 --- a/libcef/browser/permissions/permission_util.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 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_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ -#define CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ - -#include "components/content_settings/core/common/content_settings_types.h" -#include "content/public/browser/permission_type.h" - -namespace permission_util { - -// Helper method to convert PermissionType to ContentSettingType. -ContentSettingsType PermissionTypeToContentSetting( - content::PermissionType permission); - -} // namespace permission_util - -#endif // CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ diff --git a/libcef_dll/cpptoc/client_cpptoc.cc b/libcef_dll/cpptoc/client_cpptoc.cc index 2116159d6..31be13038 100644 --- a/libcef_dll/cpptoc/client_cpptoc.cc +++ b/libcef_dll/cpptoc/client_cpptoc.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=9e43ede1c873111f8ccd125a24a6201c4702f822$ +// $hash=74f8efc606edb74535b418345d7a3b9ddcfd3bca$ // #include "libcef_dll/cpptoc/client_cpptoc.h" @@ -20,7 +20,6 @@ #include "libcef_dll/cpptoc/drag_handler_cpptoc.h" #include "libcef_dll/cpptoc/find_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/keyboard_handler_cpptoc.h" #include "libcef_dll/cpptoc/life_span_handler_cpptoc.h" @@ -146,22 +145,6 @@ client_get_focus_handler(struct _cef_client_t* self) { return CefFocusHandlerCppToC::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 _retval = - CefClientCppToC::Get(self)->GetGeolocationHandler(); - - // Return type: refptr_same - return CefGeolocationHandlerCppToC::Wrap(_retval); -} - struct _cef_jsdialog_handler_t* CEF_CALLBACK client_get_jsdialog_handler(struct _cef_client_t* self) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING @@ -298,7 +281,6 @@ CefClientCppToC::CefClientCppToC() { GetStruct()->get_drag_handler = client_get_drag_handler; GetStruct()->get_find_handler = client_get_find_handler; GetStruct()->get_focus_handler = client_get_focus_handler; - GetStruct()->get_geolocation_handler = client_get_geolocation_handler; GetStruct()->get_jsdialog_handler = client_get_jsdialog_handler; GetStruct()->get_keyboard_handler = client_get_keyboard_handler; GetStruct()->get_life_span_handler = client_get_life_span_handler; diff --git a/libcef_dll/cpptoc/geolocation_callback_cpptoc.cc b/libcef_dll/cpptoc/geolocation_callback_cpptoc.cc deleted file mode 100644 index e68d3bf9e..000000000 --- a/libcef_dll/cpptoc/geolocation_callback_cpptoc.cc +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=5bd0f16810c3c46a19a5f64133e02e4681675f04$ -// - -#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h" - -namespace { - -// 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); -} - -} // namespace - -// CONSTRUCTOR - Do not edit by hand. - -CefGeolocationCallbackCppToC::CefGeolocationCallbackCppToC() { - GetStruct()->cont = geolocation_callback_cont; -} - -template <> -CefRefPtr CefCppToCRefCounted< - CefGeolocationCallbackCppToC, - CefGeolocationCallback, - cef_geolocation_callback_t>::UnwrapDerived(CefWrapperType type, - cef_geolocation_callback_t* s) { - NOTREACHED() << "Unexpected class type: " << type; - return NULL; -} - -#if DCHECK_IS_ON() -template <> -base::AtomicRefCount CefCppToCRefCounted::DebugObjCt - ATOMIC_DECLARATION; -#endif - -template <> -CefWrapperType CefCppToCRefCounted::kWrapperType = - WT_GEOLOCATION_CALLBACK; diff --git a/libcef_dll/cpptoc/geolocation_callback_cpptoc.h b/libcef_dll/cpptoc/geolocation_callback_cpptoc.h deleted file mode 100644 index 5264473f8..000000000 --- a/libcef_dll/cpptoc/geolocation_callback_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=98817821ce951491596ce01e7a13febc669ff1b9$ -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_CALLBACK_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_CALLBACK_CPPTOC_H_ -#pragma once - -#if !defined(BUILDING_CEF_SHARED) -#error This file can be included DLL-side only -#endif - -#include "include/capi/cef_geolocation_handler_capi.h" -#include "include/cef_geolocation_handler.h" -#include "libcef_dll/cpptoc/cpptoc_ref_counted.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed DLL-side only. -class CefGeolocationCallbackCppToC - : public CefCppToCRefCounted { - public: - CefGeolocationCallbackCppToC(); -}; - -#endif // CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_CALLBACK_CPPTOC_H_ diff --git a/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc b/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc deleted file mode 100644 index eb1d9f0c5..000000000 --- a/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=d4092763acd3a7bfd30586d0bdfd91915d2fab90$ -// - -#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h" - -namespace { - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int 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 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: requesting_url; type: string_byref_const - DCHECK(requesting_url); - if (!requesting_url) - return 0; - // Verify param: callback; type: refptr_diff - DCHECK(callback); - if (!callback) - return 0; - - // Execute - bool _retval = - CefGeolocationHandlerCppToC::Get(self)->OnRequestGeolocationPermission( - CefBrowserCToCpp::Wrap(browser), CefString(requesting_url), - request_id, CefGeolocationCallbackCToCpp::Wrap(callback)); - - // Return type: bool - return _retval; -} - -void CEF_CALLBACK geolocation_handler_on_cancel_geolocation_permission( - struct _cef_geolocation_handler_t* self, - cef_browser_t* browser, - 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; - - // Execute - CefGeolocationHandlerCppToC::Get(self)->OnCancelGeolocationPermission( - CefBrowserCToCpp::Wrap(browser), request_id); -} - -} // namespace - -// CONSTRUCTOR - Do not edit by hand. - -CefGeolocationHandlerCppToC::CefGeolocationHandlerCppToC() { - GetStruct()->on_request_geolocation_permission = - geolocation_handler_on_request_geolocation_permission; - GetStruct()->on_cancel_geolocation_permission = - geolocation_handler_on_cancel_geolocation_permission; -} - -template <> -CefRefPtr CefCppToCRefCounted< - CefGeolocationHandlerCppToC, - CefGeolocationHandler, - cef_geolocation_handler_t>::UnwrapDerived(CefWrapperType type, - cef_geolocation_handler_t* s) { - NOTREACHED() << "Unexpected class type: " << type; - return NULL; -} - -#if DCHECK_IS_ON() -template <> -base::AtomicRefCount CefCppToCRefCounted::DebugObjCt - ATOMIC_DECLARATION; -#endif - -template <> -CefWrapperType CefCppToCRefCounted::kWrapperType = - WT_GEOLOCATION_HANDLER; diff --git a/libcef_dll/cpptoc/geolocation_handler_cpptoc.h b/libcef_dll/cpptoc/geolocation_handler_cpptoc.h deleted file mode 100644 index af10d87c8..000000000 --- a/libcef_dll/cpptoc/geolocation_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=414d9dd69cf3d35b85ccdfcf302884033ed6e04c$ -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_HANDLER_CPPTOC_H_ -#pragma once - -#if !defined(WRAPPING_CEF_SHARED) -#error This file can be included wrapper-side only -#endif - -#include "include/capi/cef_geolocation_handler_capi.h" -#include "include/cef_geolocation_handler.h" -#include "libcef_dll/cpptoc/cpptoc_ref_counted.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefGeolocationHandlerCppToC - : public CefCppToCRefCounted { - public: - CefGeolocationHandlerCppToC(); -}; - -#endif // CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_HANDLER_CPPTOC_H_ diff --git a/libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc b/libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc deleted file mode 100644 index 48b9c951e..000000000 --- a/libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=ba9c66f6c7806715268009762248e6f68e94fc8c$ -// - -#include "libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h" - -namespace { - -// MEMBER FUNCTIONS - Body may be edited by hand. - -void CEF_CALLBACK get_geolocation_callback_on_location_update( - struct _cef_get_geolocation_callback_t* self, - const struct _cef_geoposition_t* position) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: position; type: struct_byref_const - DCHECK(position); - if (!position) - return; - - // Translate param: position; type: struct_byref_const - CefGeoposition positionObj; - if (position) - positionObj.Set(*position, false); - - // Execute - CefGetGeolocationCallbackCppToC::Get(self)->OnLocationUpdate(positionObj); -} - -} // namespace - -// CONSTRUCTOR - Do not edit by hand. - -CefGetGeolocationCallbackCppToC::CefGetGeolocationCallbackCppToC() { - GetStruct()->on_location_update = get_geolocation_callback_on_location_update; -} - -template <> -CefRefPtr -CefCppToCRefCounted:: - UnwrapDerived(CefWrapperType type, cef_get_geolocation_callback_t* s) { - NOTREACHED() << "Unexpected class type: " << type; - return NULL; -} - -#if DCHECK_IS_ON() -template <> -base::AtomicRefCount CefCppToCRefCounted< - CefGetGeolocationCallbackCppToC, - CefGetGeolocationCallback, - cef_get_geolocation_callback_t>::DebugObjCt ATOMIC_DECLARATION; -#endif - -template <> -CefWrapperType - CefCppToCRefCounted::kWrapperType = - WT_GET_GEOLOCATION_CALLBACK; diff --git a/libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h b/libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h deleted file mode 100644 index c752bc306..000000000 --- a/libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=5b84f64e6dc130807abd2cf121f4fe8a19ef0194$ -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_GET_GEOLOCATION_CALLBACK_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_GET_GEOLOCATION_CALLBACK_CPPTOC_H_ -#pragma once - -#if !defined(WRAPPING_CEF_SHARED) -#error This file can be included wrapper-side only -#endif - -#include "include/capi/cef_geolocation_capi.h" -#include "include/cef_geolocation.h" -#include "libcef_dll/cpptoc/cpptoc_ref_counted.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefGetGeolocationCallbackCppToC - : public CefCppToCRefCounted { - public: - CefGetGeolocationCallbackCppToC(); -}; - -#endif // CEF_LIBCEF_DLL_CPPTOC_GET_GEOLOCATION_CALLBACK_CPPTOC_H_ diff --git a/libcef_dll/ctocpp/client_ctocpp.cc b/libcef_dll/ctocpp/client_ctocpp.cc index c122dc8ad..91c97825c 100644 --- a/libcef_dll/ctocpp/client_ctocpp.cc +++ b/libcef_dll/ctocpp/client_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=0fccd49cb20ab68370e1259052bda83c0cfd0a09$ +// $hash=d02e30103863b1d5eb2a8339f8bd8e5d01812f28$ // #include "libcef_dll/ctocpp/client_ctocpp.h" @@ -22,7 +22,6 @@ #include "libcef_dll/ctocpp/drag_handler_ctocpp.h" #include "libcef_dll/ctocpp/find_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/keyboard_handler_ctocpp.h" #include "libcef_dll/ctocpp/life_span_handler_ctocpp.h" @@ -131,21 +130,6 @@ CefRefPtr CefClientCToCpp::GetFocusHandler() { return CefFocusHandlerCToCpp::Wrap(_retval); } -CefRefPtr CefClientCToCpp::GetGeolocationHandler() { - cef_client_t* _struct = GetStruct(); - 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); -} - CefRefPtr CefClientCToCpp::GetJSDialogHandler() { cef_client_t* _struct = GetStruct(); if (CEF_MEMBER_MISSING(_struct, get_jsdialog_handler)) diff --git a/libcef_dll/ctocpp/client_ctocpp.h b/libcef_dll/ctocpp/client_ctocpp.h index b84db2722..7be9bd74a 100644 --- a/libcef_dll/ctocpp/client_ctocpp.h +++ b/libcef_dll/ctocpp/client_ctocpp.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=d1d5aff0ab25713b263c91a5c2dba2c60c798d39$ +// $hash=79395a86efe19099f77240902fb56533bc791f7a$ // #ifndef CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_ @@ -39,7 +39,6 @@ class CefClientCToCpp CefRefPtr GetDragHandler() override; CefRefPtr GetFindHandler() override; CefRefPtr GetFocusHandler() override; - CefRefPtr GetGeolocationHandler() override; CefRefPtr GetJSDialogHandler() override; CefRefPtr GetKeyboardHandler() override; CefRefPtr GetLifeSpanHandler() override; diff --git a/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc b/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc deleted file mode 100644 index 86379e55d..000000000 --- a/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=2bd27eaa0d2a977064dccedffdecbffd6c28d02b$ -// - -#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h" - -// VIRTUAL METHODS - Body may be edited by hand. - -void CefGeolocationCallbackCToCpp::Continue(bool allow) { - cef_geolocation_callback_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, cont)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - _struct->cont(_struct, allow); -} - -// CONSTRUCTOR - Do not edit by hand. - -CefGeolocationCallbackCToCpp::CefGeolocationCallbackCToCpp() {} - -template <> -cef_geolocation_callback_t* CefCToCppRefCounted< - CefGeolocationCallbackCToCpp, - CefGeolocationCallback, - cef_geolocation_callback_t>::UnwrapDerived(CefWrapperType type, - CefGeolocationCallback* c) { - NOTREACHED() << "Unexpected class type: " << type; - return NULL; -} - -#if DCHECK_IS_ON() -template <> -base::AtomicRefCount CefCToCppRefCounted::DebugObjCt - ATOMIC_DECLARATION; -#endif - -template <> -CefWrapperType CefCToCppRefCounted::kWrapperType = - WT_GEOLOCATION_CALLBACK; diff --git a/libcef_dll/ctocpp/geolocation_callback_ctocpp.h b/libcef_dll/ctocpp/geolocation_callback_ctocpp.h deleted file mode 100644 index 5163edcbb..000000000 --- a/libcef_dll/ctocpp/geolocation_callback_ctocpp.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=194c6a77f3f1a23a883940aff0b5ae4a0ab434fc$ -// - -#ifndef CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_ -#pragma once - -#if !defined(WRAPPING_CEF_SHARED) -#error This file can be included wrapper-side only -#endif - -#include "include/capi/cef_geolocation_handler_capi.h" -#include "include/cef_geolocation_handler.h" -#include "libcef_dll/ctocpp/ctocpp_ref_counted.h" - -// Wrap a C structure with a C++ class. -// This class may be instantiated and accessed wrapper-side only. -class CefGeolocationCallbackCToCpp - : public CefCToCppRefCounted { - public: - CefGeolocationCallbackCToCpp(); - - // CefGeolocationCallback methods. - void Continue(bool allow) OVERRIDE; -}; - -#endif // CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_ diff --git a/libcef_dll/ctocpp/geolocation_handler_ctocpp.cc b/libcef_dll/ctocpp/geolocation_handler_ctocpp.cc deleted file mode 100644 index 7a634e8a7..000000000 --- a/libcef_dll/ctocpp/geolocation_handler_ctocpp.cc +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=ee4a27e022edcd3e95b37fb24b72c0b115c9342c$ -// - -#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h" -#include "libcef_dll/cpptoc/browser_cpptoc.h" -#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h" - -// VIRTUAL METHODS - Body may be edited by hand. - -bool CefGeolocationHandlerCToCpp::OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) { - cef_geolocation_handler_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, on_request_geolocation_permission)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: browser; type: refptr_diff - DCHECK(browser.get()); - if (!browser.get()) - return false; - // Verify param: requesting_url; type: string_byref_const - DCHECK(!requesting_url.empty()); - if (requesting_url.empty()) - return false; - // Verify param: callback; type: refptr_diff - DCHECK(callback.get()); - if (!callback.get()) - return false; - - // Execute - int _retval = _struct->on_request_geolocation_permission( - _struct, CefBrowserCppToC::Wrap(browser), requesting_url.GetStruct(), - request_id, CefGeolocationCallbackCppToC::Wrap(callback)); - - // Return type: bool - return _retval ? true : false; -} - -void CefGeolocationHandlerCToCpp::OnCancelGeolocationPermission( - CefRefPtr browser, - int request_id) { - cef_geolocation_handler_t* _struct = GetStruct(); - 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; - - // Execute - _struct->on_cancel_geolocation_permission( - _struct, CefBrowserCppToC::Wrap(browser), request_id); -} - -// CONSTRUCTOR - Do not edit by hand. - -CefGeolocationHandlerCToCpp::CefGeolocationHandlerCToCpp() {} - -template <> -cef_geolocation_handler_t* CefCToCppRefCounted< - CefGeolocationHandlerCToCpp, - CefGeolocationHandler, - cef_geolocation_handler_t>::UnwrapDerived(CefWrapperType type, - CefGeolocationHandler* c) { - NOTREACHED() << "Unexpected class type: " << type; - return NULL; -} - -#if DCHECK_IS_ON() -template <> -base::AtomicRefCount CefCToCppRefCounted::DebugObjCt - ATOMIC_DECLARATION; -#endif - -template <> -CefWrapperType CefCToCppRefCounted::kWrapperType = - WT_GEOLOCATION_HANDLER; diff --git a/libcef_dll/ctocpp/geolocation_handler_ctocpp.h b/libcef_dll/ctocpp/geolocation_handler_ctocpp.h deleted file mode 100644 index 93892f4f2..000000000 --- a/libcef_dll/ctocpp/geolocation_handler_ctocpp.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=b7ebc30b0b9adc5a052d3fd4f0d998467aec0773$ -// - -#ifndef CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_ -#pragma once - -#if !defined(BUILDING_CEF_SHARED) -#error This file can be included DLL-side only -#endif - -#include "include/capi/cef_geolocation_handler_capi.h" -#include "include/cef_geolocation_handler.h" -#include "libcef_dll/ctocpp/ctocpp_ref_counted.h" - -// Wrap a C structure with a C++ class. -// This class may be instantiated and accessed DLL-side only. -class CefGeolocationHandlerCToCpp - : public CefCToCppRefCounted { - public: - CefGeolocationHandlerCToCpp(); - - // CefGeolocationHandler methods. - bool OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) override; - void OnCancelGeolocationPermission(CefRefPtr browser, - int request_id) override; -}; - -#endif // CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_ diff --git a/libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc b/libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc deleted file mode 100644 index b288f4e4f..000000000 --- a/libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=bb77620a4eb5dbac001660d97187a2c543a4de43$ -// - -#include "libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h" - -// VIRTUAL METHODS - Body may be edited by hand. - -void CefGetGeolocationCallbackCToCpp::OnLocationUpdate( - const CefGeoposition& position) { - cef_get_geolocation_callback_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, on_location_update)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - _struct->on_location_update(_struct, &position); -} - -// CONSTRUCTOR - Do not edit by hand. - -CefGetGeolocationCallbackCToCpp::CefGetGeolocationCallbackCToCpp() {} - -template <> -cef_get_geolocation_callback_t* CefCToCppRefCounted< - CefGetGeolocationCallbackCToCpp, - CefGetGeolocationCallback, - cef_get_geolocation_callback_t>::UnwrapDerived(CefWrapperType type, - CefGetGeolocationCallback* - c) { - NOTREACHED() << "Unexpected class type: " << type; - return NULL; -} - -#if DCHECK_IS_ON() -template <> -base::AtomicRefCount CefCToCppRefCounted< - CefGetGeolocationCallbackCToCpp, - CefGetGeolocationCallback, - cef_get_geolocation_callback_t>::DebugObjCt ATOMIC_DECLARATION; -#endif - -template <> -CefWrapperType - CefCToCppRefCounted::kWrapperType = - WT_GET_GEOLOCATION_CALLBACK; diff --git a/libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h b/libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h deleted file mode 100644 index f137f2f24..000000000 --- a/libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2018 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. -// -// $hash=1534f165425a785e198e3eb216b70948916499e1$ -// - -#ifndef CEF_LIBCEF_DLL_CTOCPP_GET_GEOLOCATION_CALLBACK_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_GET_GEOLOCATION_CALLBACK_CTOCPP_H_ -#pragma once - -#if !defined(BUILDING_CEF_SHARED) -#error This file can be included DLL-side only -#endif - -#include "include/capi/cef_geolocation_capi.h" -#include "include/cef_geolocation.h" -#include "libcef_dll/ctocpp/ctocpp_ref_counted.h" - -// Wrap a C structure with a C++ class. -// This class may be instantiated and accessed DLL-side only. -class CefGetGeolocationCallbackCToCpp - : public CefCToCppRefCounted { - public: - CefGetGeolocationCallbackCToCpp(); - - // CefGetGeolocationCallback methods. - void OnLocationUpdate(const CefGeoposition& position) override; -}; - -#endif // CEF_LIBCEF_DLL_CTOCPP_GET_GEOLOCATION_CALLBACK_CTOCPP_H_ diff --git a/libcef_dll/libcef_dll.cc b/libcef_dll/libcef_dll.cc index 8ee5a552c..7aad5a5db 100644 --- a/libcef_dll/libcef_dll.cc +++ b/libcef_dll/libcef_dll.cc @@ -9,13 +9,12 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=308c8d67492d6cdc50740b85321ec6423f967a6e$ +// $hash=8fb3e1af64274b34482ee34c75a6196654104360$ // #include "include/capi/cef_app_capi.h" #include "include/capi/cef_crash_util_capi.h" #include "include/capi/cef_file_util_capi.h" -#include "include/capi/cef_geolocation_capi.h" #include "include/capi/cef_origin_whitelist_capi.h" #include "include/capi/cef_parser_capi.h" #include "include/capi/cef_path_util_capi.h" @@ -30,7 +29,6 @@ #include "include/cef_app.h" #include "include/cef_crash_util.h" #include "include/cef_file_util.h" -#include "include/cef_geolocation.h" #include "include/cef_origin_whitelist.h" #include "include/cef_parser.h" #include "include/cef_path_util.h" @@ -59,7 +57,6 @@ #include "libcef_dll/cpptoc/extension_cpptoc.h" #include "libcef_dll/cpptoc/file_dialog_callback_cpptoc.h" #include "libcef_dll/cpptoc/frame_cpptoc.h" -#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h" #include "libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h" #include "libcef_dll/cpptoc/image_cpptoc.h" #include "libcef_dll/cpptoc/jsdialog_callback_cpptoc.h" @@ -132,8 +129,6 @@ #include "libcef_dll/ctocpp/extension_handler_ctocpp.h" #include "libcef_dll/ctocpp/find_handler_ctocpp.h" #include "libcef_dll/ctocpp/focus_handler_ctocpp.h" -#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h" -#include "libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h" #include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h" #include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h" #include "libcef_dll/ctocpp/life_span_handler_ctocpp.h" @@ -290,12 +285,8 @@ CEF_EXPORT void cef_shutdown() { DCHECK(base::AtomicRefCountIsZero(&CefFindHandlerCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFocusHandlerCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFrameCppToC::DebugObjCt)); - DCHECK(base::AtomicRefCountIsZero(&CefGeolocationCallbackCppToC::DebugObjCt)); - DCHECK(base::AtomicRefCountIsZero(&CefGeolocationHandlerCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero( &CefGetExtensionResourceCallbackCppToC::DebugObjCt)); - DCHECK( - base::AtomicRefCountIsZero(&CefGetGeolocationCallbackCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefImageCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefJSDialogCallbackCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefJSDialogHandlerCToCpp::DebugObjCt)); @@ -610,23 +601,6 @@ CEF_EXPORT void cef_load_crlsets_file(const cef_string_t* path) { CefLoadCRLSetsFile(CefString(path)); } -CEF_EXPORT int cef_get_geolocation( - struct _cef_get_geolocation_callback_t* callback) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: callback; type: refptr_diff - DCHECK(callback); - if (!callback) - return 0; - - // Execute - bool _retval = - CefGetGeolocation(CefGetGeolocationCallbackCToCpp::Wrap(callback)); - - // Return type: bool - return _retval; -} - CEF_EXPORT int cef_add_cross_origin_whitelist_entry( const cef_string_t* source_origin, const cef_string_t* target_protocol, diff --git a/libcef_dll/wrapper/libcef_dll_wrapper.cc b/libcef_dll/wrapper/libcef_dll_wrapper.cc index f5193dfd4..5994fbdc2 100644 --- a/libcef_dll/wrapper/libcef_dll_wrapper.cc +++ b/libcef_dll/wrapper/libcef_dll_wrapper.cc @@ -9,13 +9,12 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=c73e15357ba9d9047c54452fc244fadcf98b4760$ +// $hash=07d31c969dc527db8df550827d750aefa0abf1b8$ // #include "include/capi/cef_app_capi.h" #include "include/capi/cef_crash_util_capi.h" #include "include/capi/cef_file_util_capi.h" -#include "include/capi/cef_geolocation_capi.h" #include "include/capi/cef_origin_whitelist_capi.h" #include "include/capi/cef_parser_capi.h" #include "include/capi/cef_path_util_capi.h" @@ -30,7 +29,6 @@ #include "include/cef_app.h" #include "include/cef_crash_util.h" #include "include/cef_file_util.h" -#include "include/cef_geolocation.h" #include "include/cef_origin_whitelist.h" #include "include/cef_parser.h" #include "include/cef_path_util.h" @@ -60,8 +58,6 @@ #include "libcef_dll/cpptoc/extension_handler_cpptoc.h" #include "libcef_dll/cpptoc/find_handler_cpptoc.h" #include "libcef_dll/cpptoc/focus_handler_cpptoc.h" -#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h" -#include "libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h" #include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h" #include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h" #include "libcef_dll/cpptoc/life_span_handler_cpptoc.h" @@ -120,7 +116,6 @@ #include "libcef_dll/ctocpp/extension_ctocpp.h" #include "libcef_dll/ctocpp/file_dialog_callback_ctocpp.h" #include "libcef_dll/ctocpp/frame_ctocpp.h" -#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h" #include "libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h" #include "libcef_dll/ctocpp/image_ctocpp.h" #include "libcef_dll/ctocpp/jsdialog_callback_ctocpp.h" @@ -281,12 +276,8 @@ CEF_GLOBAL void CefShutdown() { DCHECK(base::AtomicRefCountIsZero(&CefFindHandlerCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFocusHandlerCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefFrameCToCpp::DebugObjCt)); - DCHECK(base::AtomicRefCountIsZero(&CefGeolocationCallbackCToCpp::DebugObjCt)); - DCHECK(base::AtomicRefCountIsZero(&CefGeolocationHandlerCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero( &CefGetExtensionResourceCallbackCToCpp::DebugObjCt)); - DCHECK( - base::AtomicRefCountIsZero(&CefGetGeolocationCallbackCppToC::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefImageCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefJSDialogCallbackCToCpp::DebugObjCt)); DCHECK(base::AtomicRefCountIsZero(&CefJSDialogHandlerCppToC::DebugObjCt)); @@ -579,23 +570,6 @@ CEF_GLOBAL void CefLoadCRLSetsFile(const CefString& path) { cef_load_crlsets_file(path.GetStruct()); } -CEF_GLOBAL bool CefGetGeolocation( - CefRefPtr callback) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: callback; type: refptr_diff - DCHECK(callback.get()); - if (!callback.get()) - return false; - - // Execute - int _retval = - cef_get_geolocation(CefGetGeolocationCallbackCppToC::Wrap(callback)); - - // Return type: bool - return _retval ? true : false; -} - CEF_GLOBAL bool CefAddCrossOriginWhitelistEntry( const CefString& source_origin, const CefString& target_protocol, diff --git a/libcef_dll/wrapper_types.h b/libcef_dll/wrapper_types.h index 8f4d75467..30bc3e589 100644 --- a/libcef_dll/wrapper_types.h +++ b/libcef_dll/wrapper_types.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=981e50d71f62734221727297117cf18f0ed9fd2e$ +// $hash=3fe3af71072987e46db28d1a94b8b6a9ad7d9e2a$ // #ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_ @@ -62,10 +62,7 @@ enum CefWrapperType { WT_FIND_HANDLER, WT_FOCUS_HANDLER, WT_FRAME, - WT_GEOLOCATION_CALLBACK, - WT_GEOLOCATION_HANDLER, WT_GET_EXTENSION_RESOURCE_CALLBACK, - WT_GET_GEOLOCATION_CALLBACK, WT_IMAGE, WT_JSDIALOG_CALLBACK, WT_JSDIALOG_HANDLER, diff --git a/tests/cefclient/browser/client_handler.cc b/tests/cefclient/browser/client_handler.cc index 3cd480869..222af55f7 100644 --- a/tests/cefclient/browser/client_handler.cc +++ b/tests/cefclient/browser/client_handler.cc @@ -497,18 +497,6 @@ void ClientHandler::OnTakeFocus(CefRefPtr browser, bool next) { NotifyTakeFocus(next); } -bool ClientHandler::OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) { - CEF_REQUIRE_UI_THREAD(); - - // Allow geolocation access from all websites. - callback->Continue(true); - return true; -} - bool ClientHandler::OnPreKeyEvent(CefRefPtr browser, const CefKeyEvent& event, CefEventHandle os_event, diff --git a/tests/cefclient/browser/client_handler.h b/tests/cefclient/browser/client_handler.h index 3660bffb9..a95bb4cba 100644 --- a/tests/cefclient/browser/client_handler.h +++ b/tests/cefclient/browser/client_handler.h @@ -31,7 +31,6 @@ class ClientHandler : public CefClient, public CefDownloadHandler, public CefDragHandler, public CefFocusHandler, - public CefGeolocationHandler, public CefKeyboardHandler, public CefLifeSpanHandler, public CefLoadHandler, @@ -105,9 +104,6 @@ class ClientHandler : public CefClient, CefRefPtr GetDownloadHandler() OVERRIDE { return this; } CefRefPtr GetDragHandler() OVERRIDE { return this; } CefRefPtr GetFocusHandler() OVERRIDE { return this; } - CefRefPtr GetGeolocationHandler() OVERRIDE { - return this; - } CefRefPtr GetKeyboardHandler() OVERRIDE { return this; } CefRefPtr GetLifeSpanHandler() OVERRIDE { return this; } CefRefPtr GetLoadHandler() OVERRIDE { return this; } @@ -174,13 +170,6 @@ class ClientHandler : public CefClient, // CefFocusHandler methods void OnTakeFocus(CefRefPtr browser, bool next) OVERRIDE; - // CefGeolocationHandler methods - bool OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) OVERRIDE; - // CefKeyboardHandler methods bool OnPreKeyEvent(CefRefPtr browser, const CefKeyEvent& event, diff --git a/tests/cefclient/resources/other_tests.html b/tests/cefclient/resources/other_tests.html index 4571a9dd7..dea666b01 100644 --- a/tests/cefclient/resources/other_tests.html +++ b/tests/cefclient/resources/other_tests.html @@ -13,7 +13,6 @@
  • Draggable Regions
  • DRM (Clearkey, Widevine)
  • Flash Plugin - requires "enable-system-flash" flag on Win/Mac and "ppapi-flash-path", "ppapi-flash-version" flags on Linux
  • -
  • Geolocation
  • HTML5 Feature Test
  • HTML5 Filesystem - requires "cache-path" flag
  • HTML5 Video
  • diff --git a/tests/ceftests/geolocation_unittest.cc b/tests/ceftests/geolocation_unittest.cc deleted file mode 100644 index eea957d90..000000000 --- a/tests/ceftests/geolocation_unittest.cc +++ /dev/null @@ -1,230 +0,0 @@ -// 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. - -#include "include/base/cef_bind.h" -#include "include/cef_geolocation.h" -#include "include/cef_waitable_event.h" -#include "include/wrapper/cef_closure_task.h" -#include "tests/ceftests/test_handler.h" -#include "tests/ceftests/test_util.h" -#include "tests/gtest/include/gtest/gtest.h" - -// Comment in this define if you have configured API keys that enable Google -// Maps Geolocation API support. -// See https://www.chromium.org/developers/how-tos/api-keys for details. -// #define HAS_GEOLOCATION_API_KEYS 1 - -namespace { - -// Geolocation access is now restricted to "secure" origins. -const char* kTestOrigin = "https://tests/"; -const char* kTestUrl = "https://tests/GeolocationTestHandler"; -const char* kTestAllowUrl = "https://tests/GeolocationTestHandler.Allow"; -const char* kTestDenyUrl = "https://tests/GeolocationTestHandler.Deny"; -const char* kTestCancelUrl = "https://tests/GeolocationTestHandler.Cancel"; - -enum TestMode { - TEST_ALLOW, - TEST_DENY, - TEST_CANCEL, -}; - -class GeolocationTestHandler : public TestHandler { - public: - GeolocationTestHandler(const TestMode& mode, bool async) - : mode_(mode), async_(async), request_id_(-1) {} - - void RunTest() override { - std::string html = - "TEST START"; - AddResource(kTestUrl, html, "text/html"); - - std::string end_html = "TEST END"; - AddResource(kTestAllowUrl, end_html, "text/html"); - AddResource(kTestDenyUrl, end_html, "text/html"); - AddResource(kTestCancelUrl, end_html, "text/html"); - - // Create the browser - CreateBrowser(kTestUrl); - - // Time out the test after a reasonable period of time. - SetTestTimeout(); - } - - void OnLoadEnd(CefRefPtr browser, - CefRefPtr frame, - int httpStatusCode) override { - std::string url = frame->GetURL(); - if (url != kTestUrl) { - if (url == kTestAllowUrl) - got_allow_.yes(); - else if (url == kTestDenyUrl) - got_deny_.yes(); - else if (url == kTestCancelUrl) - got_cancel_.yes(); - - DestroyTest(); - } - } - - void ExecuteCallback(CefRefPtr callback) { - if (mode_ == TEST_ALLOW) - callback->Continue(true); - else if (mode_ == TEST_DENY) - callback->Continue(false); - } - - bool OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) override { - got_requestgeolocationpermission_.yes(); - - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); - - EXPECT_STREQ(kTestOrigin, requesting_url.ToString().c_str()); - request_id_ = request_id; - - if (!async_) { - ExecuteCallback(callback); - } else { - CefPostTask(TID_UI, base::Bind(&GeolocationTestHandler::ExecuteCallback, - this, callback)); - } - - return true; - } - - void OnCancelGeolocationPermission(CefRefPtr browser, - int request_id) override { - got_cancelgeolocationpermission_.yes(); - - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); - - EXPECT_EQ(request_id, request_id_); - } - - void DestroyTest() override { - EXPECT_TRUE(got_requestgeolocationpermission_); - if (mode_ == TEST_CANCEL) - EXPECT_TRUE(got_cancelgeolocationpermission_); - else - EXPECT_FALSE(got_cancelgeolocationpermission_); - - TestHandler::DestroyTest(); - } - - TestMode mode_; - bool async_; - - int request_id_; - - TrackCallback got_requestgeolocationpermission_; - TrackCallback got_cancelgeolocationpermission_; - TrackCallback got_allow_; - TrackCallback got_cancel_; - TrackCallback got_deny_; - - IMPLEMENT_REFCOUNTING(GeolocationTestHandler); -}; - -} // namespace - -TEST(GeolocationTest, HandlerAllow) { - CefRefPtr handler = - new GeolocationTestHandler(TEST_ALLOW, false); - handler->ExecuteTest(); -#if defined(HAS_GEOLOCATION_API_KEYS) - EXPECT_TRUE(handler->got_allow_); -#else - EXPECT_FALSE(handler->got_allow_); -#endif - ReleaseAndWaitForDestructor(handler); -} - -TEST(GeolocationTest, HandlerAllowAsync) { - CefRefPtr handler = - new GeolocationTestHandler(TEST_ALLOW, true); - handler->ExecuteTest(); -#if defined(HAS_GEOLOCATION_API_KEYS) - EXPECT_TRUE(handler->got_allow_); -#else - EXPECT_FALSE(handler->got_allow_); -#endif - ReleaseAndWaitForDestructor(handler); -} - -TEST(GeolocationTest, HandlerDeny) { - CefRefPtr handler = - new GeolocationTestHandler(TEST_DENY, false); - handler->ExecuteTest(); - EXPECT_TRUE(handler->got_deny_); - ReleaseAndWaitForDestructor(handler); -} - -TEST(GeolocationTest, HandlerDenyAsync) { - CefRefPtr handler = - new GeolocationTestHandler(TEST_DENY, true); - handler->ExecuteTest(); - EXPECT_TRUE(handler->got_deny_); - ReleaseAndWaitForDestructor(handler); -} - -TEST(GeolocationTest, HandlerCancel) { - CefRefPtr handler = - new GeolocationTestHandler(TEST_CANCEL, false); - handler->ExecuteTest(); - EXPECT_TRUE(handler->got_cancel_); - ReleaseAndWaitForDestructor(handler); -} - -namespace { - -class TestGetGeolocationCallback : public CefGetGeolocationCallback { - public: - explicit TestGetGeolocationCallback(CefRefPtr event) - : event_(event) {} - - void OnLocationUpdate(const CefGeoposition& position) override { - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); -#if defined(HAS_GEOLOCATION_API_KEYS) - EXPECT_EQ(GEOPOSITON_ERROR_NONE, position.error_code); -#else - EXPECT_EQ(GEOPOSITON_ERROR_POSITION_UNAVAILABLE, position.error_code); -#endif - EXPECT_NE(0.0, position.latitude); - EXPECT_NE(0.0, position.longitude); - EXPECT_NE(0.0, position.accuracy); - EXPECT_NE(0, position.timestamp.year); - event_->Signal(); - } - - private: - CefRefPtr event_; - - IMPLEMENT_REFCOUNTING(TestGetGeolocationCallback); -}; - -} // namespace - -TEST(GeolocationTest, GetGeolocation) { - CefRefPtr event = - CefWaitableEvent::CreateWaitableEvent(true, false); - CefGetGeolocation(new TestGetGeolocationCallback(event)); - event->Wait(); -} diff --git a/tests/ceftests/test_handler.h b/tests/ceftests/test_handler.h index 6aeaf11ad..c0dc699b6 100644 --- a/tests/ceftests/test_handler.h +++ b/tests/ceftests/test_handler.h @@ -59,7 +59,6 @@ class TestHandler : public CefClient, public CefDisplayHandler, public CefDownloadHandler, public CefDragHandler, - public CefGeolocationHandler, public CefJSDialogHandler, public CefLifeSpanHandler, public CefLoadHandler, @@ -156,9 +155,6 @@ class TestHandler : public CefClient, CefRefPtr GetDisplayHandler() override { return this; } CefRefPtr GetDownloadHandler() override { return this; } CefRefPtr GetDragHandler() override { return this; } - CefRefPtr GetGeolocationHandler() override { - return this; - } CefRefPtr GetJSDialogHandler() override { return this; } CefRefPtr GetLifeSpanHandler() override { return this; } CefRefPtr GetLoadHandler() override { return this; }