summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-13 16:49:01 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-13 16:49:01 +0000
commit487974a82e46f4b716f4f893f3f47a9b0884611b (patch)
tree3cb49c41576cd8fea67ef4e1564bdf3830167f85
parentac592955fdf45e9bb3a8b8b8b462091faf0d631b (diff)
downloadchromium_src-487974a82e46f4b716f4f893f3f47a9b0884611b.zip
chromium_src-487974a82e46f4b716f4f893f3f47a9b0884611b.tar.gz
chromium_src-487974a82e46f4b716f4f893f3f47a9b0884611b.tar.bz2
Simplify geolocation permission request in the Content API.
This is the model I used for notifications and will use for other features as they move from RenderView to RenderFrame. BUG=304341 R=avi@chromium.org, mkosiba@chromium.org Review URL: https://codereview.chromium.org/330143002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277038 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--android_webview/browser/aw_browser_context.cc9
-rw-r--r--android_webview/browser/aw_browser_context.h5
-rw-r--r--android_webview/browser/aw_content_browser_client.cc19
-rw-r--r--android_webview/browser/aw_content_browser_client.h7
-rw-r--r--android_webview/browser/aw_contents_client_bridge_base.h6
-rw-r--r--android_webview/browser/jni_dependency_factory.h3
-rw-r--r--android_webview/lib/main/aw_main_delegate.cc7
-rw-r--r--android_webview/lib/main/aw_main_delegate.h2
-rw-r--r--android_webview/native/aw_contents_client_bridge.cc35
-rw-r--r--android_webview/native/aw_contents_client_bridge.h5
-rw-r--r--android_webview/native/aw_geolocation_permission_context.cc49
-rw-r--r--android_webview/native/aw_geolocation_permission_context.h42
-rw-r--r--android_webview/native/webview_native.gyp2
-rw-r--r--chrome/browser/chrome_content_browser_client.cc26
-rw-r--r--chrome/browser/chrome_content_browser_client.h22
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context.cc (renamed from chrome/browser/geolocation/chrome_geolocation_permission_context.cc)78
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context.h (renamed from chrome/browser/geolocation/chrome_geolocation_permission_context.h)45
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context_android.cc (renamed from chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc)37
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context_android.h (renamed from chrome/browser/geolocation/chrome_geolocation_permission_context_android.h)22
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context_extensions.cc (renamed from chrome/browser/geolocation/chrome_geolocation_permission_context_extensions.cc)14
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context_extensions.h (renamed from chrome/browser/geolocation/chrome_geolocation_permission_context_extensions.h)14
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context_factory.cc (renamed from chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc)38
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context_factory.h (renamed from chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h)22
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context_unittest.cc (renamed from chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc)41
-rw-r--r--chrome/browser/geolocation/geolocation_prefs.cc1
-rw-r--r--chrome/browser/guest_view/web_view/web_view_guest.cc30
-rw-r--r--chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc4
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.cc7
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.h2
-rw-r--r--chrome/browser/profiles/profile_impl.cc7
-rw-r--r--chrome/browser/profiles/profile_impl.h2
-rw-r--r--chrome/browser/ui/app_list/test/fake_profile.cc5
-rw-r--r--chrome/browser/ui/app_list/test/fake_profile.h3
-rw-r--r--chrome/chrome_browser.gypi16
-rw-r--r--chrome/chrome_tests_unit.gypi2
-rw-r--r--chrome/test/base/testing_profile.cc7
-rw-r--r--chrome/test/base/testing_profile.h2
-rw-r--r--content/browser/download/download_manager_impl_unittest.cc2
-rw-r--r--content/browser/geolocation/geolocation_dispatcher_host.cc103
-rw-r--r--content/browser/geolocation/geolocation_dispatcher_host.h24
-rw-r--r--content/content_browser.gypi1
-rw-r--r--content/public/browser/browser_context.h5
-rw-r--r--content/public/browser/content_browser_client.cc22
-rw-r--r--content/public/browser/content_browser_client.h42
-rw-r--r--content/public/browser/geolocation_permission_context.h48
-rw-r--r--content/public/test/test_browser_context.cc5
-rw-r--r--content/public/test/test_browser_context.h2
-rw-r--r--content/shell/browser/shell_browser_context.cc5
-rw-r--r--content/shell/browser/shell_browser_context.h2
49 files changed, 422 insertions, 477 deletions
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc
index 660e662..92df40b 100644
--- a/android_webview/browser/aw_browser_context.cc
+++ b/android_webview/browser/aw_browser_context.cc
@@ -300,15 +300,6 @@ AwBrowserContext::GetDownloadManagerDelegate() {
return &download_manager_delegate_;
}
-content::GeolocationPermissionContext*
-AwBrowserContext::GetGeolocationPermissionContext() {
- if (!geolocation_permission_context_.get()) {
- geolocation_permission_context_ =
- native_factory_->CreateGeolocationPermission(this);
- }
- return geolocation_permission_context_.get();
-}
-
content::BrowserPluginGuestManager* AwBrowserContext::GetGuestManager() {
return NULL;
}
diff --git a/android_webview/browser/aw_browser_context.h b/android_webview/browser/aw_browser_context.h
index 63793c5..5e1e2f6 100644
--- a/android_webview/browser/aw_browser_context.h
+++ b/android_webview/browser/aw_browser_context.h
@@ -16,7 +16,6 @@
#include "components/visitedlink/browser/visitedlink_delegate.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
-#include "content/public/browser/geolocation_permission_context.h"
#include "net/url_request/url_request_job_factory.h"
class GURL;
@@ -125,8 +124,6 @@ class AwBrowserContext : public content::BrowserContext,
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
virtual content::DownloadManagerDelegate*
GetDownloadManagerDelegate() OVERRIDE;
- virtual content::GeolocationPermissionContext*
- GetGeolocationPermissionContext() OVERRIDE;
virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
@@ -144,8 +141,6 @@ class AwBrowserContext : public content::BrowserContext,
JniDependencyFactory* native_factory_;
scoped_refptr<net::CookieStore> cookie_store_;
scoped_refptr<AwURLRequestContextGetter> url_request_context_getter_;
- scoped_refptr<content::GeolocationPermissionContext>
- geolocation_permission_context_;
scoped_refptr<AwQuotaManagerBridge> quota_manager_bridge_;
scoped_ptr<AwFormDatabaseService> form_database_service_;
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc
index 7c3dc65..bb48653 100644
--- a/android_webview/browser/aw_content_browser_client.cc
+++ b/android_webview/browser/aw_content_browser_client.cc
@@ -386,6 +386,25 @@ void AwContentBrowserClient::ShowDesktopNotification(
NOTREACHED() << "Android WebView does not support desktop notifications.";
}
+void AwContentBrowserClient::RequestGeolocationPermission(
+ content::WebContents* web_contents,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool user_gesture,
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback) {
+ AwContentsClientBridgeBase* client =
+ AwContentsClientBridgeBase::FromWebContents(web_contents);
+ if (client) {
+ client->RequestGeolocationPermission(
+ web_contents, requesting_frame, result_callback, cancel_callback);
+ } else {
+ LOG(WARNING) << "Failed to find the associated bridge for geolocation "
+ << "permission request.";
+ result_callback.Run(false);
+ }
+}
+
bool AwContentBrowserClient::CanCreateWindow(
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h
index bf4abd2..bee7034 100644
--- a/android_webview/browser/aw_content_browser_client.h
+++ b/android_webview/browser/aw_content_browser_client.h
@@ -119,6 +119,13 @@ class AwContentBrowserClient : public content::ContentBrowserClient {
content::RenderFrameHost* render_frame_host,
content::DesktopNotificationDelegate* delegate,
base::Closure* cancel_callback) OVERRIDE;
+ virtual void RequestGeolocationPermission(
+ content::WebContents* web_contents,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool user_gesture,
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback) OVERRIDE;
virtual bool CanCreateWindow(const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
diff --git a/android_webview/browser/aw_contents_client_bridge_base.h b/android_webview/browser/aw_contents_client_bridge_base.h
index a24aa4b..1ce1542 100644
--- a/android_webview/browser/aw_contents_client_bridge_base.h
+++ b/android_webview/browser/aw_contents_client_bridge_base.h
@@ -65,6 +65,12 @@ class AwContentsClientBridgeBase {
= 0;
virtual bool ShouldOverrideUrlLoading(const base::string16& url) = 0;
+
+ virtual void RequestGeolocationPermission(
+ content::WebContents* web_contents,
+ const GURL& requesting_frame,
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback) = 0;
};
} // namespace android_webview
diff --git a/android_webview/browser/jni_dependency_factory.h b/android_webview/browser/jni_dependency_factory.h
index d0b6f72..983ef2a 100644
--- a/android_webview/browser/jni_dependency_factory.h
+++ b/android_webview/browser/jni_dependency_factory.h
@@ -9,7 +9,6 @@
namespace content {
class ExternalVideoSurfaceContainer;
-class GeolocationPermissionContext;
class WebContents;
class WebContentsViewDelegate;
} // namespace content
@@ -27,8 +26,6 @@ class JniDependencyFactory {
virtual scoped_refptr<AwQuotaManagerBridge> CreateAwQuotaManagerBridge(
AwBrowserContext* browser_context) = 0;
- virtual content::GeolocationPermissionContext* CreateGeolocationPermission(
- AwBrowserContext* browser_context) = 0;
virtual content::WebContentsViewDelegate* CreateViewDelegate(
content::WebContents* web_contents) = 0;
virtual AwWebPreferencesPopulater* CreateWebPreferencesPopulater() = 0;
diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc
index 1acb2a6..9f6d91c 100644
--- a/android_webview/lib/main/aw_main_delegate.cc
+++ b/android_webview/lib/main/aw_main_delegate.cc
@@ -10,7 +10,6 @@
#include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h"
#include "android_webview/common/aw_switches.h"
#include "android_webview/lib/aw_browser_dependency_factory_impl.h"
-#include "android_webview/native/aw_geolocation_permission_context.h"
#include "android_webview/native/aw_quota_manager_bridge_impl.h"
#include "android_webview/native/aw_web_contents_view_delegate.h"
#include "android_webview/native/aw_web_preferences_populater_impl.h"
@@ -148,12 +147,6 @@ scoped_refptr<AwQuotaManagerBridge> AwMainDelegate::CreateAwQuotaManagerBridge(
return AwQuotaManagerBridgeImpl::Create(browser_context);
}
-content::GeolocationPermissionContext*
- AwMainDelegate::CreateGeolocationPermission(
- AwBrowserContext* browser_context) {
- return AwGeolocationPermissionContext::Create(browser_context);
-}
-
content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate(
content::WebContents* web_contents) {
return AwWebContentsViewDelegate::Create(web_contents);
diff --git a/android_webview/lib/main/aw_main_delegate.h b/android_webview/lib/main/aw_main_delegate.h
index 93a116c..856d699 100644
--- a/android_webview/lib/main/aw_main_delegate.h
+++ b/android_webview/lib/main/aw_main_delegate.h
@@ -45,8 +45,6 @@ class AwMainDelegate : public content::ContentMainDelegate,
// JniDependencyFactory implementation.
virtual scoped_refptr<AwQuotaManagerBridge> CreateAwQuotaManagerBridge(
AwBrowserContext* browser_context) OVERRIDE;
- virtual content::GeolocationPermissionContext* CreateGeolocationPermission(
- AwBrowserContext* browser_context) OVERRIDE;
virtual content::WebContentsViewDelegate* CreateViewDelegate(
content::WebContents* web_contents) OVERRIDE;
virtual AwWebPreferencesPopulater* CreateWebPreferencesPopulater() OVERRIDE;
diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc
index efb5a85..a241e40 100644
--- a/android_webview/native/aw_contents_client_bridge.cc
+++ b/android_webview/native/aw_contents_client_bridge.cc
@@ -5,11 +5,15 @@
#include "android_webview/native/aw_contents_client_bridge.h"
#include "android_webview/common/devtools_instrumentation.h"
+#include "android_webview/native/aw_contents.h"
#include "base/android/jni_android.h"
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/callback_helpers.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
#include "jni/AwContentsClientBridge_jni.h"
#include "net/android/keystore_openssl.h"
#include "net/cert/x509_certificate.h"
@@ -42,6 +46,15 @@ void RecordClientCertificateKey(
client_cert.get(), private_key.get());
}
+void CancelGeolocationPermission(int render_process_id,
+ int render_view_id,
+ const GURL& requesting_frame) {
+ AwContents* aw_contents = AwContents::FromID(
+ render_process_id, render_view_id);
+ if (aw_contents)
+ aw_contents->HideGeolocationPrompt(requesting_frame);
+}
+
} // namespace
AwContentsClientBridge::AwContentsClientBridge(JNIEnv* env, jobject obj)
@@ -336,6 +349,28 @@ bool AwContentsClientBridge::ShouldOverrideUrlLoading(
jurl.obj());
}
+void AwContentsClientBridge::RequestGeolocationPermission(
+ content::WebContents* web_contents,
+ const GURL& requesting_frame,
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback) {
+ AwContents* aw_contents = AwContents::FromWebContents(web_contents);
+ if (!aw_contents) {
+ result_callback.Run(false);
+ return;
+ }
+
+ if (cancel_callback) {
+ *cancel_callback = base::Bind(
+ CancelGeolocationPermission,
+ web_contents->GetRenderProcessHost()->GetID(),
+ web_contents->GetRenderViewHost()->GetRoutingID(),
+ requesting_frame);
+ }
+
+ aw_contents->ShowGeolocationPrompt(requesting_frame, result_callback);
+}
+
void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env,
jobject,
int id,
diff --git a/android_webview/native/aw_contents_client_bridge.h b/android_webview/native/aw_contents_client_bridge.h
index 3c97f33..cb51ec1 100644
--- a/android_webview/native/aw_contents_client_bridge.h
+++ b/android_webview/native/aw_contents_client_bridge.h
@@ -55,6 +55,11 @@ class AwContentsClientBridge : public AwContentsClientBridgeBase {
const content::JavaScriptDialogManager::DialogClosedCallback& callback)
OVERRIDE;
virtual bool ShouldOverrideUrlLoading(const base::string16& url) OVERRIDE;
+ virtual void RequestGeolocationPermission(
+ content::WebContents* web_contents,
+ const GURL& requesting_frame,
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback) OVERRIDE;
// Methods called from Java.
void ProceedSslError(JNIEnv* env, jobject obj, jboolean proceed, jint id);
diff --git a/android_webview/native/aw_geolocation_permission_context.cc b/android_webview/native/aw_geolocation_permission_context.cc
deleted file mode 100644
index 11d9140..0000000
--- a/android_webview/native/aw_geolocation_permission_context.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2012 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 "android_webview/native/aw_geolocation_permission_context.h"
-
-#include "android_webview/native/aw_contents.h"
-#include "base/bind.h"
-#include "base/callback.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
-
-namespace android_webview {
-
-AwGeolocationPermissionContext::~AwGeolocationPermissionContext() {
-}
-
-void AwGeolocationPermissionContext::RequestGeolocationPermission(
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame,
- bool user_gesture,
- base::Callback<void(bool)> callback) {
- AwContents* aw_contents = AwContents::FromWebContents(web_contents);
- if (!aw_contents) {
- callback.Run(false);
- return;
- }
- aw_contents->ShowGeolocationPrompt(requesting_frame, callback);
-}
-
-// static
-content::GeolocationPermissionContext*
-AwGeolocationPermissionContext::Create(AwBrowserContext* browser_context) {
- return new AwGeolocationPermissionContext();
-}
-
-void AwGeolocationPermissionContext::CancelGeolocationPermissionRequest(
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame) {
- AwContents* aw_contents = AwContents::FromWebContents(web_contents);
- if (aw_contents) {
- aw_contents->HideGeolocationPrompt(requesting_frame);
- }
-}
-
-} // namespace android_webview
diff --git a/android_webview/native/aw_geolocation_permission_context.h b/android_webview/native/aw_geolocation_permission_context.h
deleted file mode 100644
index 2ad18a6..0000000
--- a/android_webview/native/aw_geolocation_permission_context.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2012 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 ANDROID_WEBVIEW_NATIVE_AW_GEOLOCATION_PERMISSION_CONTEXT_H_
-#define ANDROID_WEBVIEW_NATIVE_AW_GEOLOCATION_PERMISSION_CONTEXT_H_
-
-#include "content/public/browser/geolocation_permission_context.h"
-
-class GURL;
-
-namespace android_webview {
-
-class AwBrowserContext;
-
-class AwGeolocationPermissionContext :
- public content::GeolocationPermissionContext {
- public:
- static content::GeolocationPermissionContext* Create(
- AwBrowserContext* browser_context);
-
- // content::GeolocationPermissionContext implementation
- virtual void RequestGeolocationPermission(
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame,
- bool user_gesture,
- base::Callback<void(bool)> callback) OVERRIDE;
- virtual void CancelGeolocationPermissionRequest(
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame) OVERRIDE;
-
- protected:
- virtual ~AwGeolocationPermissionContext();
-
- private:
-};
-
-} // namespace android_webview
-
-#endif // ANDROID_WEBVIEW_NATIVE_AW_GEOLOCATION_PERMISSION_CONTEXT_H_
diff --git a/android_webview/native/webview_native.gyp b/android_webview/native/webview_native.gyp
index 67aa94e..48a2a40 100644
--- a/android_webview/native/webview_native.gyp
+++ b/android_webview/native/webview_native.gyp
@@ -52,8 +52,6 @@
'aw_dev_tools_server.h',
'aw_form_database.cc',
'aw_form_database.h',
- 'aw_geolocation_permission_context.cc',
- 'aw_geolocation_permission_context.h',
'aw_http_auth_handler.cc',
'aw_http_auth_handler.h',
'aw_pdf_exporter.cc',
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 28c9c13..c9edb55 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -41,6 +41,8 @@
#include "chrome/browser/extensions/extension_webkit_preferences.h"
#include "chrome/browser/extensions/suggest_permission_util.h"
#include "chrome/browser/geolocation/chrome_access_token_store.h"
+#include "chrome/browser/geolocation/geolocation_permission_context.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/media/cast_transport_host_filter.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
@@ -2142,6 +2144,20 @@ void ChromeContentBrowserClient::ShowDesktopNotification(
#endif
}
+void ChromeContentBrowserClient::RequestGeolocationPermission(
+ content::WebContents* web_contents,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool user_gesture,
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback) {
+ GeolocationPermissionContextFactory::GetForProfile(
+ Profile::FromBrowserContext(web_contents->GetBrowserContext()))->
+ RequestGeolocationPermission(web_contents, bridge_id,
+ requesting_frame, user_gesture,
+ result_callback, cancel_callback);
+}
+
bool ChromeContentBrowserClient::CanCreateWindow(
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
@@ -2709,6 +2725,11 @@ void ChromeContentBrowserClient::PreSpawnRenderer(
}
#endif
+content::DevToolsManagerDelegate*
+ChromeContentBrowserClient::GetDevToolsManagerDelegate() {
+ return new ChromeDevToolsManagerDelegate();
+}
+
bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
content::BrowserContext* browser_context,
const GURL& url) {
@@ -2748,11 +2769,6 @@ bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs() {
#endif
}
-content::DevToolsManagerDelegate*
-ChromeContentBrowserClient::GetDevToolsManagerDelegate() {
- return new ChromeDevToolsManagerDelegate();
-}
-
net::CookieStore*
ChromeContentBrowserClient::OverrideCookieStoreForRenderProcess(
int render_process_id) {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index dc314f0..b1a073b 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -209,6 +209,13 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
content::RenderFrameHost* render_frame_host,
content::DesktopNotificationDelegate* delegate,
base::Closure* cancel_callback) OVERRIDE;
+ virtual void RequestGeolocationPermission(
+ content::WebContents* web_contents,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool user_gesture,
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback) OVERRIDE;
virtual bool CanCreateWindow(const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
@@ -264,6 +271,12 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
ScopedVector<fileapi::FileSystemBackend>* additional_backends) OVERRIDE;
virtual content::DevToolsManagerDelegate*
GetDevToolsManagerDelegate() OVERRIDE;
+ virtual bool IsPluginAllowedToCallRequestOSFileHandle(
+ content::BrowserContext* browser_context,
+ const GURL& url) OVERRIDE;
+ virtual bool IsPluginAllowedToUseDevChannelAPIs() OVERRIDE;
+ virtual net::CookieStore* OverrideCookieStoreForRenderProcess(
+ int render_process_id) OVERRIDE;
#if defined(OS_POSIX) && !defined(OS_MACOSX)
virtual void GetAdditionalMappedFilesForChildProcess(
@@ -277,15 +290,6 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
bool* success) OVERRIDE;
#endif
- virtual bool IsPluginAllowedToCallRequestOSFileHandle(
- content::BrowserContext* browser_context,
- const GURL& url) OVERRIDE;
-
- virtual bool IsPluginAllowedToUseDevChannelAPIs() OVERRIDE;
-
- virtual net::CookieStore* OverrideCookieStoreForRenderProcess(
- int render_process_id) OVERRIDE;
-
private:
#if defined(ENABLE_WEBRTC)
// Copies disable WebRTC encryption switch depending on the channel.
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/geolocation_permission_context.cc
index b8e38ac..ca97bfa 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
+#include "chrome/browser/geolocation/geolocation_permission_context.h"
#include <functional>
#include <string>
@@ -30,13 +30,12 @@
class GeolocationPermissionRequest : public PermissionBubbleRequest {
public:
- GeolocationPermissionRequest(
- ChromeGeolocationPermissionContext* context,
- const PermissionRequestID& id,
- const GURL& requesting_frame,
- bool user_gesture,
- base::Callback<void(bool)> callback,
- const std::string& display_languages);
+ GeolocationPermissionRequest(GeolocationPermissionContext* context,
+ const PermissionRequestID& id,
+ const GURL& requesting_frame,
+ bool user_gesture,
+ base::Callback<void(bool)> callback,
+ const std::string& display_languages);
virtual ~GeolocationPermissionRequest();
// PermissionBubbleDelegate:
@@ -51,7 +50,7 @@ class GeolocationPermissionRequest : public PermissionBubbleRequest {
virtual void RequestFinished() OVERRIDE;
private:
- ChromeGeolocationPermissionContext* context_;
+ GeolocationPermissionContext* context_;
PermissionRequestID id_;
GURL requesting_frame_;
bool user_gesture_;
@@ -60,7 +59,7 @@ class GeolocationPermissionRequest : public PermissionBubbleRequest {
};
GeolocationPermissionRequest::GeolocationPermissionRequest(
- ChromeGeolocationPermissionContext* context,
+ GeolocationPermissionContext* context,
const PermissionRequestID& id,
const GURL& requesting_frame,
bool user_gesture,
@@ -113,32 +112,39 @@ void GeolocationPermissionRequest::RequestFinished() {
}
-ChromeGeolocationPermissionContext::ChromeGeolocationPermissionContext(
+GeolocationPermissionContext::GeolocationPermissionContext(
Profile* profile)
: profile_(profile),
shutting_down_(false),
extensions_context_(profile) {
}
-ChromeGeolocationPermissionContext::~ChromeGeolocationPermissionContext() {
- // ChromeGeolocationPermissionContext may be destroyed on either the UI thread
+GeolocationPermissionContext::~GeolocationPermissionContext() {
+ // GeolocationPermissionContext may be destroyed on either the UI thread
// or the IO thread, but the PermissionQueueController must have been
// destroyed on the UI thread.
DCHECK(!permission_queue_controller_.get());
}
-void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
+void GeolocationPermissionContext::RequestGeolocationPermission(
content::WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
- base::Callback<void(bool)> callback) {
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback) {
GURL requesting_frame_origin = requesting_frame.GetOrigin();
if (shutting_down_)
return;
int render_process_id = web_contents->GetRenderProcessHost()->GetID();
int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
+ if (cancel_callback) {
+ *cancel_callback = base::Bind(
+ &GeolocationPermissionContext::CancelGeolocationPermissionRequest,
+ this, render_process_id, render_view_id, bridge_id);
+ }
+
const PermissionRequestID id(
render_process_id, render_view_id, bridge_id, GURL());
@@ -146,9 +152,9 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
bool new_permission;
if (extensions_context_.RequestPermission(
web_contents, id, bridge_id, requesting_frame, user_gesture,
- callback, &permission_set, &new_permission)) {
+ result_callback, &permission_set, &new_permission)) {
if (permission_set) {
- NotifyPermissionSet(id, requesting_frame_origin, callback,
+ NotifyPermissionSet(id, requesting_frame_origin, result_callback,
new_permission);
}
return;
@@ -159,28 +165,28 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
LOG(WARNING) << "Attempt to use geolocation from an invalid URL: "
<< requesting_frame_origin << "," << embedder
<< " (geolocation is not supported in popups)";
- NotifyPermissionSet(id, requesting_frame_origin, callback, false);
+ NotifyPermissionSet(id, requesting_frame_origin, result_callback, false);
return;
}
DecidePermission(web_contents, id, requesting_frame_origin, user_gesture,
- embedder, "", callback);
+ embedder, "", result_callback);
}
-void ChromeGeolocationPermissionContext::CancelGeolocationPermissionRequest(
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame) {
+void GeolocationPermissionContext::CancelGeolocationPermissionRequest(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id) {
+ content::WebContents* web_contents = tab_util::GetWebContentsByID(
+ render_process_id, render_view_id);
if (extensions_context_.CancelPermissionRequest(web_contents, bridge_id))
return;
- int render_process_id = web_contents->GetRenderProcessHost()->GetID();
- int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
CancelPendingInfobarRequest(PermissionRequestID(
render_process_id, render_view_id, bridge_id, GURL()));
}
-void ChromeGeolocationPermissionContext::DecidePermission(
+void GeolocationPermissionContext::DecidePermission(
content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame,
@@ -219,13 +225,13 @@ void ChromeGeolocationPermissionContext::DecidePermission(
QueueController()->CreateInfoBarRequest(
id, requesting_frame, embedder, accept_button_label,
base::Bind(
- &ChromeGeolocationPermissionContext::NotifyPermissionSet,
+ &GeolocationPermissionContext::NotifyPermissionSet,
base::Unretained(this), id, requesting_frame, callback));
}
}
}
-void ChromeGeolocationPermissionContext::CreateInfoBarRequest(
+void GeolocationPermissionContext::CreateInfoBarRequest(
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
@@ -233,11 +239,11 @@ void ChromeGeolocationPermissionContext::CreateInfoBarRequest(
base::Callback<void(bool)> callback) {
QueueController()->CreateInfoBarRequest(
id, requesting_frame, embedder, accept_button_label, base::Bind(
- &ChromeGeolocationPermissionContext::NotifyPermissionSet,
+ &GeolocationPermissionContext::NotifyPermissionSet,
base::Unretained(this), id, requesting_frame, callback));
}
-void ChromeGeolocationPermissionContext::RequestFinished(
+void GeolocationPermissionContext::RequestFinished(
GeolocationPermissionRequest* request) {
base::ScopedPtrHashMap<std::string,
GeolocationPermissionRequest>::iterator it;
@@ -250,13 +256,13 @@ void ChromeGeolocationPermissionContext::RequestFinished(
}
-void ChromeGeolocationPermissionContext::ShutdownOnUIThread() {
+void GeolocationPermissionContext::ShutdownOnUIThread() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
permission_queue_controller_.reset();
shutting_down_ = true;
}
-void ChromeGeolocationPermissionContext::PermissionDecided(
+void GeolocationPermissionContext::PermissionDecided(
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
@@ -265,7 +271,7 @@ void ChromeGeolocationPermissionContext::PermissionDecided(
NotifyPermissionSet(id, requesting_frame, callback, allowed);
}
-void ChromeGeolocationPermissionContext::NotifyPermissionSet(
+void GeolocationPermissionContext::NotifyPermissionSet(
const PermissionRequestID& id,
const GURL& requesting_frame,
base::Callback<void(bool)> callback,
@@ -285,7 +291,7 @@ void ChromeGeolocationPermissionContext::NotifyPermissionSet(
}
PermissionQueueController*
- ChromeGeolocationPermissionContext::QueueController() {
+ GeolocationPermissionContext::QueueController() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(!shutting_down_);
if (!permission_queue_controller_)
@@ -294,13 +300,13 @@ PermissionQueueController*
}
PermissionQueueController*
- ChromeGeolocationPermissionContext::CreateQueueController() {
+ GeolocationPermissionContext::CreateQueueController() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
return new PermissionQueueController(profile(),
CONTENT_SETTINGS_TYPE_GEOLOCATION);
}
-void ChromeGeolocationPermissionContext::CancelPendingInfobarRequest(
+void GeolocationPermissionContext::CancelPendingInfobarRequest(
const PermissionRequestID& id) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (shutting_down_)
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.h b/chrome/browser/geolocation/geolocation_permission_context.h
index a4b2c75..b5d7d90 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context.h
+++ b/chrome/browser/geolocation/geolocation_permission_context.h
@@ -2,17 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_
-#define CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_
+#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
+#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
#include <map>
#include <string>
+#include "base/callback.h"
#include "base/containers/scoped_ptr_hash_map.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/content_settings/permission_queue_controller.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_extensions.h"
-#include "content/public/browser/geolocation_permission_context.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_extensions.h"
namespace content {
class WebContents;
@@ -22,25 +23,21 @@ class GeolocationPermissionRequest;
class PermissionRequestID;
class Profile;
-// Chrome specific implementation of GeolocationPermissionContext; manages
-// Geolocation permissions flow, and delegates UI handling via
+// This manages Geolocation permissions flow, and delegates UI handling via
// PermissionQueueController.
-class ChromeGeolocationPermissionContext
- : public content::GeolocationPermissionContext {
+class GeolocationPermissionContext
+ : public base::RefCountedThreadSafe<GeolocationPermissionContext> {
public:
- explicit ChromeGeolocationPermissionContext(Profile* profile);
+ explicit GeolocationPermissionContext(Profile* profile);
- // GeolocationPermissionContext:
- virtual void RequestGeolocationPermission(
+ // See ContentBrowserClient method of the same name.
+ void RequestGeolocationPermission(
content::WebContents* web_contents,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
- base::Callback<void(bool)> callback) OVERRIDE;
- virtual void CancelGeolocationPermissionRequest(
- content::WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame) OVERRIDE;
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback);
// Called on the UI thread when the profile is about to be destroyed.
void ShutdownOnUIThread();
@@ -55,7 +52,7 @@ class ChromeGeolocationPermissionContext
bool allowed);
protected:
- virtual ~ChromeGeolocationPermissionContext();
+ virtual ~GeolocationPermissionContext();
Profile* profile() const { return profile_; }
@@ -63,7 +60,12 @@ class ChromeGeolocationPermissionContext
// if necessary.
PermissionQueueController* QueueController();
- // ChromeGeolocationPermissionContext implementation:
+ void CancelGeolocationPermissionRequest(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id);
+
+ // GeolocationPermissionContext implementation:
// Decide whether the geolocation permission should be granted.
// Calls PermissionDecided if permission can be decided non-interactively,
// or NotifyPermissionSet if permission decided by presenting an
@@ -91,6 +93,7 @@ class ChromeGeolocationPermissionContext
virtual PermissionQueueController* CreateQueueController();
private:
+ friend class base::RefCountedThreadSafe<GeolocationPermissionContext>;
friend class GeolocationPermissionRequest;
// Removes any pending InfoBar request.
@@ -110,12 +113,12 @@ class ChromeGeolocationPermissionContext
Profile* const profile_;
bool shutting_down_;
scoped_ptr<PermissionQueueController> permission_queue_controller_;
- ChromeGeolocationPermissionContextExtensions extensions_context_;
+ GeolocationPermissionContextExtensions extensions_context_;
base::ScopedPtrHashMap<std::string, GeolocationPermissionRequest>
pending_requests_;
- DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContext);
+ DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext);
};
-#endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_
+#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc b/chrome/browser/geolocation/geolocation_permission_context_android.cc
index 39654e6..bd85715 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_android.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_android.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_android.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/android/google_location_settings_helper.h"
@@ -11,35 +11,34 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
-ChromeGeolocationPermissionContextAndroid::
+GeolocationPermissionContextAndroid::
PermissionRequestInfo::PermissionRequestInfo()
: id(0, 0, 0, GURL()),
user_gesture(false) {}
-ChromeGeolocationPermissionContextAndroid::
- ChromeGeolocationPermissionContextAndroid(Profile* profile)
- : ChromeGeolocationPermissionContext(profile),
+GeolocationPermissionContextAndroid::
+ GeolocationPermissionContextAndroid(Profile* profile)
+ : GeolocationPermissionContext(profile),
google_location_settings_helper_(
GoogleLocationSettingsHelper::Create()) {
}
-ChromeGeolocationPermissionContextAndroid::
- ~ChromeGeolocationPermissionContextAndroid() {
+GeolocationPermissionContextAndroid::~GeolocationPermissionContextAndroid() {
}
-void ChromeGeolocationPermissionContextAndroid::ProceedDecidePermission(
+void GeolocationPermissionContextAndroid::ProceedDecidePermission(
content::WebContents* web_contents,
const PermissionRequestInfo& info,
const std::string& accept_button_label,
base::Callback<void(bool)> callback) {
// Super class implementation expects everything in UI thread instead.
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- ChromeGeolocationPermissionContext::DecidePermission(
+ GeolocationPermissionContext::DecidePermission(
web_contents, info.id, info.requesting_frame, info.user_gesture,
info.embedder, accept_button_label, callback);
}
-void ChromeGeolocationPermissionContextAndroid::CheckMasterLocation(
+void GeolocationPermissionContextAndroid::CheckMasterLocation(
content::WebContents* web_contents,
const PermissionRequestInfo& info,
base::Callback<void(bool)> callback) {
@@ -50,16 +49,16 @@ void ChromeGeolocationPermissionContextAndroid::CheckMasterLocation(
google_location_settings_helper_->IsMasterLocationSettingEnabled();
// The flow for geolocation permission on android is:
- // - ChromeGeolocationPermissionContextAndroid::DecidePermission
+ // - GeolocationPermissionContextAndroid::DecidePermission
// intercepts the flow in the UI thread, and posts task
// to the blocking pool to CheckMasterLocation (in order to
// avoid strict-mode violation).
// - At this point the master location permission is either:
// -- enabled, in which we case it proceeds the normal flow
- // via ChromeGeolocationPermissionContext (which may create infobars, etc.).
+ // via GeolocationPermissionContext (which may create infobars, etc.).
// -- disabled, in which case the permission is already decided.
//
- // In either case, ChromeGeolocationPermissionContext expects these
+ // In either case, GeolocationPermissionContext expects these
// in the UI thread.
base::Closure ui_closure;
if (enabled) {
@@ -67,11 +66,11 @@ void ChromeGeolocationPermissionContextAndroid::CheckMasterLocation(
std::string accept_button_label =
google_location_settings_helper_->GetAcceptButtonLabel(allow_label);
ui_closure = base::Bind(
- &ChromeGeolocationPermissionContextAndroid::ProceedDecidePermission,
+ &GeolocationPermissionContextAndroid::ProceedDecidePermission,
this, web_contents, info, accept_button_label, callback);
} else {
ui_closure = base::Bind(
- &ChromeGeolocationPermissionContextAndroid::PermissionDecided,
+ &GeolocationPermissionContextAndroid::PermissionDecided,
this, info.id, info.requesting_frame, info.embedder, callback, false);
}
@@ -81,7 +80,7 @@ void ChromeGeolocationPermissionContextAndroid::CheckMasterLocation(
content::BrowserThread::UI, FROM_HERE, ui_closure);
}
-void ChromeGeolocationPermissionContextAndroid::DecidePermission(
+void GeolocationPermissionContextAndroid::DecidePermission(
content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame,
@@ -101,11 +100,11 @@ void ChromeGeolocationPermissionContextAndroid::DecidePermission(
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
content::BrowserThread::PostBlockingPoolTask(FROM_HERE,
base::Bind(
- &ChromeGeolocationPermissionContextAndroid::CheckMasterLocation,
+ &GeolocationPermissionContextAndroid::CheckMasterLocation,
this, web_contents, info, callback));
}
-void ChromeGeolocationPermissionContextAndroid::PermissionDecided(
+void GeolocationPermissionContextAndroid::PermissionDecided(
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
@@ -121,6 +120,6 @@ void ChromeGeolocationPermissionContextAndroid::PermissionDecided(
return;
}
- ChromeGeolocationPermissionContext::PermissionDecided(
+ GeolocationPermissionContext::PermissionDecided(
id, requesting_frame, embedder, callback, allowed);
}
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_android.h b/chrome/browser/geolocation/geolocation_permission_context_android.h
index cd8e69d..24337f9 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_android.h
+++ b/chrome/browser/geolocation/geolocation_permission_context_android.h
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
-#define CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
+#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
+#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
#include "chrome/browser/content_settings/permission_request_id.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
+#include "chrome/browser/geolocation/geolocation_permission_context.h"
#include "url/gurl.h"
namespace content {
@@ -17,10 +17,10 @@ class GoogleLocationSettingsHelper;
// Android-specific geolocation permission flow, taking into account the
// Google Location Settings, if available.
-class ChromeGeolocationPermissionContextAndroid
- : public ChromeGeolocationPermissionContext {
+class GeolocationPermissionContextAndroid
+ : public GeolocationPermissionContext {
public:
- explicit ChromeGeolocationPermissionContextAndroid(Profile* profile);
+ explicit GeolocationPermissionContextAndroid(Profile* profile);
private:
struct PermissionRequestInfo {
@@ -32,11 +32,11 @@ class ChromeGeolocationPermissionContextAndroid
GURL embedder;
};
- friend class ChromeGeolocationPermissionContext;
+ friend class GeolocationPermissionContext;
- virtual ~ChromeGeolocationPermissionContextAndroid();
+ virtual ~GeolocationPermissionContextAndroid();
- // ChromeGeolocationPermissionContext implementation:
+ // GeolocationPermissionContext implementation:
virtual void DecidePermission(content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame,
@@ -63,7 +63,7 @@ class ChromeGeolocationPermissionContextAndroid
const PermissionRequestInfo& info,
base::Callback<void(bool)> callback);
- DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContextAndroid);
+ DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid);
};
-#endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
+#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_extensions.cc b/chrome/browser/geolocation/geolocation_permission_context_extensions.cc
index 3aeae2a..8a99a39 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_extensions.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_extensions.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_extensions.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_extensions.h"
#include "base/callback.h"
@@ -20,16 +20,16 @@ using extensions::APIPermission;
using extensions::ExtensionRegistry;
#endif
-ChromeGeolocationPermissionContextExtensions::
-ChromeGeolocationPermissionContextExtensions(Profile* profile)
+GeolocationPermissionContextExtensions::
+GeolocationPermissionContextExtensions(Profile* profile)
: profile_(profile) {
}
-ChromeGeolocationPermissionContextExtensions::
-~ChromeGeolocationPermissionContextExtensions() {
+GeolocationPermissionContextExtensions::
+~GeolocationPermissionContextExtensions() {
}
-bool ChromeGeolocationPermissionContextExtensions::RequestPermission(
+bool GeolocationPermissionContextExtensions::RequestPermission(
content::WebContents* web_contents,
const PermissionRequestID& request_id,
int bridge_id,
@@ -87,7 +87,7 @@ bool ChromeGeolocationPermissionContextExtensions::RequestPermission(
return false;
}
-bool ChromeGeolocationPermissionContextExtensions::CancelPermissionRequest(
+bool GeolocationPermissionContextExtensions::CancelPermissionRequest(
content::WebContents* web_contents,
int bridge_id) {
#if defined(ENABLE_EXTENSIONS)
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_extensions.h b/chrome/browser/geolocation/geolocation_permission_context_extensions.h
index d7ac9f4..e073b14 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_extensions.h
+++ b/chrome/browser/geolocation/geolocation_permission_context_extensions.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_EXTENSIONS_H_
-#define CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_EXTENSIONS_H_
+#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_EXTENSIONS_H_
+#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_EXTENSIONS_H_
#include "base/callback_forward.h"
#include "base/macros.h"
@@ -17,10 +17,10 @@ class PermissionRequestID;
class Profile;
// Chrome extensions specific portions of GeolocationPermissionContext.
-class ChromeGeolocationPermissionContextExtensions {
+class GeolocationPermissionContextExtensions {
public:
- explicit ChromeGeolocationPermissionContextExtensions(Profile* profile);
- ~ChromeGeolocationPermissionContextExtensions();
+ explicit GeolocationPermissionContextExtensions(Profile* profile);
+ ~GeolocationPermissionContextExtensions();
// Returns true if the permission request was handled. In which case,
// |permission_set| will be set to true if the permission changed, and the
@@ -41,7 +41,7 @@ class ChromeGeolocationPermissionContextExtensions {
private:
Profile* profile_;
- DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContextExtensions);
+ DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextExtensions);
};
-#endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_EXTENSIONS_H_
+#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_EXTENSIONS_H_
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc b/chrome/browser/geolocation/geolocation_permission_context_factory.cc
index 55450da..a4d9c8a 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_factory.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
@@ -10,9 +10,9 @@
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/pref_registry/pref_registry_syncable.h"
#if defined(OS_ANDROID)
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_android.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_android.h"
#else
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
+#include "chrome/browser/geolocation/geolocation_permission_context.h"
#endif
namespace {
@@ -21,13 +21,13 @@ class Service : public KeyedService {
public:
explicit Service(Profile* profile) {
#if defined(OS_ANDROID)
- context_ = new ChromeGeolocationPermissionContextAndroid(profile);
+ context_ = new GeolocationPermissionContextAndroid(profile);
#else
- context_ = new ChromeGeolocationPermissionContext(profile);
+ context_ = new GeolocationPermissionContext(profile);
#endif
}
- ChromeGeolocationPermissionContext* context() {
+ GeolocationPermissionContext* context() {
return context_.get();
}
@@ -36,7 +36,7 @@ class Service : public KeyedService {
}
private:
- scoped_refptr<ChromeGeolocationPermissionContext> context_;
+ scoped_refptr<GeolocationPermissionContext> context_;
DISALLOW_COPY_AND_ASSIGN(Service);
};
@@ -44,36 +44,34 @@ class Service : public KeyedService {
} // namespace
// static
-ChromeGeolocationPermissionContext*
-ChromeGeolocationPermissionContextFactory::GetForProfile(Profile* profile) {
+GeolocationPermissionContext*
+GeolocationPermissionContextFactory::GetForProfile(Profile* profile) {
return static_cast<Service*>(
GetInstance()->GetServiceForBrowserContext(profile, true))->context();
}
// static
-ChromeGeolocationPermissionContextFactory*
-ChromeGeolocationPermissionContextFactory::GetInstance() {
- return Singleton<ChromeGeolocationPermissionContextFactory>::get();
+GeolocationPermissionContextFactory*
+GeolocationPermissionContextFactory::GetInstance() {
+ return Singleton<GeolocationPermissionContextFactory>::get();
}
-ChromeGeolocationPermissionContextFactory::
-ChromeGeolocationPermissionContextFactory()
+GeolocationPermissionContextFactory::GeolocationPermissionContextFactory()
: BrowserContextKeyedServiceFactory(
- "ChromeGeolocationPermissionContext",
+ "GeolocationPermissionContext",
BrowserContextDependencyManager::GetInstance()) {
}
-ChromeGeolocationPermissionContextFactory::
-~ChromeGeolocationPermissionContextFactory() {
+GeolocationPermissionContextFactory::~GeolocationPermissionContextFactory() {
}
KeyedService*
-ChromeGeolocationPermissionContextFactory::BuildServiceInstanceFor(
+GeolocationPermissionContextFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const {
return new Service(static_cast<Profile*>(profile));
}
-void ChromeGeolocationPermissionContextFactory::RegisterProfilePrefs(
+void GeolocationPermissionContextFactory::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
#if defined(OS_ANDROID)
registry->RegisterBooleanPref(
@@ -84,7 +82,7 @@ void ChromeGeolocationPermissionContextFactory::RegisterProfilePrefs(
}
content::BrowserContext*
-ChromeGeolocationPermissionContextFactory::GetBrowserContextToUse(
+GeolocationPermissionContextFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
return chrome::GetBrowserContextOwnInstanceInIncognito(context);
}
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h b/chrome/browser/geolocation/geolocation_permission_context_factory.h
index a7a006a..778771a 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h
+++ b/chrome/browser/geolocation/geolocation_permission_context_factory.h
@@ -2,31 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_FACTORY_H_
-#define CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_FACTORY_H_
+#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_FACTORY_H_
+#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_FACTORY_H_
#include "base/memory/singleton.h"
#include "base/prefs/pref_service.h"
#include "base/values.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
-class ChromeGeolocationPermissionContext;
+class GeolocationPermissionContext;
class PrefRegistrySyncable;
class Profile;
-class ChromeGeolocationPermissionContextFactory
+class GeolocationPermissionContextFactory
: public BrowserContextKeyedServiceFactory {
public:
- static ChromeGeolocationPermissionContext* GetForProfile(Profile* profile);
+ static GeolocationPermissionContext* GetForProfile(Profile* profile);
- static ChromeGeolocationPermissionContextFactory* GetInstance();
+ static GeolocationPermissionContextFactory* GetInstance();
private:
friend struct
- DefaultSingletonTraits<ChromeGeolocationPermissionContextFactory>;
+ DefaultSingletonTraits<GeolocationPermissionContextFactory>;
- ChromeGeolocationPermissionContextFactory();
- virtual ~ChromeGeolocationPermissionContextFactory();
+ GeolocationPermissionContextFactory();
+ virtual ~GeolocationPermissionContextFactory();
// BrowserContextKeyedBaseFactory methods:
virtual KeyedService* BuildServiceInstanceFor(
@@ -36,7 +36,7 @@ class ChromeGeolocationPermissionContextFactory
virtual content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const OVERRIDE;
- DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContextFactory);
+ DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextFactory);
};
-#endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_FACTORY_H_
+#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_FACTORY_H_
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
index 57d8050..f011ac3 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
+#include "chrome/browser/geolocation/geolocation_permission_context.h"
#include <set>
#include <string>
@@ -17,7 +17,7 @@
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/permission_request_id.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
@@ -115,9 +115,10 @@ class GeolocationPermissionContextTests
void RequestGeolocationPermission(content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame);
- void CancelGeolocationPermissionRequest(content::WebContents* web_contents,
- const PermissionRequestID& id,
- const GURL& requesting_frame);
+ void RequestGeolocationPermission(content::WebContents* web_contents,
+ const PermissionRequestID& id,
+ const GURL& requesting_frame,
+ base::Closure* cancel_callback);
void PermissionResponse(const PermissionRequestID& id,
bool allowed);
void CheckPermissionMessageSent(int bridge_id, bool allowed);
@@ -129,8 +130,7 @@ class GeolocationPermissionContextTests
void CheckTabContentsState(const GURL& requesting_frame,
ContentSetting expected_content_setting);
- scoped_refptr<ChromeGeolocationPermissionContext>
- geolocation_permission_context_;
+ scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_;
ClosedInfoBarTracker closed_infobar_tracker_;
ScopedVector<content::WebContents> extra_tabs_;
@@ -162,22 +162,23 @@ void GeolocationPermissionContextTests::RequestGeolocationPermission(
content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame) {
+ RequestGeolocationPermission(web_contents, id, requesting_frame, NULL);
+}
+
+void GeolocationPermissionContextTests::RequestGeolocationPermission(
+ content::WebContents* web_contents,
+ const PermissionRequestID& id,
+ const GURL& requesting_frame,
+ base::Closure* cancel_callback) {
geolocation_permission_context_->RequestGeolocationPermission(
web_contents, id.bridge_id(), requesting_frame, false,
base::Bind(&GeolocationPermissionContextTests::PermissionResponse,
- base::Unretained(this), id));
+ base::Unretained(this), id),
+ cancel_callback);
content::BrowserThread::GetBlockingPool()->FlushForTesting();
base::RunLoop().RunUntilIdle();
}
-void GeolocationPermissionContextTests::CancelGeolocationPermissionRequest(
- content::WebContents* web_contents,
- const PermissionRequestID& id,
- const GURL& requesting_frame) {
- geolocation_permission_context_->CancelGeolocationPermissionRequest(
- web_contents, id.bridge_id(), requesting_frame);
-}
-
void GeolocationPermissionContextTests::PermissionResponse(
const PermissionRequestID& id,
bool allowed) {
@@ -251,7 +252,7 @@ void GeolocationPermissionContextTests::SetUp() {
MockGoogleLocationSettingsHelper::SetLocationStatus(true, true);
#endif
geolocation_permission_context_ =
- ChromeGeolocationPermissionContextFactory::GetForProfile(profile());
+ GeolocationPermissionContextFactory::GetForProfile(profile());
}
void GeolocationPermissionContextTests::TearDown() {
@@ -477,8 +478,9 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
NavigateAndCommit(requesting_frame_0);
EXPECT_EQ(0U, infobar_service()->infobar_count());
// Request permission for two frames.
+ base::Closure cancel_callback;
RequestGeolocationPermission(
- web_contents(), RequestID(0), requesting_frame_0);
+ web_contents(), RequestID(0), requesting_frame_0, &cancel_callback);
RequestGeolocationPermission(
web_contents(), RequestID(1), requesting_frame_1);
ASSERT_EQ(1U, infobar_service()->infobar_count());
@@ -491,8 +493,7 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
// Simulate the frame going away, ensure the infobar for this frame
// is removed and the next pending infobar is created.
- CancelGeolocationPermissionRequest(
- web_contents(), RequestID(0), requesting_frame_0);
+ cancel_callback.Run();
EXPECT_EQ(1U, closed_infobar_tracker_.size());
EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_0));
closed_infobar_tracker_.Clear();
diff --git a/chrome/browser/geolocation/geolocation_prefs.cc b/chrome/browser/geolocation/geolocation_prefs.cc
index dcfc2ec..3f4fa09 100644
--- a/chrome/browser/geolocation/geolocation_prefs.cc
+++ b/chrome/browser/geolocation/geolocation_prefs.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/geolocation/geolocation_prefs.h"
#include "chrome/browser/geolocation/chrome_access_token_store.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h"
namespace geolocation {
void RegisterPrefs(PrefRegistrySimple* registry) {
diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc
index 0faf2ba..ebd5b05 100644
--- a/chrome/browser/guest_view/web_view/web_view_guest.cc
+++ b/chrome/browser/guest_view/web_view/web_view_guest.cc
@@ -16,6 +16,8 @@
#include "chrome/browser/extensions/menu_manager.h"
#include "chrome/browser/extensions/script_executor.h"
#include "chrome/browser/favicon/favicon_tab_helper.h"
+#include "chrome/browser/geolocation/geolocation_permission_context.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
#include "chrome/browser/guest_view/guest_view_constants.h"
#include "chrome/browser/guest_view/guest_view_manager.h"
#include "chrome/browser/guest_view/web_view/web_view_constants.h"
@@ -26,7 +28,6 @@
#include "chrome/common/render_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
-#include "content/public/browser/geolocation_permission_context.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/navigation_entry.h"
@@ -756,20 +757,19 @@ void WebViewGuest::OnWebViewGeolocationPermissionResponse(
return;
}
- content::GeolocationPermissionContext* geolocation_context =
- browser_context()->GetGeolocationPermissionContext();
-
- DCHECK(geolocation_context);
- geolocation_context->RequestGeolocationPermission(
- embedder_web_contents(),
- // The geolocation permission request here is not initiated
- // through WebGeolocationPermissionRequest. We are only interested
- // in the fact whether the embedder/app has geolocation
- // permission. Therefore we use an invalid |bridge_id|.
- -1 /* bridge_id */,
- embedder_web_contents()->GetLastCommittedURL(),
- user_gesture,
- callback);
+ Profile* profile = Profile::FromBrowserContext(browser_context());
+ GeolocationPermissionContextFactory::GetForProfile(profile)->
+ RequestGeolocationPermission(
+ embedder_web_contents(),
+ // The geolocation permission request here is not initiated
+ // through WebGeolocationPermissionRequest. We are only interested
+ // in the fact whether the embedder/app has geolocation
+ // permission. Therefore we use an invalid |bridge_id|.
+ -1,
+ embedder_web_contents()->GetLastCommittedURL(),
+ user_gesture,
+ callback,
+ NULL);
}
void WebViewGuest::CancelGeolocationPermissionRequest(int bridge_id) {
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
index 69c24b6..764ef42 100644
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
#include "chrome/browser/google/google_url_tracker_factory.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
@@ -163,7 +163,7 @@ EnsureBrowserContextKeyedServiceFactoriesBuilt() {
#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
CaptivePortalServiceFactory::GetInstance();
#endif
- ChromeGeolocationPermissionContextFactory::GetInstance();
+ GeolocationPermissionContextFactory::GetInstance();
#if defined(OS_ANDROID)
ProtectedMediaIdentifierPermissionContextFactory::GetInstance();
#endif
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index 0c349b8..46ca5f5 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -23,8 +23,6 @@
#include "chrome/browser/extensions/api/web_request/web_request_api.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_special_storage_policy.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/media/chrome_midi_permission_context.h"
#include "chrome/browser/media/chrome_midi_permission_context_factory.h"
@@ -421,11 +419,6 @@ HostContentSettingsMap* OffTheRecordProfileImpl::GetHostContentSettingsMap() {
return host_content_settings_map_.get();
}
-content::GeolocationPermissionContext*
- OffTheRecordProfileImpl::GetGeolocationPermissionContext() {
- return ChromeGeolocationPermissionContextFactory::GetForProfile(this);
-}
-
content::BrowserPluginGuestManager*
OffTheRecordProfileImpl::GetGuestManager() {
#if defined(ENABLE_EXTENSIONS)
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h
index bee8ba5..ba65175 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.h
+++ b/chrome/browser/profiles/off_the_record_profile_impl.h
@@ -127,8 +127,6 @@ class OffTheRecordProfileImpl : public Profile {
int render_view_id,
const GURL& origin) OVERRIDE;
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
- virtual content::GeolocationPermissionContext*
- GetGeolocationPermissionContext() OVERRIDE;
virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 1887528..61e591f 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -41,8 +41,6 @@
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_special_storage_policy.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h"
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/media/chrome_midi_permission_context.h"
#include "chrome/browser/media/chrome_midi_permission_context_factory.h"
@@ -1069,11 +1067,6 @@ HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() {
return host_content_settings_map_.get();
}
-content::GeolocationPermissionContext*
- ProfileImpl::GetGeolocationPermissionContext() {
- return ChromeGeolocationPermissionContextFactory::GetForProfile(this);
-}
-
content::BrowserPluginGuestManager* ProfileImpl::GetGuestManager() {
#if defined(ENABLE_EXTENSIONS)
return GuestViewManager::FromBrowserContext(this);
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index d93f22c..6ca51a4 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -101,8 +101,6 @@ class ProfileImpl : public Profile {
int render_view_id,
const GURL& origin) OVERRIDE;
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
- virtual content::GeolocationPermissionContext*
- GetGeolocationPermissionContext() OVERRIDE;
virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
diff --git a/chrome/browser/ui/app_list/test/fake_profile.cc b/chrome/browser/ui/app_list/test/fake_profile.cc
index a96923f..2f78133 100644
--- a/chrome/browser/ui/app_list/test/fake_profile.cc
+++ b/chrome/browser/ui/app_list/test/fake_profile.cc
@@ -89,11 +89,6 @@ content::ResourceContext* FakeProfile::GetResourceContext() {
return NULL;
}
-content::GeolocationPermissionContext*
-FakeProfile::GetGeolocationPermissionContext() {
- return NULL;
-}
-
content::BrowserPluginGuestManager* FakeProfile::GetGuestManager() {
return NULL;
}
diff --git a/chrome/browser/ui/app_list/test/fake_profile.h b/chrome/browser/ui/app_list/test/fake_profile.h
index fa93c36..135887f 100644
--- a/chrome/browser/ui/app_list/test/fake_profile.h
+++ b/chrome/browser/ui/app_list/test/fake_profile.h
@@ -20,7 +20,6 @@ class URLRequestContextGetter;
namespace content {
class DownloadManagerDelegate;
-class GeolocationPermissionContext;
class ResourceContext;
}
@@ -67,8 +66,6 @@ class FakeProfile : public Profile {
int render_view_id,
const GURL& origin) OVERRIDE;
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
- virtual content::GeolocationPermissionContext*
- GetGeolocationPermissionContext() OVERRIDE;
virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 66f237f..99322a5 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -683,18 +683,18 @@
'browser/fullscreen_win.cc',
'browser/geolocation/chrome_access_token_store.cc',
'browser/geolocation/chrome_access_token_store.h',
- 'browser/geolocation/chrome_geolocation_permission_context.cc',
- 'browser/geolocation/chrome_geolocation_permission_context.h',
- 'browser/geolocation/chrome_geolocation_permission_context_android.cc',
- 'browser/geolocation/chrome_geolocation_permission_context_android.h',
- 'browser/geolocation/chrome_geolocation_permission_context_extensions.cc',
- 'browser/geolocation/chrome_geolocation_permission_context_extensions.h',
- 'browser/geolocation/chrome_geolocation_permission_context_factory.cc',
- 'browser/geolocation/chrome_geolocation_permission_context_factory.h',
'browser/geolocation/geolocation_infobar_delegate.cc',
'browser/geolocation/geolocation_infobar_delegate.h',
'browser/geolocation/geolocation_infobar_delegate_android.cc',
'browser/geolocation/geolocation_infobar_delegate_android.h',
+ 'browser/geolocation/geolocation_permission_context.cc',
+ 'browser/geolocation/geolocation_permission_context.h',
+ 'browser/geolocation/geolocation_permission_context_android.cc',
+ 'browser/geolocation/geolocation_permission_context_android.h',
+ 'browser/geolocation/geolocation_permission_context_extensions.cc',
+ 'browser/geolocation/geolocation_permission_context_extensions.h',
+ 'browser/geolocation/geolocation_permission_context_factory.cc',
+ 'browser/geolocation/geolocation_permission_context_factory.h',
'browser/geolocation/geolocation_prefs.cc',
'browser/geolocation/geolocation_prefs.h',
'browser/global_keyboard_shortcuts_mac.h',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 393b6fd..0029d73 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -999,7 +999,7 @@
'browser/favicon/favicon_handler_unittest.cc',
'browser/file_select_helper_unittest.cc',
'browser/first_run/first_run_unittest.cc',
- 'browser/geolocation/chrome_geolocation_permission_context_unittest.cc',
+ 'browser/geolocation/geolocation_permission_context_unittest.cc',
'browser/global_keyboard_shortcuts_mac_unittest.mm',
'browser/google/google_search_counter_unittest.cc',
'browser/google/google_update_settings_unittest.cc',
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 7ac610a..5fcbb10 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -26,8 +26,6 @@
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/favicon/favicon_service.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
-#include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h"
#include "chrome/browser/history/chrome_history_client.h"
#include "chrome/browser/history/chrome_history_client_factory.h"
#include "chrome/browser/history/history_backend.h"
@@ -834,11 +832,6 @@ HostContentSettingsMap* TestingProfile::GetHostContentSettingsMap() {
return host_content_settings_map_.get();
}
-content::GeolocationPermissionContext*
-TestingProfile::GetGeolocationPermissionContext() {
- return ChromeGeolocationPermissionContextFactory::GetForProfile(this);
-}
-
content::BrowserPluginGuestManager* TestingProfile::GetGuestManager() {
#if defined(ENABLE_EXTENSIONS)
return GuestViewManager::FromBrowserContext(this);
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index 33905f1..26a2ecd 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -215,8 +215,6 @@ class TestingProfile : public Profile {
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
int renderer_child_id) OVERRIDE;
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
- virtual content::GeolocationPermissionContext*
- GetGeolocationPermissionContext() OVERRIDE;
virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc
index 180dab1..536cdfa 100644
--- a/content/browser/download/download_manager_impl_unittest.cc
+++ b/content/browser/download/download_manager_impl_unittest.cc
@@ -436,8 +436,6 @@ class MockBrowserContext : public BrowserContext {
const GURL& origin));
MOCK_METHOD0(GetResourceContext, ResourceContext*());
MOCK_METHOD0(GetDownloadManagerDelegate, DownloadManagerDelegate*());
- MOCK_METHOD0(GetGeolocationPermissionContext,
- GeolocationPermissionContext* ());
MOCK_METHOD0(GetGuestManager, BrowserPluginGuestManager* ());
MOCK_METHOD0(GetSpecialStoragePolicy, quota::SpecialStoragePolicy*());
MOCK_METHOD0(GetPushMessagingService, PushMessagingService*());
diff --git a/content/browser/geolocation/geolocation_dispatcher_host.cc b/content/browser/geolocation/geolocation_dispatcher_host.cc
index aec2170..ad1f2fc 100644
--- a/content/browser/geolocation/geolocation_dispatcher_host.cc
+++ b/content/browser/geolocation/geolocation_dispatcher_host.cc
@@ -14,7 +14,7 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
-#include "content/public/browser/geolocation_permission_context.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/common/geoposition.h"
#include "content/common/geolocation_messages.h"
@@ -64,27 +64,25 @@ void RecordGeopositionErrorCode(Geoposition::ErrorCode error_code) {
GEOPOSITION_ERROR_CODE_COUNT);
}
-void SendGeolocationPermissionResponse(int render_process_id,
- int render_frame_id,
- int bridge_id,
- bool allowed) {
- RenderFrameHost* render_frame_host =
- RenderFrameHost::FromID(render_process_id, render_frame_id);
- if (!render_frame_host)
- return;
- render_frame_host->Send(
- new GeolocationMsg_PermissionSet(render_frame_id, bridge_id, allowed));
+} // namespace
- if (allowed)
- GeolocationProviderImpl::GetInstance()->UserDidOptIntoLocationServices();
+GeolocationDispatcherHost::PendingPermission::PendingPermission(
+ int render_frame_id,
+ int render_process_id,
+ int bridge_id)
+ : render_frame_id(render_frame_id),
+ render_process_id(render_process_id),
+ bridge_id(bridge_id) {
}
-} // namespace
+GeolocationDispatcherHost::PendingPermission::~PendingPermission() {
+}
GeolocationDispatcherHost::GeolocationDispatcherHost(
WebContents* web_contents)
: WebContentsObserver(web_contents),
- paused_(false) {
+ paused_(false),
+ weak_factory_(this) {
// This is initialized by WebContentsImpl. Do not add any non-trivial
// initialization here, defer to OnStartUpdating which is triggered whenever
// a javascript geolocation object is actually initialized.
@@ -142,35 +140,39 @@ void GeolocationDispatcherHost::OnRequestPermission(
int bridge_id,
const GURL& requesting_frame,
bool user_gesture) {
- GeolocationPermissionContext* context =
- web_contents()->GetBrowserContext()->GetGeolocationPermissionContext();
int render_process_id = render_frame_host->GetProcess()->GetID();
int render_frame_id = render_frame_host->GetRoutingID();
- if (context) {
- context->RequestGeolocationPermission(
- web_contents(),
- bridge_id,
- requesting_frame,
- user_gesture,
- base::Bind(&SendGeolocationPermissionResponse,
- render_process_id,
- render_frame_id,
- bridge_id));
- } else {
- SendGeolocationPermissionResponse(
- render_process_id, render_frame_id, bridge_id, true);
- }
+
+ PendingPermission pending_permission(
+ render_frame_id, render_process_id, bridge_id);
+ pending_permissions_.push_back(pending_permission);
+
+ GetContentClient()->browser()->RequestGeolocationPermission(
+ web_contents(),
+ bridge_id,
+ requesting_frame,
+ user_gesture,
+ base::Bind(&GeolocationDispatcherHost::SendGeolocationPermissionResponse,
+ weak_factory_.GetWeakPtr(),
+ render_process_id, render_frame_id, bridge_id),
+ &pending_permissions_.back().cancel);
}
void GeolocationDispatcherHost::OnCancelPermissionRequest(
RenderFrameHost* render_frame_host,
int bridge_id,
const GURL& requesting_frame) {
- GeolocationPermissionContext* context =
- web_contents()->GetBrowserContext()->GetGeolocationPermissionContext();
- if (context) {
- context->CancelGeolocationPermissionRequest(
- web_contents(), bridge_id, requesting_frame);
+ int render_process_id = render_frame_host->GetProcess()->GetID();
+ int render_frame_id = render_frame_host->GetRoutingID();
+ for (size_t i = 0; i < pending_permissions_.size(); ++i) {
+ if (pending_permissions_[i].render_process_id == render_process_id &&
+ pending_permissions_[i].render_frame_id == render_frame_id &&
+ pending_permissions_[i].bridge_id == bridge_id) {
+ if (!pending_permissions_[i].cancel.is_null())
+ pending_permissions_[i].cancel.Run();
+ pending_permissions_.erase(pending_permissions_.begin() + i);
+ return;
+ }
}
}
@@ -223,4 +225,33 @@ void GeolocationDispatcherHost::RefreshGeolocationOptions() {
high_accuracy);
}
+void GeolocationDispatcherHost::SendGeolocationPermissionResponse(
+ int render_process_id,
+ int render_frame_id,
+ int bridge_id,
+ bool allowed) {
+ for (size_t i = 0; i < pending_permissions_.size(); ++i) {
+ if (pending_permissions_[i].render_process_id == render_process_id &&
+ pending_permissions_[i].render_frame_id == render_frame_id &&
+ pending_permissions_[i].bridge_id == bridge_id) {
+ RenderFrameHost* render_frame_host =
+ RenderFrameHost::FromID(render_process_id, render_frame_id);
+ if (render_frame_host) {
+ render_frame_host->Send(new GeolocationMsg_PermissionSet(
+ render_frame_id, bridge_id, allowed));
+ }
+
+ if (allowed) {
+ GeolocationProviderImpl::GetInstance()->
+ UserDidOptIntoLocationServices();
+ }
+
+ pending_permissions_.erase(pending_permissions_.begin() + i);
+ return;
+ }
+ }
+
+ NOTREACHED();
+}
+
} // namespace content
diff --git a/content/browser/geolocation/geolocation_dispatcher_host.h b/content/browser/geolocation/geolocation_dispatcher_host.h
index 151ed46..e8bda40 100644
--- a/content/browser/geolocation/geolocation_dispatcher_host.h
+++ b/content/browser/geolocation/geolocation_dispatcher_host.h
@@ -6,7 +6,10 @@
#define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_
#include <map>
+#include <vector>
+#include "base/callback_forward.h"
+#include "base/memory/weak_ptr.h"
#include "content/browser/geolocation/geolocation_provider_impl.h"
#include "content/public/browser/web_contents_observer.h"
@@ -14,8 +17,6 @@ class GURL;
namespace content {
-class GeolocationPermissionContext;
-
// GeolocationDispatcherHost is an observer for Geolocation messages.
// It's the complement of GeolocationDispatcher (owned by RenderView).
class GeolocationDispatcherHost : public WebContentsObserver {
@@ -56,15 +57,32 @@ class GeolocationDispatcherHost : public WebContentsObserver {
void OnLocationUpdate(const Geoposition& position);
- scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_;
+ void SendGeolocationPermissionResponse(int render_process_id,
+ int render_frame_id,
+ int bridge_id,
+ bool allowed);
// A map from the RenderFrameHosts that have requested geolocation updates to
// the type of accuracy they requested (true = high accuracy).
std::map<RenderFrameHost*, bool> updating_frames_;
bool paused_;
+ struct PendingPermission {
+ PendingPermission(int render_frame_id,
+ int render_process_id,
+ int bridge_id);
+ ~PendingPermission();
+ int render_frame_id;
+ int render_process_id;
+ int bridge_id;
+ base::Closure cancel;
+ };
+ std::vector<PendingPermission> pending_permissions_;
+
scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_;
+ base::WeakPtrFactory<GeolocationDispatcherHost> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost);
};
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 1499af8..ee4d290 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -119,7 +119,6 @@
'public/browser/favicon_status.h',
'public/browser/file_descriptor_info.h',
'public/browser/font_list_async.h',
- 'public/browser/geolocation_permission_context.h',
'public/browser/geolocation_provider.h',
'public/browser/global_request_id.h',
'public/browser/gpu_data_manager.h',
diff --git a/content/public/browser/browser_context.h b/content/public/browser/browser_context.h
index a34fd8d..984f6ef 100644
--- a/content/public/browser/browser_context.h
+++ b/content/public/browser/browser_context.h
@@ -35,7 +35,6 @@ class BlobHandle;
class BrowserPluginGuestManager;
class DownloadManager;
class DownloadManagerDelegate;
-class GeolocationPermissionContext;
class IndexedDBContext;
class PushMessagingService;
class ResourceContext;
@@ -175,10 +174,6 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
// ensuring that it outlives DownloadManager. It's valid to return NULL.
virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0;
- // Returns the geolocation permission context for this context. It's valid to
- // return NULL, in which case geolocation requests will always be allowed.
- virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0;
-
// Returns the guest manager for this context.
virtual BrowserPluginGuestManager* GetGuestManager() = 0;
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 1fea540..58beabc 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -211,6 +211,16 @@ blink::WebNotificationPresenter::Permission
return blink::WebNotificationPresenter::PermissionAllowed;
}
+void ContentBrowserClient::RequestGeolocationPermission(
+ WebContents* web_contents,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool user_gesture,
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback) {
+ result_callback.Run(true);
+}
+
bool ContentBrowserClient::CanCreateWindow(
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
@@ -290,12 +300,6 @@ DevToolsManagerDelegate* ContentBrowserClient::GetDevToolsManagerDelegate() {
return NULL;
}
-#if defined(OS_WIN)
-const wchar_t* ContentBrowserClient::GetResourceDllName() {
- return NULL;
-}
-#endif
-
bool ContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
BrowserContext* browser_context,
const GURL& url) {
@@ -311,6 +315,12 @@ net::CookieStore* ContentBrowserClient::OverrideCookieStoreForRenderProcess(
return NULL;
}
+#if defined(OS_WIN)
+const wchar_t* ContentBrowserClient::GetResourceDllName() {
+ return NULL;
+}
+#endif
+
#if defined(VIDEO_HOLE)
ExternalVideoSurfaceContainer*
ContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer(
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index e9b0e88..e69484a 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -468,6 +468,18 @@ class CONTENT_EXPORT ContentBrowserClient {
DesktopNotificationDelegate* delegate,
base::Closure* cancel_callback) {}
+ // The renderer is requesting permission to use Geolocation. When the answer
+ // to a permission request has been determined, |result_callback| should be
+ // called with the result. If |cancel_callback| is non-null, it's set to a
+ // callback which can be used to cancel the permission request.
+ virtual void RequestGeolocationPermission(
+ WebContents* web_contents,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool user_gesture,
+ base::Callback<void(bool)> result_callback,
+ base::Closure* cancel_callback);
+
// Returns true if the given page is allowed to open a window of the given
// type. If true is returned, |no_javascript_access| will indicate whether
// the window that is created should be scriptable/in the same process.
@@ -601,6 +613,21 @@ class CONTENT_EXPORT ContentBrowserClient {
// It's valid to return NULL.
virtual DevToolsManagerDelegate* GetDevToolsManagerDelegate();
+ // Returns true if plugin referred to by the url can use
+ // pp::FileIO::RequestOSFileHandle.
+ virtual bool IsPluginAllowedToCallRequestOSFileHandle(
+ BrowserContext* browser_context,
+ const GURL& url);
+
+ // Returns true if dev channel APIs are available for plugins.
+ virtual bool IsPluginAllowedToUseDevChannelAPIs();
+
+ // Returns a special cookie store to use for a given render process, or NULL
+ // if the default cookie store should be used
+ // This is called on the IO thread.
+ virtual net::CookieStore* OverrideCookieStoreForRenderProcess(
+ int render_process_id);
+
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Populates |mappings| with all files that need to be mapped before launching
// a child process.
@@ -621,21 +648,6 @@ class CONTENT_EXPORT ContentBrowserClient {
bool* success) {}
#endif
- // Returns true if plugin referred to by the url can use
- // pp::FileIO::RequestOSFileHandle.
- virtual bool IsPluginAllowedToCallRequestOSFileHandle(
- BrowserContext* browser_context,
- const GURL& url);
-
- // Returns true if dev channel APIs are available for plugins.
- virtual bool IsPluginAllowedToUseDevChannelAPIs();
-
- // Returns a special cookie store to use for a given render process, or NULL
- // if the default cookie store should be used
- // This is called on the IO thread.
- virtual net::CookieStore* OverrideCookieStoreForRenderProcess(
- int render_process_id);
-
#if defined(VIDEO_HOLE)
// Allows an embedder to provide its own ExternalVideoSurfaceContainer
// implementation. Return NULL to disable external surface video.
diff --git a/content/public/browser/geolocation_permission_context.h b/content/public/browser/geolocation_permission_context.h
deleted file mode 100644
index a97c83f..0000000
--- a/content/public/browser/geolocation_permission_context.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2012 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 CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
-#define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
-
-#include "base/callback.h"
-#include "base/memory/ref_counted.h"
-#include "content/common/content_export.h"
-
-class GURL;
-
-namespace content {
-class WebContents;
-
-// GeolocationPermissionContext must be implemented by the embedder, to provide
-// the policy and logic for the Geolocation permissions flow.
-// This includes both prompting the user and persisting results, as required.
-class CONTENT_EXPORT GeolocationPermissionContext
- : public base::RefCountedThreadSafe<GeolocationPermissionContext> {
- public:
- // The renderer is requesting permission to use Geolocation.
- // When the answer to a permission request has been determined, |callback|
- // should be called with the result.
- virtual void RequestGeolocationPermission(
- WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame,
- bool user_gesture,
- base::Callback<void(bool)> callback) = 0;
-
- // The renderer is cancelling a pending permission request.
- virtual void CancelGeolocationPermissionRequest(
- WebContents* web_contents,
- int bridge_id,
- const GURL& requesting_frame) = 0;
-
- protected:
- virtual ~GeolocationPermissionContext() {}
-
- private:
- friend class base::RefCountedThreadSafe<GeolocationPermissionContext>;
-};
-
-} // namespace content
-
-#endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
diff --git a/content/public/test/test_browser_context.cc b/content/public/test/test_browser_context.cc
index 9faf668..d8d1b40 100644
--- a/content/public/test/test_browser_context.cc
+++ b/content/public/test/test_browser_context.cc
@@ -138,11 +138,6 @@ ResourceContext* TestBrowserContext::GetResourceContext() {
return resource_context_.get();
}
-GeolocationPermissionContext*
- TestBrowserContext::GetGeolocationPermissionContext() {
- return NULL;
-}
-
BrowserPluginGuestManager* TestBrowserContext::GetGuestManager() {
return NULL;
}
diff --git a/content/public/test/test_browser_context.h b/content/public/test/test_browser_context.h
index 1dab388..7ad08af 100644
--- a/content/public/test/test_browser_context.h
+++ b/content/public/test/test_browser_context.h
@@ -62,8 +62,6 @@ class TestBrowserContext : public BrowserContext {
int render_view_id,
const GURL& origin) OVERRIDE;
virtual ResourceContext* GetResourceContext() OVERRIDE;
- virtual GeolocationPermissionContext*
- GetGeolocationPermissionContext() OVERRIDE;
virtual BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
virtual PushMessagingService* GetPushMessagingService() OVERRIDE;
diff --git a/content/shell/browser/shell_browser_context.cc b/content/shell/browser/shell_browser_context.cc
index b4d9539..244c188 100644
--- a/content/shell/browser/shell_browser_context.cc
+++ b/content/shell/browser/shell_browser_context.cc
@@ -230,11 +230,6 @@ ResourceContext* ShellBrowserContext::GetResourceContext() {
return resource_context_.get();
}
-GeolocationPermissionContext*
- ShellBrowserContext::GetGeolocationPermissionContext() {
- return NULL;
-}
-
BrowserPluginGuestManager* ShellBrowserContext::GetGuestManager() {
return guest_manager_;
}
diff --git a/content/shell/browser/shell_browser_context.h b/content/shell/browser/shell_browser_context.h
index 38a8906..7f9ca76 100644
--- a/content/shell/browser/shell_browser_context.h
+++ b/content/shell/browser/shell_browser_context.h
@@ -70,8 +70,6 @@ class ShellBrowserContext : public BrowserContext {
int render_view_id,
const GURL& origin) OVERRIDE;
virtual ResourceContext* GetResourceContext() OVERRIDE;
- virtual GeolocationPermissionContext*
- GetGeolocationPermissionContext() OVERRIDE;
virtual BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
virtual PushMessagingService* GetPushMessagingService() OVERRIDE;