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

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: 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/extensions/extension_system.cc
diff --git a/chrome/browser/extensions/extension_system.cc b/chrome/browser/extensions/extension_system.cc
index 3bbfead578665cfad052fb7d88891324e1707e67..3062ef95a31856768b8ac55a3f97066039ab7cca 100644
--- a/chrome/browser/extensions/extension_system.cc
+++ b/chrome/browser/extensions/extension_system.cc
@@ -46,6 +46,12 @@
#include "extensions/common/constants.h"
#include "extensions/common/manifest.h"
+#if defined(ENABLE_NOTIFICATIONS)
+#include "chrome/browser/notifications/desktop_notification_service.h"
+#include "chrome/browser/notifications/desktop_notification_service_factory.h"
+#include "ui/message_center/notifier_settings.h"
+#endif
+
#if defined(OS_CHROMEOS)
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.h"
@@ -397,13 +403,24 @@ void ExtensionSystemImpl::RegisterExtensionWithRequestContexts(
}
bool incognito_enabled =
extension_util::IsIncognitoEnabled(extension->id(), extension_service());
- BrowserThread::PostTask(BrowserThread::IO,
- FROM_HERE,
- base::Bind(&InfoMap::AddExtension,
- info_map(),
- make_scoped_refptr(extension),
- install_time,
- incognito_enabled));
+
+ bool notifications_disabled = false;
+#if defined(ENABLE_NOTIFICATIONS)
+ message_center::NotifierId notifier_id(
+ message_center::NotifierId::APPLICATION,
+ extension->id());
+
+ DesktopNotificationService* notification_service =
+ DesktopNotificationServiceFactory::GetForProfile(profile_);
+ notifications_disabled =
+ !notification_service->IsNotifierEnabled(notifier_id);
+#endif
+
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&InfoMap::AddExtension, info_map(),
+ make_scoped_refptr(extension), install_time,
+ incognito_enabled, notifications_disabled));
}
void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
« no previous file with comments | « chrome/browser/extensions/extension_protocols_unittest.cc ('k') | chrome/browser/notifications/desktop_notification_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698