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

Side by Side Diff: chrome/browser/extensions/api/font_settings/font_settings_api.cc

Issue 2323993004: Remove use of deprecated base::ListValue::Append(Value*) overload in extensions. (Closed)
Patch Set: ... I hate C++ Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Font Settings Extension API implementation. 5 // Font Settings Extension API implementation.
6 6
7 #include "chrome/browser/extensions/api/font_settings/font_settings_api.h" 7 #include "chrome/browser/extensions/api/font_settings/font_settings_api.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 CHECK(pref); 173 CHECK(pref);
174 174
175 std::string font_name; 175 std::string font_name;
176 if (!pref->GetValue()->GetAsString(&font_name)) { 176 if (!pref->GetValue()->GetAsString(&font_name)) {
177 NOTREACHED(); 177 NOTREACHED();
178 return; 178 return;
179 } 179 }
180 font_name = MaybeGetLocalizedFontName(font_name); 180 font_name = MaybeGetLocalizedFontName(font_name);
181 181
182 base::ListValue args; 182 base::ListValue args;
183 base::DictionaryValue* dict = new base::DictionaryValue(); 183 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
184 args.Append(dict);
185 dict->SetString(kFontIdKey, font_name); 184 dict->SetString(kFontIdKey, font_name);
186 dict->SetString(kGenericFamilyKey, generic_family); 185 dict->SetString(kGenericFamilyKey, generic_family);
187 dict->SetString(kScriptKey, script); 186 dict->SetString(kScriptKey, script);
187 args.Append(std::move(dict));
188 188
189 extensions::preference_helpers::DispatchEventToExtensions( 189 extensions::preference_helpers::DispatchEventToExtensions(
190 profile_, events::FONT_SETTINGS_ON_FONT_CHANGED, 190 profile_, events::FONT_SETTINGS_ON_FONT_CHANGED,
191 fonts::OnFontChanged::kEventName, &args, APIPermission::kFontSettings, 191 fonts::OnFontChanged::kEventName, &args, APIPermission::kFontSettings,
192 false, pref_name); 192 false, pref_name);
193 } 193 }
194 194
195 void FontSettingsEventRouter::OnFontPrefChanged( 195 void FontSettingsEventRouter::OnFontPrefChanged(
196 events::HistogramValue histogram_value, 196 events::HistogramValue histogram_value,
197 const std::string& event_name, 197 const std::string& event_name,
198 const std::string& key, 198 const std::string& key,
199 const std::string& pref_name) { 199 const std::string& pref_name) {
200 const PrefService::Preference* pref = registrar_.prefs()->FindPreference( 200 const PrefService::Preference* pref = registrar_.prefs()->FindPreference(
201 pref_name); 201 pref_name);
202 CHECK(pref); 202 CHECK(pref);
203 203
204 base::ListValue args; 204 base::ListValue args;
205 base::DictionaryValue* dict = new base::DictionaryValue(); 205 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
206 args.Append(dict);
207 dict->Set(key, pref->GetValue()->DeepCopy()); 206 dict->Set(key, pref->GetValue()->DeepCopy());
207 args.Append(std::move(dict));
208 208
209 extensions::preference_helpers::DispatchEventToExtensions( 209 extensions::preference_helpers::DispatchEventToExtensions(
210 profile_, histogram_value, event_name, &args, 210 profile_, histogram_value, event_name, &args,
211 APIPermission::kFontSettings, false, pref_name); 211 APIPermission::kFontSettings, false, pref_name);
212 } 212 }
213 213
214 FontSettingsAPI::FontSettingsAPI(content::BrowserContext* context) 214 FontSettingsAPI::FontSettingsAPI(content::BrowserContext* context)
215 : font_settings_event_router_( 215 : font_settings_event_router_(
216 new FontSettingsEventRouter(Profile::FromBrowserContext(context))) {} 216 new FontSettingsEventRouter(Profile::FromBrowserContext(context))) {}
217 217
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 446
447 const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() { 447 const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() {
448 return prefs::kWebKitMinimumFontSize; 448 return prefs::kWebKitMinimumFontSize;
449 } 449 }
450 450
451 const char* FontSettingsSetMinimumFontSizeFunction::GetKey() { 451 const char* FontSettingsSetMinimumFontSizeFunction::GetKey() {
452 return kPixelSizeKey; 452 return kPixelSizeKey;
453 } 453 }
454 454
455 } // namespace extensions 455 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api.cc ('k') | chrome/browser/extensions/api/preference/preference_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698