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

Side by Side Diff: chrome/browser/extensions/api/preference/preference_api.cc

Issue 252653002: Rename (Chrome)SyncExtensionFunction::RunImpl to RunSync so that the RunImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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 #include "chrome/browser/extensions/api/preference/preference_api.h" 5 #include "chrome/browser/extensions/api/preference/preference_api.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 if (!GetExtension()->HasAPIPermission(permission)) { 514 if (!GetExtension()->HasAPIPermission(permission)) {
515 error_ = ErrorUtils::FormatErrorMessage( 515 error_ = ErrorUtils::FormatErrorMessage(
516 keys::kPermissionErrorMessage, extension_pref_key); 516 keys::kPermissionErrorMessage, extension_pref_key);
517 return false; 517 return false;
518 } 518 }
519 return true; 519 return true;
520 } 520 }
521 521
522 GetPreferenceFunction::~GetPreferenceFunction() { } 522 GetPreferenceFunction::~GetPreferenceFunction() { }
523 523
524 bool GetPreferenceFunction::RunImpl() { 524 bool GetPreferenceFunction::RunSync() {
525 std::string pref_key; 525 std::string pref_key;
526 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key)); 526 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key));
527 base::DictionaryValue* details = NULL; 527 base::DictionaryValue* details = NULL;
528 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details)); 528 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details));
529 529
530 bool incognito = false; 530 bool incognito = false;
531 if (details->HasKey(keys::kIncognitoKey)) 531 if (details->HasKey(keys::kIncognitoKey))
532 EXTENSION_FUNCTION_VALIDATE(details->GetBoolean(keys::kIncognitoKey, 532 EXTENSION_FUNCTION_VALIDATE(details->GetBoolean(keys::kIncognitoKey,
533 &incognito)); 533 &incognito));
534 534
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 result->SetBoolean(keys::kIncognitoSpecific, 576 result->SetBoolean(keys::kIncognitoSpecific,
577 ep->HasIncognitoPrefValue(browser_pref)); 577 ep->HasIncognitoPrefValue(browser_pref));
578 } 578 }
579 579
580 SetResult(result.release()); 580 SetResult(result.release());
581 return true; 581 return true;
582 } 582 }
583 583
584 SetPreferenceFunction::~SetPreferenceFunction() { } 584 SetPreferenceFunction::~SetPreferenceFunction() { }
585 585
586 bool SetPreferenceFunction::RunImpl() { 586 bool SetPreferenceFunction::RunSync() {
587 std::string pref_key; 587 std::string pref_key;
588 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key)); 588 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key));
589 base::DictionaryValue* details = NULL; 589 base::DictionaryValue* details = NULL;
590 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details)); 590 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details));
591 591
592 base::Value* value = NULL; 592 base::Value* value = NULL;
593 EXTENSION_FUNCTION_VALIDATE(details->Get(keys::kValue, &value)); 593 EXTENSION_FUNCTION_VALIDATE(details->Get(keys::kValue, &value));
594 594
595 ExtensionPrefsScope scope = kExtensionPrefsScopeRegular; 595 ExtensionPrefsScope scope = kExtensionPrefsScopeRegular;
596 if (details->HasKey(keys::kScopeKey)) { 596 if (details->HasKey(keys::kScopeKey)) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 return false; 662 return false;
663 } 663 }
664 664
665 PreferenceAPI::Get(GetProfile())->SetExtensionControlledPref( 665 PreferenceAPI::Get(GetProfile())->SetExtensionControlledPref(
666 extension_id(), browser_pref, scope, browser_pref_value.release()); 666 extension_id(), browser_pref, scope, browser_pref_value.release());
667 return true; 667 return true;
668 } 668 }
669 669
670 ClearPreferenceFunction::~ClearPreferenceFunction() { } 670 ClearPreferenceFunction::~ClearPreferenceFunction() { }
671 671
672 bool ClearPreferenceFunction::RunImpl() { 672 bool ClearPreferenceFunction::RunSync() {
673 std::string pref_key; 673 std::string pref_key;
674 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key)); 674 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &pref_key));
675 base::DictionaryValue* details = NULL; 675 base::DictionaryValue* details = NULL;
676 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details)); 676 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &details));
677 677
678 ExtensionPrefsScope scope = kExtensionPrefsScopeRegular; 678 ExtensionPrefsScope scope = kExtensionPrefsScopeRegular;
679 if (details->HasKey(keys::kScopeKey)) { 679 if (details->HasKey(keys::kScopeKey)) {
680 std::string scope_str; 680 std::string scope_str;
681 EXTENSION_FUNCTION_VALIDATE( 681 EXTENSION_FUNCTION_VALIDATE(
682 details->GetString(keys::kScopeKey, &scope_str)); 682 details->GetString(keys::kScopeKey, &scope_str));
(...skipping 22 matching lines...) Expand all
705 pref_key, PreferenceFunction::PERMISSION_TYPE_WRITE, &browser_pref)) { 705 pref_key, PreferenceFunction::PERMISSION_TYPE_WRITE, &browser_pref)) {
706 return false; 706 return false;
707 } 707 }
708 708
709 PreferenceAPI::Get(GetProfile()) 709 PreferenceAPI::Get(GetProfile())
710 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); 710 ->RemoveExtensionControlledPref(extension_id(), browser_pref, scope);
711 return true; 711 return true;
712 } 712 }
713 713
714 } // namespace extensions 714 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698