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

Unified Diff: chrome/browser/notifications/desktop_notification_service.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: chrome/browser/notifications/desktop_notification_service.cc
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index fad44eb4d08637db2d682900097157e443a90a9d..db09c2df39868039632790578f3d0686cff948e7 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -142,7 +142,7 @@ void DesktopNotificationService::RequestNotificationPermission(
const PermissionRequestID& request_id,
const GURL& requesting_origin,
bool user_gesture,
- const NotificationPermissionCallback& callback) {
+ const base::Callback<void(bool)>& result_callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
#if defined(ENABLE_EXTENSIONS)
@@ -169,19 +169,16 @@ void DesktopNotificationService::RequestNotificationPermission(
extensions::APIPermission::kNotifications,
extension,
web_contents->GetRenderViewHost())) {
- callback.Run(blink::WebNotificationPermissionAllowed);
+ result_callback.Run(true);
return;
}
#endif
- RequestPermission(
- web_contents,
- request_id,
- requesting_origin,
- user_gesture,
- base::Bind(&DesktopNotificationService::OnNotificationPermissionRequested,
- weak_factory_.GetWeakPtr(),
- callback));
+ RequestPermission(web_contents,
+ request_id,
+ requesting_origin,
+ user_gesture,
+ result_callback);
Peter Beverloo 2014/10/24 14:37:28 Please remove the WeakPtrFactory from the DesktopN
Miguel Garcia 2014/10/24 16:05:32 Done.
}
void DesktopNotificationService::ShowDesktopNotification(
@@ -357,15 +354,6 @@ void DesktopNotificationService::UpdateContentSetting(
}
}
-void DesktopNotificationService::OnNotificationPermissionRequested(
- const NotificationPermissionCallback& callback, bool allowed) {
- blink::WebNotificationPermission permission = allowed ?
- blink::WebNotificationPermissionAllowed :
- blink::WebNotificationPermissionDenied;
-
- callback.Run(permission);
-}
-
void DesktopNotificationService::FirePermissionLevelChangedEvent(
const NotifierId& notifier_id, bool enabled) {
#if defined(ENABLE_EXTENSIONS)

Powered by Google App Engine
This is Rietveld 408576698