| OLD | NEW |
| 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 Loading... |
| 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 ClearFontFunction::RunImpl() { | 229 bool ClearFontFunction::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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 464 |
| 456 const char* SetMinimumFontSizeFunction::GetPrefName() { | 465 const char* SetMinimumFontSizeFunction::GetPrefName() { |
| 457 return prefs::kWebKitMinimumFontSize; | 466 return prefs::kWebKitMinimumFontSize; |
| 458 } | 467 } |
| 459 | 468 |
| 460 const char* SetMinimumFontSizeFunction::GetKey() { | 469 const char* SetMinimumFontSizeFunction::GetKey() { |
| 461 return kPixelSizeKey; | 470 return kPixelSizeKey; |
| 462 } | 471 } |
| 463 | 472 |
| 464 } // namespace extensions | 473 } // namespace extensions |
| OLD | NEW |