diff options
author | dewittj@chromium.org <dewittj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 20:23:31 +0000 |
---|---|---|
committer | dewittj@chromium.org <dewittj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 20:23:31 +0000 |
commit | 9afacd27ad2436db5efce5a71febe8d8b169bee7 (patch) | |
tree | 0432b0902c76cac3b065946a5053ae03a8256d25 /extensions/browser/info_map.cc | |
parent | 33843bba42f92361e817339e3ba8ac2153dee056 (diff) | |
download | chromium_src-9afacd27ad2436db5efce5a71febe8d8b169bee7.zip chromium_src-9afacd27ad2436db5efce5a71febe8d8b169bee7.tar.gz chromium_src-9afacd27ad2436db5efce5a71febe8d8b169bee7.tar.bz2 |
Fix broken threading model in CheckDesktopNotificationPermission
Over time, this function (which is called on the IO thread) was updated
to use DesktopNotificationService. While the methods in that service
were enforced to run on the correct thread, it's not possible to get
the notification service from the ProfileIOData safely. This removes the
dependency on DesktopNotificationService from the IO-thread notification
functions.
BUG=256638
Review URL: https://codereview.chromium.org/61323002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/browser/info_map.cc')
-rw-r--r-- | extensions/browser/info_map.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/extensions/browser/info_map.cc b/extensions/browser/info_map.cc index f790868..012f719 100644 --- a/extensions/browser/info_map.cc +++ b/extensions/browser/info_map.cc @@ -29,6 +29,9 @@ struct InfoMap::ExtraData { // True if the user has allowed this extension to run in incognito mode. bool incognito_enabled; + // True if the user has disabled notifications for this extension manually. + bool notifications_disabled; + ExtraData(); ~ExtraData(); }; @@ -43,13 +46,15 @@ const ProcessMap& InfoMap::process_map() const { return process_map_; } void InfoMap::AddExtension(const Extension* extension, base::Time install_time, - bool incognito_enabled) { + bool incognito_enabled, + bool notifications_disabled) { CheckOnValidThread(); extensions_.Insert(extension); disabled_extensions_.Remove(extension->id()); extra_data_[extension->id()].install_time = install_time; extra_data_[extension->id()].incognito_enabled = incognito_enabled; + extra_data_[extension->id()].notifications_disabled = notifications_disabled; } void InfoMap::RemoveExtension(const std::string& extension_id, @@ -171,6 +176,22 @@ bool InfoMap::IsSigninProcess(int process_id) const { return process_id == signin_process_id_; } +void InfoMap::SetNotificationsDisabled( + const std::string& extension_id, + bool notifications_disabled) { + ExtraDataMap::iterator iter = extra_data_.find(extension_id); + if (iter != extra_data_.end()) + iter->second.notifications_disabled = notifications_disabled; +} + +bool InfoMap::AreNotificationsDisabled( + const std::string& extension_id) const { + ExtraDataMap::const_iterator iter = extra_data_.find(extension_id); + if (iter != extra_data_.end()) + return iter->second.notifications_disabled; + return false; +} + InfoMap::~InfoMap() { if (quota_service_) { BrowserThread::DeleteSoon( |