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

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: 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 9ff4d4509b5eb5ed52cad2eb9e0c77cb30e2d140..691a28019685cf5e1c9e79bf6244c609a002933b 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 WebKit::WebNotificationPresenter;
using WebKit::WebTextDirection;
@@ -650,27 +649,6 @@ void DesktopNotificationService::OnStringListPrefChanged(
}
}
-WebKit::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 WebKit::WebNotificationPresenter::PermissionAllowed;
- if (setting == CONTENT_SETTING_BLOCK)
- return WebKit::WebNotificationPresenter::PermissionDenied;
- if (setting == CONTENT_SETTING_ASK)
- return WebKit::WebNotificationPresenter::PermissionNotAllowed;
- NOTREACHED() << "Invalid notifications settings value: " << setting;
- return WebKit::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.
+ ExtensionInfoMap* extension_info_map =
+ extensions::ExtensionSystem::Get(profile_)->info_map();
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&ExtensionInfoMap::SetNotificationsDisabled,
+ extension_info_map, notifier_id.id, !enabled));
+
}

Powered by Google App Engine
This is Rietveld 408576698