OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/notifications/notifier_state_tracker.h" | 5 #include "chrome/browser/notifications/notifier_state_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return false; | 116 return false; |
117 } | 117 } |
118 | 118 |
119 void NotifierStateTracker::SetNotifierEnabled( | 119 void NotifierStateTracker::SetNotifierEnabled( |
120 const NotifierId& notifier_id, | 120 const NotifierId& notifier_id, |
121 bool enabled) { | 121 bool enabled) { |
122 DCHECK_NE(NotifierId::WEB_PAGE, notifier_id.type); | 122 DCHECK_NE(NotifierId::WEB_PAGE, notifier_id.type); |
123 | 123 |
124 bool add_new_item = false; | 124 bool add_new_item = false; |
125 const char* pref_name = NULL; | 125 const char* pref_name = NULL; |
126 std::unique_ptr<base::StringValue> id; | 126 std::unique_ptr<base::Value> id; |
127 switch (notifier_id.type) { | 127 switch (notifier_id.type) { |
128 case NotifierId::APPLICATION: | 128 case NotifierId::APPLICATION: |
129 pref_name = prefs::kMessageCenterDisabledExtensionIds; | 129 pref_name = prefs::kMessageCenterDisabledExtensionIds; |
130 add_new_item = !enabled; | 130 add_new_item = !enabled; |
131 id.reset(new base::StringValue(notifier_id.id)); | 131 id.reset(new base::Value(notifier_id.id)); |
132 #if BUILDFLAG(ENABLE_EXTENSIONS) | 132 #if BUILDFLAG(ENABLE_EXTENSIONS) |
133 FirePermissionLevelChangedEvent(notifier_id, enabled); | 133 FirePermissionLevelChangedEvent(notifier_id, enabled); |
134 #endif | 134 #endif |
135 break; | 135 break; |
136 case NotifierId::SYSTEM_COMPONENT: | 136 case NotifierId::SYSTEM_COMPONENT: |
137 #if defined(OS_CHROMEOS) | 137 #if defined(OS_CHROMEOS) |
138 pref_name = prefs::kMessageCenterDisabledSystemComponentIds; | 138 pref_name = prefs::kMessageCenterDisabledSystemComponentIds; |
139 add_new_item = !enabled; | 139 add_new_item = !enabled; |
140 id.reset(new base::StringValue(notifier_id.id)); | 140 id.reset(new base::Value(notifier_id.id)); |
141 #else | 141 #else |
142 return; | 142 return; |
143 #endif | 143 #endif |
144 break; | 144 break; |
145 default: | 145 default: |
146 NOTREACHED(); | 146 NOTREACHED(); |
147 } | 147 } |
148 DCHECK(pref_name != NULL); | 148 DCHECK(pref_name != NULL); |
149 | 149 |
150 ListPrefUpdate update(profile_->GetPrefs(), pref_name); | 150 ListPrefUpdate update(profile_->GetPrefs(), pref_name); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // Tell the IO thread that this extension's permission for notifications | 202 // Tell the IO thread that this extension's permission for notifications |
203 // has changed. | 203 // has changed. |
204 extensions::InfoMap* extension_info_map = | 204 extensions::InfoMap* extension_info_map = |
205 extensions::ExtensionSystem::Get(profile_)->info_map(); | 205 extensions::ExtensionSystem::Get(profile_)->info_map(); |
206 content::BrowserThread::PostTask( | 206 content::BrowserThread::PostTask( |
207 content::BrowserThread::IO, FROM_HERE, | 207 content::BrowserThread::IO, FROM_HERE, |
208 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, | 208 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, |
209 extension_info_map, notifier_id.id, !enabled)); | 209 extension_info_map, notifier_id.id, !enabled)); |
210 } | 210 } |
211 #endif | 211 #endif |
OLD | NEW |