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 #include "chrome/browser/extensions/extension_preference_api.h" | 5 #include "chrome/browser/extensions/extension_preference_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 result->Set(keys::kValue, | 360 result->Set(keys::kValue, |
361 transformer->BrowserToExtensionPref(pref->GetValue())); | 361 transformer->BrowserToExtensionPref(pref->GetValue())); |
362 | 362 |
363 // Retrieve incognito status. | 363 // Retrieve incognito status. |
364 if (incognito) { | 364 if (incognito) { |
365 ExtensionPrefs* ep = profile_->GetExtensionService()->extension_prefs(); | 365 ExtensionPrefs* ep = profile_->GetExtensionService()->extension_prefs(); |
366 result->SetBoolean(keys::kIncognitoSpecific, | 366 result->SetBoolean(keys::kIncognitoSpecific, |
367 ep->HasIncognitoPrefValue(browser_pref)); | 367 ep->HasIncognitoPrefValue(browser_pref)); |
368 } | 368 } |
369 | 369 |
370 result_.reset(result.release()); | 370 SetSingleResult(result.release()); |
371 return true; | 371 return true; |
372 } | 372 } |
373 | 373 |
374 SetPreferenceFunction::~SetPreferenceFunction() { } | 374 SetPreferenceFunction::~SetPreferenceFunction() { } |
375 | 375 |
376 bool SetPreferenceFunction::RunImpl() { | 376 bool SetPreferenceFunction::RunImpl() { |
377 std::string pref_key; | 377 std::string pref_key; |
378 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key)); | 378 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key)); |
379 DictionaryValue* details = NULL; | 379 DictionaryValue* details = NULL; |
380 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details)); | 380 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details)); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 478 } |
479 | 479 |
480 std::string browser_pref; | 480 std::string browser_pref; |
481 if (!ValidateBrowserPref(pref_key, &browser_pref)) | 481 if (!ValidateBrowserPref(pref_key, &browser_pref)) |
482 return false; | 482 return false; |
483 | 483 |
484 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); | 484 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); |
485 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); | 485 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); |
486 return true; | 486 return true; |
487 } | 487 } |
OLD | NEW |