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

Unified Diff: chrome/browser/extensions/extension_system.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/extensions/extension_system.cc
diff --git a/chrome/browser/extensions/extension_system.cc b/chrome/browser/extensions/extension_system.cc
index b7099d2884433a18b2a20ab5a69720b2f018b50b..30fb44456d40e165b4f97f54e9946d98ef704fe0 100644
--- a/chrome/browser/extensions/extension_system.cc
+++ b/chrome/browser/extensions/extension_system.cc
@@ -33,6 +33,8 @@
#include "chrome/browser/extensions/state_store.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/extensions/user_script_master.h"
+#include "chrome/browser/notifications/desktop_notification_service.h"
+#include "chrome/browser/notifications/desktop_notification_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
@@ -45,6 +47,7 @@
#include "extensions/browser/lazy_background_task_queue.h"
#include "extensions/common/constants.h"
#include "extensions/common/manifest.h"
+#include "ui/message_center/notifier_settings.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/app_mode/app_mode_utils.h"
@@ -400,11 +403,20 @@ void ExtensionSystemImpl::RegisterExtensionWithRequestContexts(
}
bool incognito_enabled =
extension_util::IsIncognitoEnabled(extension->id(), extension_service());
+ message_center::NotifierId notifier_id(
+ message_center::NotifierId::APPLICATION,
+ extension->id());
+
+ DesktopNotificationService* notification_service =
+ DesktopNotificationServiceFactory::GetForProfile(profile_);
+ bool notifications_disabled =
+ !notification_service->IsNotifierEnabled(notifier_id);
+
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&ExtensionInfoMap::AddExtension, info_map(),
make_scoped_refptr(extension), install_time,
- incognito_enabled));
+ incognito_enabled, notifications_disabled));
}
void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(

Powered by Google App Engine
This is Rietveld 408576698