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_prefs.h" | 5 #include "chrome/browser/extensions/extension_prefs.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_notifier.h" | 8 #include "base/prefs/pref_notifier.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 | 2096 |
2097 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) { | 2097 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) { |
2098 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value); | 2098 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value); |
2099 } | 2099 } |
2100 | 2100 |
2101 bool ExtensionPrefs::NeedsStorageGarbageCollection() { | 2101 bool ExtensionPrefs::NeedsStorageGarbageCollection() { |
2102 return prefs_->GetBoolean(prefs::kExtensionStorageGarbageCollect); | 2102 return prefs_->GetBoolean(prefs::kExtensionStorageGarbageCollect); |
2103 } | 2103 } |
2104 | 2104 |
2105 // static | 2105 // static |
2106 void ExtensionPrefs::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 2106 void ExtensionPrefs::RegisterUserPrefs( |
2107 registry->RegisterDictionaryPref(kExtensionsPref, | 2107 user_prefs::PrefRegistrySyncable* registry) { |
2108 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2108 registry->RegisterDictionaryPref( |
| 2109 kExtensionsPref, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2109 registry->RegisterListPref(prefs::kExtensionToolbar, | 2110 registry->RegisterListPref(prefs::kExtensionToolbar, |
2110 PrefRegistrySyncable::SYNCABLE_PREF); | 2111 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
2111 registry->RegisterIntegerPref(prefs::kExtensionToolbarSize, | 2112 registry->RegisterIntegerPref( |
2112 -1, // default value | 2113 prefs::kExtensionToolbarSize, |
2113 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2114 -1, // default value |
2114 registry->RegisterDictionaryPref(kExtensionsBlacklistUpdate, | 2115 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2115 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2116 registry->RegisterDictionaryPref( |
| 2117 kExtensionsBlacklistUpdate, |
| 2118 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2116 registry->RegisterListPref(prefs::kExtensionInstallAllowList, | 2119 registry->RegisterListPref(prefs::kExtensionInstallAllowList, |
2117 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2120 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2118 registry->RegisterListPref(prefs::kExtensionInstallDenyList, | 2121 registry->RegisterListPref(prefs::kExtensionInstallDenyList, |
2119 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2122 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2120 registry->RegisterDictionaryPref(prefs::kExtensionInstallForceList, | 2123 registry->RegisterDictionaryPref( |
2121 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2124 prefs::kExtensionInstallForceList, |
| 2125 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2122 registry->RegisterListPref(prefs::kExtensionAllowedTypes, | 2126 registry->RegisterListPref(prefs::kExtensionAllowedTypes, |
2123 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2127 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2124 registry->RegisterStringPref(kWebStoreLogin, | 2128 registry->RegisterStringPref( |
2125 std::string(), // default value | 2129 kWebStoreLogin, |
2126 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2130 std::string(), // default value |
2127 registry->RegisterStringPref(prefs::kExtensionBlacklistUpdateVersion, | 2131 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2128 "0", // default value | 2132 registry->RegisterStringPref( |
2129 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2133 prefs::kExtensionBlacklistUpdateVersion, |
2130 registry->RegisterBooleanPref(prefs::kExtensionStorageGarbageCollect, | 2134 "0", // default value |
2131 false, // default value | 2135 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2132 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2136 registry->RegisterBooleanPref( |
2133 registry->RegisterInt64Pref(prefs::kLastExtensionsUpdateCheck, | 2137 prefs::kExtensionStorageGarbageCollect, |
2134 0, // default value | 2138 false, // default value |
2135 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2139 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2136 registry->RegisterInt64Pref(prefs::kNextExtensionsUpdateCheck, | 2140 registry->RegisterInt64Pref( |
2137 0, // default value | 2141 prefs::kLastExtensionsUpdateCheck, |
2138 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2142 0, // default value |
| 2143 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 2144 registry->RegisterInt64Pref( |
| 2145 prefs::kNextExtensionsUpdateCheck, |
| 2146 0, // default value |
| 2147 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2139 registry->RegisterListPref(prefs::kExtensionAllowedInstallSites, | 2148 registry->RegisterListPref(prefs::kExtensionAllowedInstallSites, |
2140 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2149 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2141 registry->RegisterStringPref(kExtensionsLastChromeVersion, | 2150 registry->RegisterStringPref( |
2142 std::string(), // default value | 2151 kExtensionsLastChromeVersion, |
2143 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2152 std::string(), // default value |
| 2153 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2144 | 2154 |
2145 #if defined (TOOLKIT_VIEWS) | 2155 #if defined(TOOLKIT_VIEWS) |
2146 registry->RegisterIntegerPref(prefs::kBrowserActionContainerWidth, | 2156 registry->RegisterIntegerPref( |
2147 0, | 2157 prefs::kBrowserActionContainerWidth, |
2148 PrefRegistrySyncable::UNSYNCABLE_PREF); | 2158 0, |
| 2159 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
2149 #endif | 2160 #endif |
2150 } | 2161 } |
2151 | 2162 |
2152 ExtensionIdList ExtensionPrefs::GetExtensionPrefAsVector( | 2163 ExtensionIdList ExtensionPrefs::GetExtensionPrefAsVector( |
2153 const char* pref) { | 2164 const char* pref) { |
2154 ExtensionIdList extension_ids; | 2165 ExtensionIdList extension_ids; |
2155 const ListValue* list_of_values = prefs_->GetList(pref); | 2166 const ListValue* list_of_values = prefs_->GetList(pref); |
2156 if (!list_of_values) | 2167 if (!list_of_values) |
2157 return extension_ids; | 2168 return extension_ids; |
2158 | 2169 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 is_enabled = initial_state == Extension::ENABLED; | 2259 is_enabled = initial_state == Extension::ENABLED; |
2249 } | 2260 } |
2250 | 2261 |
2251 extension_pref_value_map_->RegisterExtension(extension_id, install_time, | 2262 extension_pref_value_map_->RegisterExtension(extension_id, install_time, |
2252 is_enabled); | 2263 is_enabled); |
2253 content_settings_store_->RegisterExtension(extension_id, install_time, | 2264 content_settings_store_->RegisterExtension(extension_id, install_time, |
2254 is_enabled); | 2265 is_enabled); |
2255 } | 2266 } |
2256 | 2267 |
2257 } // namespace extensions | 2268 } // namespace extensions |
OLD | NEW |