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

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

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits and crasher on Mac Created 9 years, 11 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) 2010 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_util.h" 7 #include "base/string_util.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.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"
11 #include "chrome/browser/prefs/pref_notifier.h" 11 #include "chrome/browser/prefs/pref_notifier.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 std::set<std::string>* result) { 134 std::set<std::string>* result) {
135 ExtensionExtent::PatternList patterns = host_extent.patterns(); 135 ExtensionExtent::PatternList patterns = host_extent.patterns();
136 ExtensionExtent::PatternList::const_iterator i; 136 ExtensionExtent::PatternList::const_iterator i;
137 137
138 for (i = patterns.begin(); i != patterns.end(); ++i) 138 for (i = patterns.begin(); i != patterns.end(); ++i)
139 result->insert(i->GetAsString()); 139 result->insert(i->GetAsString());
140 } 140 }
141 141
142 } // namespace 142 } // namespace
143 143
144 ExtensionPrefs::ExtensionPrefs(PrefService* prefs, 144 ExtensionPrefs::ExtensionPrefs(
145 const FilePath& root_dir, 145 PrefService* prefs,
146 ExtensionPrefStore* pref_store) 146 const FilePath& root_dir,
147 ExtensionPrefValueMap* extension_pref_value_map)
147 : prefs_(prefs), 148 : prefs_(prefs),
148 install_directory_(root_dir), 149 install_directory_(root_dir),
149 pref_store_(pref_store) { 150 extension_pref_value_map_(extension_pref_value_map) {
150 // TODO(asargent) - Remove this in a couple of months. (See comment above 151 // TODO(asargent) - Remove this in a couple of months. (See comment above
151 // CleanupBadExtensionKeys). 152 // CleanupBadExtensionKeys).
152 CleanupBadExtensionKeys(prefs_); 153 CleanupBadExtensionKeys(prefs_);
153 154
154 MakePathsRelative(); 155 MakePathsRelative();
155 156
156 InitPrefStore(); 157 InitPrefStore();
157 } 158 }
158 159
159 ExtensionPrefs::~ExtensionPrefs() {} 160 ExtensionPrefs::~ExtensionPrefs() {}
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 extension->path(), NULL); 690 extension->path(), NULL);
690 UpdateExtensionPref(id, kPrefPath, Value::CreateStringValue(path)); 691 UpdateExtensionPref(id, kPrefPath, Value::CreateStringValue(path));
691 // We store prefs about LOAD extensions, but don't cache their manifest 692 // We store prefs about LOAD extensions, but don't cache their manifest
692 // since it may change on disk. 693 // since it may change on disk.
693 if (extension->location() != Extension::LOAD) { 694 if (extension->location() != Extension::LOAD) {
694 UpdateExtensionPref(id, kPrefManifest, 695 UpdateExtensionPref(id, kPrefManifest,
695 extension->manifest_value()->DeepCopy()); 696 extension->manifest_value()->DeepCopy());
696 } 697 }
697 UpdateExtensionPref(id, kPrefAppLaunchIndex, 698 UpdateExtensionPref(id, kPrefAppLaunchIndex,
698 Value::CreateIntegerValue(GetNextAppLaunchIndex())); 699 Value::CreateIntegerValue(GetNextAppLaunchIndex()));
700 extension_pref_value_map_->RegisterExtension(
701 id, install_time, initial_state == Extension::ENABLED);
699 SavePrefsAndNotify(); 702 SavePrefsAndNotify();
700 } 703 }
701 704
702 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, 705 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id,
703 const Extension::Location& location, 706 const Extension::Location& location,
704 bool external_uninstall) { 707 bool external_uninstall) {
705 PrefKeySet pref_keys;
706 GetExtensionControlledPrefKeys(extension_id, &pref_keys);
707
708 // For external extensions, we save a preference reminding ourself not to try 708 // For external extensions, we save a preference reminding ourself not to try
709 // and install the extension anymore (except when |external_uninstall| is 709 // and install the extension anymore (except when |external_uninstall| is
710 // true, which signifies that the registry key was deleted or the pref file 710 // true, which signifies that the registry key was deleted or the pref file
711 // no longer lists the extension). 711 // no longer lists the extension).
712 if (!external_uninstall && Extension::IsExternalLocation(location)) { 712 if (!external_uninstall && Extension::IsExternalLocation(location)) {
713 UpdateExtensionPref(extension_id, kPrefState, 713 UpdateExtensionPref(extension_id, kPrefState,
714 Value::CreateIntegerValue(Extension::KILLBIT)); 714 Value::CreateIntegerValue(Extension::KILLBIT));
715 SavePrefsAndNotify(); 715 SavePrefsAndNotify();
716 extension_pref_value_map_->SetExtensionState(extension_id, false);
716 } else { 717 } else {
717 DeleteExtensionPrefs(extension_id); 718 DeleteExtensionPrefs(extension_id);
718 } 719 }
719
720 UpdatePrefStore(pref_keys);
721 } 720 }
722 721
723 Extension::State ExtensionPrefs::GetExtensionState( 722 Extension::State ExtensionPrefs::GetExtensionState(
724 const std::string& extension_id) const { 723 const std::string& extension_id) const {
725 DictionaryValue* extension = GetExtensionPref(extension_id); 724 DictionaryValue* extension = GetExtensionPref(extension_id);
726 725
727 // If the extension doesn't have a pref, it's a --load-extension. 726 // If the extension doesn't have a pref, it's a --load-extension.
728 if (!extension) 727 if (!extension)
729 return Extension::ENABLED; 728 return Extension::ENABLED;
730 729
731 int state = -1; 730 int state = -1;
732 if (!extension->GetInteger(kPrefState, &state) || 731 if (!extension->GetInteger(kPrefState, &state) ||
733 state < 0 || state >= Extension::NUM_STATES) { 732 state < 0 || state >= Extension::NUM_STATES) {
734 LOG(ERROR) << "Bad or missing pref 'state' for extension '" 733 LOG(ERROR) << "Bad or missing pref 'state' for extension '"
735 << extension_id << "'"; 734 << extension_id << "'";
736 return Extension::ENABLED; 735 return Extension::ENABLED;
737 } 736 }
738 return static_cast<Extension::State>(state); 737 return static_cast<Extension::State>(state);
739 } 738 }
740 739
741 void ExtensionPrefs::SetExtensionState(const Extension* extension, 740 void ExtensionPrefs::SetExtensionState(const Extension* extension,
742 Extension::State state) { 741 Extension::State state) {
743 UpdateExtensionPref(extension->id(), kPrefState, 742 UpdateExtensionPref(extension->id(), kPrefState,
744 Value::CreateIntegerValue(state)); 743 Value::CreateIntegerValue(state));
744 SavePrefsAndNotify();
745 745
746 PrefKeySet pref_keys; 746 bool enabled = (state == Extension::ENABLED);
747 GetExtensionControlledPrefKeys(extension->id(), &pref_keys); 747 extension_pref_value_map_->SetExtensionState(extension->id(), enabled);
748 UpdatePrefStore(pref_keys);
749
750 SavePrefsAndNotify();
751 } 748 }
752 749
753 bool ExtensionPrefs::GetBrowserActionVisibility(const Extension* extension) { 750 bool ExtensionPrefs::GetBrowserActionVisibility(const Extension* extension) {
754 DictionaryValue* extension_prefs = GetExtensionPref(extension->id()); 751 DictionaryValue* extension_prefs = GetExtensionPref(extension->id());
755 if (!extension_prefs) 752 if (!extension_prefs)
756 return true; 753 return true;
757 bool visible = false; 754 bool visible = false;
758 if (!extension_prefs->GetBoolean(kBrowserActionVisible, &visible) || visible) 755 if (!extension_prefs->GetBoolean(kBrowserActionVisible, &visible) || visible)
759 return true; 756 return true;
760 757
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 DictionaryValue* extension = GetOrCreateExtensionPref(extension_id); 817 DictionaryValue* extension = GetOrCreateExtensionPref(extension_id);
821 extension->Set(key, data_value); 818 extension->Set(key, data_value);
822 } 819 }
823 820
824 void ExtensionPrefs::DeleteExtensionPrefs(const std::string& extension_id) { 821 void ExtensionPrefs::DeleteExtensionPrefs(const std::string& extension_id) {
825 DictionaryValue* dict = prefs_->GetMutableDictionary(kExtensionsPref); 822 DictionaryValue* dict = prefs_->GetMutableDictionary(kExtensionsPref);
826 if (dict->HasKey(extension_id)) { 823 if (dict->HasKey(extension_id)) {
827 dict->Remove(extension_id, NULL); 824 dict->Remove(extension_id, NULL);
828 SavePrefsAndNotify(); 825 SavePrefsAndNotify();
829 } 826 }
827 extension_pref_value_map_->UnregisterExtension(extension_id);
830 } 828 }
831 829
832 DictionaryValue* ExtensionPrefs::GetOrCreateExtensionPref( 830 DictionaryValue* ExtensionPrefs::GetOrCreateExtensionPref(
833 const std::string& extension_id) { 831 const std::string& extension_id) {
834 DCHECK(Extension::IdIsValid(extension_id)); 832 DCHECK(Extension::IdIsValid(extension_id));
835 DictionaryValue* dict = prefs_->GetMutableDictionary(kExtensionsPref); 833 DictionaryValue* dict = prefs_->GetMutableDictionary(kExtensionsPref);
836 DictionaryValue* extension = NULL; 834 DictionaryValue* extension = NULL;
837 if (!dict->GetDictionary(extension_id, &extension)) { 835 if (!dict->GetDictionary(extension_id, &extension)) {
838 // Extension pref does not exist, create it. 836 // Extension pref does not exist, create it.
839 extension = new DictionaryValue(); 837 extension = new DictionaryValue();
840 dict->Set(extension_id, extension); 838 dict->Set(extension_id, extension);
841 } 839 }
842 return extension; 840 return extension;
843 } 841 }
844 842
845 DictionaryValue* ExtensionPrefs::GetExtensionPref( 843 DictionaryValue* ExtensionPrefs::GetExtensionPref(
846 const std::string& extension_id) const { 844 const std::string& extension_id) const {
847 const DictionaryValue* dict = prefs_->GetDictionary(kExtensionsPref); 845 const DictionaryValue* dict = prefs_->GetDictionary(kExtensionsPref);
848 if (!dict) 846 if (!dict)
849 return NULL; 847 return NULL;
850 DictionaryValue* extension = NULL; 848 DictionaryValue* extension = NULL;
851 dict->GetDictionary(extension_id, &extension); 849 dict->GetDictionary(extension_id, &extension);
852 return extension; 850 return extension;
853 } 851 }
854 852
855 DictionaryValue* ExtensionPrefs::GetExtensionControlledPrefs(
856 const std::string& extension_id) const {
857 DictionaryValue* extension = GetExtensionPref(extension_id);
858 if (!extension) {
859 NOTREACHED();
860 return NULL;
861 }
862 DictionaryValue* preferences = NULL;
863 extension->GetDictionary(kPrefPreferences, &preferences);
864 return preferences;
865 }
866
867 // Helper function for GetInstalledExtensionsInfo. 853 // Helper function for GetInstalledExtensionsInfo.
868 static ExtensionInfo* GetInstalledExtensionInfoImpl( 854 static ExtensionInfo* GetInstalledExtensionInfoImpl(
869 DictionaryValue* extension_data, 855 DictionaryValue* extension_data,
870 DictionaryValue::key_iterator extension_id) { 856 DictionaryValue::key_iterator extension_id) {
871 DictionaryValue* ext; 857 DictionaryValue* ext;
872 if (!extension_data->GetDictionaryWithoutPathExpansion(*extension_id, &ext)) { 858 if (!extension_data->GetDictionaryWithoutPathExpansion(*extension_id, &ext)) {
873 LOG(WARNING) << "Invalid pref for extension " << *extension_id; 859 LOG(WARNING) << "Invalid pref for extension " << *extension_id;
874 NOTREACHED(); 860 NOTREACHED();
875 return NULL; 861 return NULL;
876 } 862 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 } 1122 }
1137 std::string install_time_str; 1123 std::string install_time_str;
1138 if (!extension->GetString(kPrefInstallTime, &install_time_str)) 1124 if (!extension->GetString(kPrefInstallTime, &install_time_str))
1139 return base::Time(); 1125 return base::Time();
1140 int64 install_time_i64 = 0; 1126 int64 install_time_i64 = 0;
1141 if (!base::StringToInt64(install_time_str, &install_time_i64)) 1127 if (!base::StringToInt64(install_time_str, &install_time_i64))
1142 return base::Time(); 1128 return base::Time();
1143 return base::Time::FromInternalValue(install_time_i64); 1129 return base::Time::FromInternalValue(install_time_i64);
1144 } 1130 }
1145 1131
1146 void ExtensionPrefs::GetEnabledExtensions(ExtensionIdSet* out) const { 1132 void ExtensionPrefs::GetExtensions(ExtensionIdSet* out) const {
1147 CHECK(out); 1133 CHECK(out);
1148 const DictionaryValue* extensions = 1134 const DictionaryValue* extensions =
1149 pref_service()->GetDictionary(kExtensionsPref); 1135 pref_service()->GetDictionary(kExtensionsPref);
1150 1136
1151 for (DictionaryValue::key_iterator ext_id = extensions->begin_keys(); 1137 for (DictionaryValue::key_iterator ext_id = extensions->begin_keys();
1152 ext_id != extensions->end_keys(); ++ext_id) { 1138 ext_id != extensions->end_keys(); ++ext_id) {
1153 if (GetExtensionState(*ext_id) != Extension::ENABLED)
1154 continue;
1155 out->push_back(*ext_id); 1139 out->push_back(*ext_id);
1156 } 1140 }
1157 } 1141 }
1158 1142
1159 void ExtensionPrefs::FixMissingPrefs(const ExtensionIdSet& extension_ids) { 1143 void ExtensionPrefs::FixMissingPrefs(const ExtensionIdSet& extension_ids) {
1160 // Fix old entries that did not get an installation time entry when they 1144 // Fix old entries that did not get an installation time entry when they
1161 // were installed or don't have a preferences field. 1145 // were installed or don't have a preferences field.
1162 bool persist_required = false; 1146 bool persist_required = false;
1163 for (ExtensionIdSet::const_iterator ext_id = extension_ids.begin(); 1147 for (ExtensionIdSet::const_iterator ext_id = extension_ids.begin();
1164 ext_id != extension_ids.end(); ++ext_id) { 1148 ext_id != extension_ids.end(); ++ext_id) {
1165 DictionaryValue* extension = GetExtensionPref(*ext_id); 1149 DictionaryValue* extension = GetExtensionPref(*ext_id);
1166 CHECK(extension); 1150 CHECK(extension);
1167 1151
1168 if (GetInstallTime(*ext_id) == base::Time()) { 1152 if (GetInstallTime(*ext_id) == base::Time()) {
1169 LOG(INFO) << "Could not parse installation time of extension " 1153 LOG(INFO) << "Could not parse installation time of extension "
1170 << *ext_id << ". It was probably installed before setting " 1154 << *ext_id << ". It was probably installed before setting "
1171 << kPrefInstallTime << " was introduced. Updating " 1155 << kPrefInstallTime << " was introduced. Updating "
1172 << kPrefInstallTime << " to the current time."; 1156 << kPrefInstallTime << " to the current time.";
1173 const base::Time install_time = GetCurrentTime(); 1157 const base::Time install_time = GetCurrentTime();
1174 extension->Set(kPrefInstallTime, 1158 extension->Set(kPrefInstallTime,
1175 Value::CreateStringValue( 1159 Value::CreateStringValue(
1176 base::Int64ToString(install_time.ToInternalValue()))); 1160 base::Int64ToString(install_time.ToInternalValue())));
1177 persist_required = true; 1161 persist_required = true;
1178 } 1162 }
1179 } 1163 }
1180 if (persist_required) 1164 if (persist_required)
1181 SavePrefsAndNotify(); 1165 SavePrefsAndNotify();
1182 } 1166 }
1183 1167
1168 DictionaryValue* ExtensionPrefs::GetExtensionControlledPrefs(
1169 const std::string& extension_id) const {
1170 DictionaryValue* source_dict = prefs_->GetMutableDictionary(kExtensionsPref);
1171 DictionaryValue* preferences = NULL;
1172 std::string key = extension_id + std::string(".") + kPrefPreferences;
1173 if (!source_dict->GetDictionary(key, &preferences)) {
1174 source_dict->Set(key, new DictionaryValue);
1175 bool success = source_dict->GetDictionary(key, &preferences);
1176 DCHECK(success);
1177 }
1178 return preferences;
1179 }
1180
1184 void ExtensionPrefs::InitPrefStore() { 1181 void ExtensionPrefs::InitPrefStore() {
1185 // When this is called, the PrefService is initialized and provides access 1182 // When this is called, the PrefService is initialized and provides access
1186 // to the user preferences stored in a JSON file. 1183 // to the user preferences stored in a JSON file.
1187 ExtensionIdSet extension_ids; 1184 ExtensionIdSet extension_ids;
1188 GetEnabledExtensions(&extension_ids); 1185 GetExtensions(&extension_ids);
1189 FixMissingPrefs(extension_ids); 1186 FixMissingPrefs(extension_ids);
1190 1187
1191 // Collect the unique extension controlled preference keys of all extensions. 1188 // Store winning preference for each extension controlled preference.
Mattias Nissler (ping if slow) 2011/01/21 08:53:08 Are you really storing the winning preference? AFA
battre 2011/01/24 17:47:18 Done.
1192 PrefKeySet ext_controlled_prefs;
1193 for (ExtensionIdSet::iterator ext_id = extension_ids.begin(); 1189 for (ExtensionIdSet::iterator ext_id = extension_ids.begin();
1194 ext_id != extension_ids.end(); ++ext_id) { 1190 ext_id != extension_ids.end(); ++ext_id) {
1195 GetExtensionControlledPrefKeys(*ext_id, &ext_controlled_prefs); 1191 extension_pref_value_map_->RegisterExtension(
1196 } 1192 *ext_id,
1193 GetInstallTime(*ext_id),
1194 GetExtensionState(*ext_id) == Extension::ENABLED);
1197 1195
1198 // Store winning preference for each extension controlled preference. 1196 DictionaryValue* prefs = GetExtensionControlledPrefs(*ext_id);
1199 UpdatePrefStore(ext_controlled_prefs); 1197 for (DictionaryValue::key_iterator i = prefs->begin_keys();
1200 pref_store_->OnInitializationCompleted(); 1198 i != prefs->end_keys(); ++i) {
1201 } 1199 Value* value;
1202 1200 if (!prefs->GetWithoutPathExpansion(*i, &value))
1203 const Value* ExtensionPrefs::GetWinningExtensionControlledPrefValue( 1201 continue;
1204 const std::string& key) const { 1202 extension_pref_value_map_->SetExtensionPref(
1205 Value *winner = NULL; 1203 *ext_id, *i, false, value->DeepCopy());
1206 base::Time winners_install_time = base::Time();
1207
1208 ExtensionIdSet extension_ids;
1209 GetEnabledExtensions(&extension_ids);
1210 for (ExtensionIdSet::iterator ext_id = extension_ids.begin();
1211 ext_id != extension_ids.end(); ++ext_id) {
1212 base::Time extension_install_time = GetInstallTime(*ext_id);
1213
1214 // We do not need to consider extensions that were installed before the
1215 // most recent extension found that provides the requested preference.
1216 if (extension_install_time < winners_install_time)
1217 continue;
1218
1219 DictionaryValue* preferences = GetExtensionControlledPrefs(*ext_id);
1220 Value *value = NULL;
1221 if (preferences && preferences->GetWithoutPathExpansion(key, &value)) {
1222 // This extension is more recent than the last one providing this pref.
1223 winner = value;
1224 winners_install_time = extension_install_time;
1225 } 1204 }
1226 } 1205 }
1227 1206
1228 return winner; 1207 extension_pref_value_map_->NotifyInitializationCompleted();
1229 } 1208 }
1230 1209
1231 void ExtensionPrefs::UpdatePrefStore(
1232 const ExtensionPrefs::PrefKeySet& pref_keys) {
1233 for (PrefKeySet::const_iterator i = pref_keys.begin();
1234 i != pref_keys.end(); ++i) {
1235 UpdatePrefStore(*i);
1236 }
1237 }
1238
1239 void ExtensionPrefs::UpdatePrefStore(const std::string& pref_key) {
1240 if (pref_store_ == NULL)
1241 return;
1242 const Value* winning_pref_value =
1243 GetWinningExtensionControlledPrefValue(pref_key);
1244
1245 if (winning_pref_value)
1246 pref_store_->SetExtensionPref(pref_key, winning_pref_value->DeepCopy());
1247 else
1248 pref_store_->RemoveExtensionPref(pref_key);
1249 }
1250 1210
1251 void ExtensionPrefs::SetExtensionControlledPref(const std::string& extension_id, 1211 void ExtensionPrefs::SetExtensionControlledPref(const std::string& extension_id,
1252 const std::string& pref_key, 1212 const std::string& pref_key,
1213 bool incognito,
1253 Value* value) { 1214 Value* value) {
1254 scoped_ptr<Value> scoped_value(value);
1255 DCHECK(pref_service()->FindPreference(pref_key.c_str())) 1215 DCHECK(pref_service()->FindPreference(pref_key.c_str()))
1256 << "Extension controlled preference key " << pref_key 1216 << "Extension controlled preference key " << pref_key
1257 << " not registered."; 1217 << " not registered.";
1258 DictionaryValue* extension_preferences =
1259 GetExtensionControlledPrefs(extension_id);
1260 1218
1261 if (extension_preferences == NULL) { // May be pruned when writing to disk. 1219 if (!incognito) {
1262 DictionaryValue* extension = GetExtensionPref(extension_id); 1220 // Also store in persisted Preferences file to recover after a
1263 if (extension == NULL) { 1221 // browser restart.
1264 LOG(ERROR) << "Extension preference for " << extension_id << " undefined"; 1222 DictionaryValue* dict = GetExtensionControlledPrefs(extension_id);
1265 return; 1223 dict->SetWithoutPathExpansion(pref_key, value->DeepCopy());
1266 } 1224 pref_service()->ScheduleSavePersistentPrefs();
1267 extension_preferences = new DictionaryValue;
1268 extension->Set(kPrefPreferences, extension_preferences);
1269 } 1225 }
1270 1226
1271 Value* oldValue = NULL; 1227 extension_pref_value_map_->SetExtensionPref(
1272 extension_preferences->GetWithoutPathExpansion(pref_key, &oldValue); 1228 extension_id, pref_key, incognito, value);
1273 bool modified = !Value::Equals(oldValue, scoped_value.get());
1274 if (!modified)
1275 return;
1276
1277 if (scoped_value.get() == NULL)
1278 extension_preferences->RemoveWithoutPathExpansion(pref_key, NULL);
1279 else
1280 extension_preferences->SetWithoutPathExpansion(pref_key,
1281 scoped_value.release());
1282 pref_service()->ScheduleSavePersistentPrefs();
1283
1284 UpdatePrefStore(pref_key);
1285 }
1286
1287 void ExtensionPrefs::GetExtensionControlledPrefKeys(
1288 const std::string& extension_id, PrefKeySet *out) const {
1289 DCHECK(out != NULL);
1290 DictionaryValue* ext_prefs = GetExtensionControlledPrefs(extension_id);
1291 if (ext_prefs) {
1292 for (DictionaryValue::key_iterator i = ext_prefs->begin_keys();
1293 i != ext_prefs->end_keys(); ++i) {
1294 out->insert(*i);
1295 }
1296 }
1297 } 1229 }
1298 1230
1299 // static 1231 // static
1300 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { 1232 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) {
1301 prefs->RegisterDictionaryPref(kExtensionsPref); 1233 prefs->RegisterDictionaryPref(kExtensionsPref);
1302 prefs->RegisterListPref(kExtensionToolbar); 1234 prefs->RegisterListPref(kExtensionToolbar);
1303 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); 1235 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1);
1304 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); 1236 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate);
1305 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); 1237 prefs->RegisterListPref(prefs::kExtensionInstallAllowList);
1306 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); 1238 prefs->RegisterListPref(prefs::kExtensionInstallDenyList);
1307 prefs->RegisterListPref(prefs::kExtensionInstallForceList); 1239 prefs->RegisterListPref(prefs::kExtensionInstallForceList);
1308 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); 1240 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */);
1309 } 1241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698