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

Unified Diff: chrome/browser/notifications/desktop_notification_service.cc

Issue 61323002: Fix broken threading model in CheckDesktopNotificationPermission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Even more merge conflicts.. Created 7 years, 1 month 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 6fbaa2a64221317aad6cdc5e73ed68ab44d54a62..2863ce769deb1ee6a7ee201ae8d90ee01bfce19f 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -58,7 +58,6 @@ using content::BrowserThread;
using content::RenderViewHost;
using content::WebContents;
using message_center::NotifierId;
-using blink::WebNotificationPresenter;
using blink::WebTextDirection;
@@ -650,27 +649,6 @@ void DesktopNotificationService::OnStringListPrefChanged(
}
}
-blink::WebNotificationPresenter::Permission
- DesktopNotificationService::HasPermission(const GURL& origin) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- HostContentSettingsMap* host_content_settings_map =
- profile_->GetHostContentSettingsMap();
- ContentSetting setting = host_content_settings_map->GetContentSetting(
- origin,
- origin,
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
- NO_RESOURCE_IDENTIFIER);
-
- if (setting == CONTENT_SETTING_ALLOW)
- return blink::WebNotificationPresenter::PermissionAllowed;
- if (setting == CONTENT_SETTING_BLOCK)
- return blink::WebNotificationPresenter::PermissionDenied;
- if (setting == CONTENT_SETTING_ASK)
- return blink::WebNotificationPresenter::PermissionNotAllowed;
- NOTREACHED() << "Invalid notifications settings value: " << setting;
- return blink::WebNotificationPresenter::PermissionNotAllowed;
-}
-
void DesktopNotificationService::Observe(
int type,
const content::NotificationSource& source,
@@ -700,4 +678,14 @@ void DesktopNotificationService::FirePermissionLevelChangedEvent(
args.Pass()));
extensions::ExtensionSystem::Get(profile_)->event_router()->
DispatchEventToExtension(notifier_id.id, event.Pass());
+
+ // Tell the IO thread that this extension's permission for notifications
+ // has changed.
+ extensions::InfoMap* extension_info_map =
+ extensions::ExtensionSystem::Get(profile_)->info_map();
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
+ extension_info_map, notifier_id.id, !enabled));
+
}

Powered by Google App Engine
This is Rietveld 408576698