Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(879)

Unified Diff: chrome/browser/geolocation/chrome_geolocation_permission_context.cc

Issue 235633002: <webview>: Move Geolocation permission to chrome layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed tests in Debug mode Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/guestview/guestview_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/geolocation/chrome_geolocation_permission_context.cc
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
index 711caa4c8383cf7a0282a7ed06bae0057c8a6f22..84f85dfb6f08a94af03f08ab2c7e2a23e89d2625 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/content_settings/permission_request_id.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/extensions/suggest_permission_util.h"
+#include "chrome/browser/guestview/webview/webview_guest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
@@ -157,6 +158,15 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
content::WebContents* web_contents =
tab_util::GetWebContentsByID(render_process_id, render_view_id);
+
+ WebViewGuest* guest = WebViewGuest::FromWebContents(web_contents);
+ if (guest) {
+ guest->RequestGeolocationPermission(bridge_id,
+ requesting_frame,
+ user_gesture,
+ callback);
+ return;
+ }
const PermissionRequestID id(render_process_id, render_view_id, bridge_id, 0);
ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_);
if (extension_registry) {
@@ -206,6 +216,29 @@ void ChromeGeolocationPermissionContext::CancelGeolocationPermissionRequest(
int render_view_id,
int bridge_id,
const GURL& requesting_frame) {
+ if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(
+ &ChromeGeolocationPermissionContext::
+ CancelGeolocationPermissionRequest,
+ this,
+ render_process_id,
+ render_view_id,
+ bridge_id,
+ requesting_frame));
+ return;
+ }
+
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ content::WebContents* web_contents =
+ tab_util::GetWebContentsByID(render_process_id, render_view_id);
+ WebViewGuest* guest =
+ web_contents ? WebViewGuest::FromWebContents(web_contents) : NULL;
+ if (guest) {
+ guest->CancelGeolocationPermissionRequest(bridge_id);
+ return;
+ }
// TODO(gbillock): cancel permission bubble request.
CancelPendingInfobarRequest(PermissionRequestID(
render_process_id, render_view_id, bridge_id, 0));
@@ -314,14 +347,6 @@ PermissionQueueController*
void ChromeGeolocationPermissionContext::CancelPendingInfobarRequest(
const PermissionRequestID& id) {
- if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
- content::BrowserThread::PostTask(
- content::BrowserThread::UI, FROM_HERE,
- base::Bind(
- &ChromeGeolocationPermissionContext::CancelPendingInfobarRequest,
- this, id));
- return;
- }
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (shutting_down_)
return;
« no previous file with comments | « no previous file | chrome/browser/guestview/guestview_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698