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

Side by Side Diff: chrome/browser/extensions/extension_prefs.cc

Issue 7647026: base: Add three helper functions to Values API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a typo Ceate -> Create Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_pref_store.h" 10 #include "chrome/browser/extensions/extension_pref_store.h"
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // Keep the record if this extension is already processed. 606 // Keep the record if this extension is already processed.
607 used_id_set.insert(id); 607 used_id_set.insert(id);
608 } 608 }
609 } 609 }
610 } 610 }
611 611
612 // Iterate the leftovers to set blacklist in pref 612 // Iterate the leftovers to set blacklist in pref
613 std::set<std::string>::const_iterator set_itr = blacklist_set.begin(); 613 std::set<std::string>::const_iterator set_itr = blacklist_set.begin();
614 for (; set_itr != blacklist_set.end(); ++set_itr) { 614 for (; set_itr != blacklist_set.end(); ++set_itr) {
615 if (used_id_set.find(*set_itr) == used_id_set.end()) { 615 if (used_id_set.find(*set_itr) == used_id_set.end()) {
616 UpdateExtensionPref(*set_itr, kPrefBlacklist, 616 UpdateExtensionPref(*set_itr, kPrefBlacklist, base::TrueValue());
617 Value::CreateBooleanValue(true));
618 } 617 }
619 } 618 }
620 for (unsigned int i = 0; i < remove_pref_ids.size(); ++i) { 619 for (unsigned int i = 0; i < remove_pref_ids.size(); ++i) {
621 DeleteExtensionPrefs(remove_pref_ids[i]); 620 DeleteExtensionPrefs(remove_pref_ids[i]);
622 } 621 }
623 } 622 }
624 623
625 namespace { 624 namespace {
626 625
627 // Serializes |time| as a string value mapped to |key| in |dictionary|. 626 // Serializes |time| as a string value mapped to |key| in |dictionary|.
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 CHECK_GE(index, 0); 1359 CHECK_GE(index, 0);
1361 UpdateExtensionPref(extension_id, kPrefPageIndex, 1360 UpdateExtensionPref(extension_id, kPrefPageIndex,
1362 Value::CreateIntegerValue(index)); 1361 Value::CreateIntegerValue(index));
1363 } 1362 }
1364 1363
1365 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) { 1364 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) {
1366 return ReadExtensionPrefBoolean(extension_id, kPrefUserDraggedApp); 1365 return ReadExtensionPrefBoolean(extension_id, kPrefUserDraggedApp);
1367 } 1366 }
1368 1367
1369 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) { 1368 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) {
1370 UpdateExtensionPref(extension_id, kPrefUserDraggedApp, 1369 UpdateExtensionPref(extension_id, kPrefUserDraggedApp, base::TrueValue());
1371 Value::CreateBooleanValue(true));
1372 } 1370 }
1373 1371
1374 void ExtensionPrefs::SetUpdateUrlData(const std::string& extension_id, 1372 void ExtensionPrefs::SetUpdateUrlData(const std::string& extension_id,
1375 const std::string& data) { 1373 const std::string& data) {
1376 UpdateExtensionPref(extension_id, kUpdateUrlData, 1374 UpdateExtensionPref(extension_id, kUpdateUrlData,
1377 Value::CreateStringValue(data)); 1375 Value::CreateStringValue(data));
1378 } 1376 }
1379 1377
1380 std::string ExtensionPrefs::GetUpdateUrlData(const std::string& extension_id) { 1378 std::string ExtensionPrefs::GetUpdateUrlData(const std::string& extension_id) {
1381 const DictionaryValue* dictionary = GetExtensionPref(extension_id); 1379 const DictionaryValue* dictionary = GetExtensionPref(extension_id);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, 1667 prefs->RegisterListPref(prefs::kExtensionInstallAllowList,
1670 PrefService::UNSYNCABLE_PREF); 1668 PrefService::UNSYNCABLE_PREF);
1671 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, 1669 prefs->RegisterListPref(prefs::kExtensionInstallDenyList,
1672 PrefService::UNSYNCABLE_PREF); 1670 PrefService::UNSYNCABLE_PREF);
1673 prefs->RegisterListPref(prefs::kExtensionInstallForceList, 1671 prefs->RegisterListPref(prefs::kExtensionInstallForceList,
1674 PrefService::UNSYNCABLE_PREF); 1672 PrefService::UNSYNCABLE_PREF);
1675 prefs->RegisterStringPref(kWebStoreLogin, 1673 prefs->RegisterStringPref(kWebStoreLogin,
1676 std::string() /* default_value */, 1674 std::string() /* default_value */,
1677 PrefService::UNSYNCABLE_PREF); 1675 PrefService::UNSYNCABLE_PREF);
1678 } 1676 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_permissions_api.cc ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698