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

Unified Diff: chrome/browser/guest_view/web_view/web_view_permission_helper.cc

Issue 459953002: Migrate geolocation permissions to the new common permission class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
Index: chrome/browser/guest_view/web_view/web_view_permission_helper.cc
diff --git a/chrome/browser/guest_view/web_view/web_view_permission_helper.cc b/chrome/browser/guest_view/web_view/web_view_permission_helper.cc
index c5b0aaa326cce93a1d75ffc1751922fa52876f38..ff02900abc8c89fc2fac6d00bf0dbd9a962f2104 100644
--- a/chrome/browser/guest_view/web_view/web_view_permission_helper.cc
+++ b/chrome/browser/guest_view/web_view/web_view_permission_helper.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/guest_view/web_view/web_view_permission_helper.h"
+#include "chrome/browser/content_settings/permission_request_id.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/geolocation/geolocation_permission_context.h"
#include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
@@ -16,6 +17,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/user_metrics.h"
+#include "content/public/browser/web_contents.h"
using content::BrowserPluginGuestDelegate;
using content::RenderViewHost;
@@ -387,20 +389,29 @@ void WebViewPermissionHelper::OnGeolocationPermissionResponse(
return;
}
+ content::WebContents* web_contents = web_view_guest_->embedder_web_contents();
+ int render_process_id = web_contents->GetRenderProcessHost()->GetID();
+ int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
+
+ const PermissionRequestID request_id(
+ render_process_id,
+ render_view_id,
+ // 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,
+ GURL());
Profile* profile = Profile::FromBrowserContext(
web_view_guest_->browser_context());
GeolocationPermissionContextFactory::GetForProfile(profile)->
- RequestGeolocationPermission(
- web_view_guest_->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,
- web_view_guest_->embedder_web_contents()->GetLastCommittedURL(),
+ RequestPermission(
+ web_contents,
+ request_id,
+ web_view_guest_->embedder_web_contents()
+ ->GetLastCommittedURL().GetOrigin(),
user_gesture,
- callback,
- NULL);
+ callback);
}
void WebViewPermissionHelper::CancelGeolocationPermissionRequest(

Powered by Google App Engine
This is Rietveld 408576698