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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 622793002: Group the different permission related methods in the content api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index af2f25ea772cb1cd3164bd62df31f95f629ca097..519169de34d48d0db653e169fd6e9f40d72bc422 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -992,14 +992,22 @@ void RenderFrameHostImpl::OnRunBeforeUnloadConfirm(
void RenderFrameHostImpl::OnRequestPlatformNotificationPermission(
const GURL& origin, int request_id) {
- base::Callback<void(blink::WebNotificationPermission)> done_callback =
+ base::Callback<void(bool)> done_callback =
base::Bind(
&RenderFrameHostImpl::PlatformNotificationPermissionRequestDone,
weak_ptr_factory_.GetWeakPtr(),
request_id);
- GetContentClient()->browser()->RequestDesktopNotificationPermission(
- origin, this, done_callback);
+ if (!delegate()->GetAsWebContents())
+ return;
+
+ // TODO(peter) plumb user_gesture and bridge_id.
Bernhard Bauer 2014/10/20 14:57:24 Nit: Standard syntax for TODOs has a colon after t
Peter Beverloo 2014/10/20 17:32:16 What is a |bridge_id|? The renderer part of notifi
Miguel Garcia 2014/10/21 17:17:12 I asked Takashi about it a while ago as well. Quot
+ GetContentClient()->browser()->RequestPermission(
+ content::PERMISSION_NOTIFICATIONS,
+ delegate()->GetAsWebContents(),
+ -1 /* bridge id */,
+ origin, true /* user_gesture */,
+ done_callback);
}
void RenderFrameHostImpl::OnShowDesktopNotification(
@@ -1413,7 +1421,11 @@ void RenderFrameHostImpl::CommitNavigation(
}
void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone(
- int request_id, blink::WebNotificationPermission permission) {
+ int request_id, bool granted) {
+ blink::WebNotificationPermission permission = granted ?
+ blink::WebNotificationPermissionAllowed :
+ blink::WebNotificationPermissionDenied;
+
Send(new PlatformNotificationMsg_PermissionRequestComplete(
routing_id_, request_id, permission));
}

Powered by Google App Engine
This is Rietveld 408576698