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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 25492006: Makes the response to CheckNotificationPermission asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « no previous file | chrome/browser/notifications/desktop_notification_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 96fc4df376b0efa4a6512f09aac81fe190e1a6c3..8430dda4dc4679401059b5512cae9ca8fac976b5 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -1846,38 +1846,25 @@ void ChromeContentBrowserClient::RequestDesktopNotificationPermission(
}
WebKit::WebNotificationPresenter::Permission
- ChromeContentBrowserClient::CheckDesktopNotificationPermission(
- const GURL& source_origin,
- content::ResourceContext* context,
- int render_process_id) {
+ChromeContentBrowserClient::CheckDesktopNotificationPermission(
+ const GURL& source_origin,
+ content::ResourceContext* context,
+ int render_process_id) {
#if defined(ENABLE_NOTIFICATIONS)
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- // Sometimes a notification may be invoked during the shutdown.
- // See http://crbug.com/256638
- if (browser_shutdown::IsTryingToQuit())
- return WebKit::WebNotificationPresenter::PermissionNotAllowed;
-
- ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ content::RenderProcessHost* process =
+ content::RenderProcessHost::FromID(render_process_id);
+ DCHECK(process);
+ Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext());
DesktopNotificationService* notification_service =
- io_data->GetNotificationService();
- if (notification_service) {
- ExtensionInfoMap* extension_info_map = io_data->GetExtensionInfoMap();
- ExtensionSet extensions;
- extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin(
- source_origin, render_process_id,
- extensions::APIPermission::kNotification, &extensions);
- for (ExtensionSet::const_iterator iter = extensions.begin();
- iter != extensions.end(); ++iter) {
- NotifierId notifier_id(NotifierId::APPLICATION, (*iter)->id());
- if (notification_service->IsNotifierEnabled(notifier_id))
- return WebKit::WebNotificationPresenter::PermissionAllowed;
- }
+ DesktopNotificationServiceFactory::GetForProfile(profile);
- return notification_service->HasPermission(source_origin);
+ if (!notification_service) {
+ return WebKit::WebNotificationPresenter::PermissionNotAllowed;
}
- return WebKit::WebNotificationPresenter::PermissionNotAllowed;
+ return notification_service->HasPermission(source_origin, render_process_id);
#else
return WebKit::WebNotificationPresenter::PermissionAllowed;
#endif
« no previous file with comments | « no previous file | chrome/browser/notifications/desktop_notification_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698