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

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

Issue 11820041: Remove profile-keyed factory boilerplates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 7 years, 11 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 "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/lazy_instance.h"
12 #include "base/string_util.h" 13 #include "base/string_util.h"
13 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chrome/browser/extensions/api/preference/preference_helpers.h" 16 #include "chrome/browser/extensions/api/preference/preference_helpers.h"
16 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
17 #include "chrome/browser/extensions/extension_system.h" 18 #include "chrome/browser/extensions/extension_system.h"
18 #include "chrome/browser/prefs/pref_service.h" 19 #include "chrome/browser/prefs/pref_service.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/common/chrome_notification_types.h" 21 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/extensions/api/font_settings.h" 22 #include "chrome/common/extensions/api/font_settings.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 pref_name); 211 pref_name);
211 } 212 }
212 213
213 FontSettingsAPI::FontSettingsAPI(Profile* profile) 214 FontSettingsAPI::FontSettingsAPI(Profile* profile)
214 : font_settings_event_router_(new FontSettingsEventRouter(profile)) { 215 : font_settings_event_router_(new FontSettingsEventRouter(profile)) {
215 } 216 }
216 217
217 FontSettingsAPI::~FontSettingsAPI() { 218 FontSettingsAPI::~FontSettingsAPI() {
218 } 219 }
219 220
221 static base::LazyInstance<ProfileKeyedAPIFactory<FontSettingsAPI> >
222 g_factory = LAZY_INSTANCE_INITIALIZER;
223
224 // static
225 ProfileKeyedAPIFactory<FontSettingsAPI>* FontSettingsAPI::GetFactoryInstance() {
226 return &g_factory.Get();
227 }
228
220 bool FontSettingsClearFontFunction::RunImpl() { 229 bool FontSettingsClearFontFunction::RunImpl() {
221 if (profile_->IsOffTheRecord()) { 230 if (profile_->IsOffTheRecord()) {
222 error_ = kSetFromIncognitoError; 231 error_ = kSetFromIncognitoError;
223 return false; 232 return false;
224 } 233 }
225 234
226 scoped_ptr<fonts::ClearFont::Params> params( 235 scoped_ptr<fonts::ClearFont::Params> params(
227 fonts::ClearFont::Params::Create(*args_)); 236 fonts::ClearFont::Params::Create(*args_));
228 EXTENSION_FUNCTION_VALIDATE(params.get()); 237 EXTENSION_FUNCTION_VALIDATE(params.get());
229 238
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 465
457 const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() { 466 const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() {
458 return prefs::kWebKitMinimumFontSize; 467 return prefs::kWebKitMinimumFontSize;
459 } 468 }
460 469
461 const char* FontSettingsSetMinimumFontSizeFunction::GetKey() { 470 const char* FontSettingsSetMinimumFontSizeFunction::GetKey() {
462 return kPixelSizeKey; 471 return kPixelSizeKey;
463 } 472 }
464 473
465 } // namespace extensions 474 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698