| 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/extension_font_settings_api.h" | 7 #include "chrome/browser/extensions/extension_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" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 const bool kIncognito = false; | 286 const bool kIncognito = false; |
| 287 std::string level_of_control = | 287 std::string level_of_control = |
| 288 extension_preference_helpers::GetLevelOfControl(profile_, | 288 extension_preference_helpers::GetLevelOfControl(profile_, |
| 289 extension_id(), | 289 extension_id(), |
| 290 pref_path, | 290 pref_path, |
| 291 kIncognito); | 291 kIncognito); |
| 292 | 292 |
| 293 DictionaryValue* result = new DictionaryValue(); | 293 DictionaryValue* result = new DictionaryValue(); |
| 294 result->SetString(kFontNameKey, font_name); | 294 result->SetString(kFontNameKey, font_name); |
| 295 result->SetString(kLevelOfControlKey, level_of_control); | 295 result->SetString(kLevelOfControlKey, level_of_control); |
| 296 result_.reset(result); | 296 SetSingleResult(result); |
| 297 return true; | 297 return true; |
| 298 } | 298 } |
| 299 | 299 |
| 300 bool SetFontFunction::RunImpl() { | 300 bool SetFontFunction::RunImpl() { |
| 301 if (profile_->IsOffTheRecord()) { | 301 if (profile_->IsOffTheRecord()) { |
| 302 error_ = kSetFromIncognitoError; | 302 error_ = kSetFromIncognitoError; |
| 303 return false; | 303 return false; |
| 304 } | 304 } |
| 305 | 305 |
| 306 scoped_ptr<fonts::SetFont::Params> params( | 306 scoped_ptr<fonts::SetFont::Params> params( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 NOTREACHED(); | 353 NOTREACHED(); |
| 354 return false; | 354 return false; |
| 355 } | 355 } |
| 356 | 356 |
| 357 DictionaryValue* font_name = new DictionaryValue(); | 357 DictionaryValue* font_name = new DictionaryValue(); |
| 358 font_name->Set(kFontNameKey, Value::CreateStringValue(name)); | 358 font_name->Set(kFontNameKey, Value::CreateStringValue(name)); |
| 359 font_name->Set(kLocalizedNameKey, Value::CreateStringValue(localized_name)); | 359 font_name->Set(kLocalizedNameKey, Value::CreateStringValue(localized_name)); |
| 360 result->Append(font_name); | 360 result->Append(font_name); |
| 361 } | 361 } |
| 362 | 362 |
| 363 result_.reset(result.release()); | 363 SetSingleResult(result.release()); |
| 364 return true; | 364 return true; |
| 365 } | 365 } |
| 366 | 366 |
| 367 bool ClearFontPrefExtensionFunction::RunImpl() { | 367 bool ClearFontPrefExtensionFunction::RunImpl() { |
| 368 if (profile_->IsOffTheRecord()) { | 368 if (profile_->IsOffTheRecord()) { |
| 369 error_ = kSetFromIncognitoError; | 369 error_ = kSetFromIncognitoError; |
| 370 return false; | 370 return false; |
| 371 } | 371 } |
| 372 | 372 |
| 373 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); | 373 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 388 | 388 |
| 389 std::string level_of_control = | 389 std::string level_of_control = |
| 390 extension_preference_helpers::GetLevelOfControl(profile_, | 390 extension_preference_helpers::GetLevelOfControl(profile_, |
| 391 extension_id(), | 391 extension_id(), |
| 392 GetPrefName(), | 392 GetPrefName(), |
| 393 kIncognito); | 393 kIncognito); |
| 394 | 394 |
| 395 DictionaryValue* result = new DictionaryValue(); | 395 DictionaryValue* result = new DictionaryValue(); |
| 396 result->Set(GetKey(), pref->GetValue()->DeepCopy()); | 396 result->Set(GetKey(), pref->GetValue()->DeepCopy()); |
| 397 result->SetString(kLevelOfControlKey, level_of_control); | 397 result->SetString(kLevelOfControlKey, level_of_control); |
| 398 result_.reset(result); | 398 SetSingleResult(result); |
| 399 return true; | 399 return true; |
| 400 } | 400 } |
| 401 | 401 |
| 402 bool SetFontPrefExtensionFunction::RunImpl() { | 402 bool SetFontPrefExtensionFunction::RunImpl() { |
| 403 if (profile_->IsOffTheRecord()) { | 403 if (profile_->IsOffTheRecord()) { |
| 404 error_ = kSetFromIncognitoError; | 404 error_ = kSetFromIncognitoError; |
| 405 return false; | 405 return false; |
| 406 } | 406 } |
| 407 | 407 |
| 408 DictionaryValue* details = NULL; | 408 DictionaryValue* details = NULL; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 return kPixelSizeKey; | 471 return kPixelSizeKey; |
| 472 } | 472 } |
| 473 | 473 |
| 474 const char* SetMinimumFontSizeFunction::GetPrefName() { | 474 const char* SetMinimumFontSizeFunction::GetPrefName() { |
| 475 return prefs::kWebKitMinimumFontSize; | 475 return prefs::kWebKitMinimumFontSize; |
| 476 } | 476 } |
| 477 | 477 |
| 478 const char* SetMinimumFontSizeFunction::GetKey() { | 478 const char* SetMinimumFontSizeFunction::GetKey() { |
| 479 return kPixelSizeKey; | 479 return kPixelSizeKey; |
| 480 } | 480 } |
| OLD | NEW |