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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 376253005: Migrate the notification permission to the new common permission classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index b5fbb68d859c5960913ea8008dfcf513c8448e0d..9051d689b63de176239eaaa9f3fc43b8bb5425f2 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -647,7 +647,8 @@ float GetDeviceScaleAdjustment() {
namespace chrome {
ChromeContentBrowserClient::ChromeContentBrowserClient()
- : prerender_tracker_(NULL) {
+ : prerender_tracker_(NULL),
+ weak_factory_(this) {
#if defined(ENABLE_PLUGINS)
for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i)
allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]);
@@ -2036,8 +2037,20 @@ void ChromeContentBrowserClient::RequestDesktopNotificationPermission(
return;
}
+ WebContents* web_contents = WebContents::FromRenderFrameHost(
+ render_frame_host);
+ const PermissionRequestID id(render_frame_host->GetProcess()->GetID(),
Peter Beverloo 2014/07/10 11:29:38 Can we name this request_id? There's a lot of Ids
Miguel Garcia 2014/07/17 17:24:47 Done.
+ web_contents->GetRoutingID(), -1 /* bridge id */,
+ GURL());
+
notification_service->RequestPermission(
- source_origin, render_frame_host, callback);
+ web_contents,
+ id,
+ source_origin,
+ true, /* user gesture always true for notifications */
Peter Beverloo 2014/07/10 11:29:38 This is not true anymore, and we'll have to pass t
Miguel Garcia 2014/07/17 17:24:47 Seems out of scope for the CL though, the current
+ base::Bind(&ChromeContentBrowserClient::NotificationPermissionRequested,
+ weak_factory_.GetWeakPtr(), callback));
+
#else
NOTIMPLEMENTED();
#endif
@@ -2811,4 +2824,10 @@ void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch(
}
#endif // defined(ENABLE_WEBRTC)
+
+void ChromeContentBrowserClient::NotificationPermissionRequested(
+ base::Closure callback, bool result) {
Peter Beverloo 2014/07/10 11:29:38 Having |result| be here makes me happy :-). This a
Miguel Garcia 2014/07/17 17:24:47 Acknowledged.
+ callback.Run();
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698