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

Side by Side Diff: chrome/browser/notifications/notifier_state_tracker.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 months 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/net/disk_cache_dir_policy_handler_unittest.cc ('k') | chrome/browser/policy/cloud/cloud_policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698