| 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
|
|
|