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

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

Powered by Google App Engine
This is Rietveld 408576698