| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_management.h" | 5 #include "chrome/browser/extensions/extension_management.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 *required_version = iter->second->minimum_version_required->GetString(); | 243 *required_version = iter->second->minimum_version_required->GetString(); |
| 244 return meets_requirement; | 244 return meets_requirement; |
| 245 } | 245 } |
| 246 | 246 |
| 247 void ExtensionManagement::Refresh() { | 247 void ExtensionManagement::Refresh() { |
| 248 TRACE_EVENT0("browser,startup", "ExtensionManagement::Refresh"); | 248 TRACE_EVENT0("browser,startup", "ExtensionManagement::Refresh"); |
| 249 SCOPED_UMA_HISTOGRAM_TIMER("Extensions.ExtensionManagement_RefreshTime"); | 249 SCOPED_UMA_HISTOGRAM_TIMER("Extensions.ExtensionManagement_RefreshTime"); |
| 250 // Load all extension management settings preferences. | 250 // Load all extension management settings preferences. |
| 251 const base::ListValue* allowed_list_pref = | 251 const base::ListValue* allowed_list_pref = |
| 252 static_cast<const base::ListValue*>(LoadPreference( | 252 static_cast<const base::ListValue*>(LoadPreference( |
| 253 pref_names::kInstallAllowList, true, base::Value::TYPE_LIST)); | 253 pref_names::kInstallAllowList, true, base::Value::Type::LIST)); |
| 254 // Allow user to use preference to block certain extensions. Note that policy | 254 // Allow user to use preference to block certain extensions. Note that policy |
| 255 // managed forcelist or whitelist will always override this. | 255 // managed forcelist or whitelist will always override this. |
| 256 const base::ListValue* denied_list_pref = | 256 const base::ListValue* denied_list_pref = |
| 257 static_cast<const base::ListValue*>(LoadPreference( | 257 static_cast<const base::ListValue*>(LoadPreference( |
| 258 pref_names::kInstallDenyList, false, base::Value::TYPE_LIST)); | 258 pref_names::kInstallDenyList, false, base::Value::Type::LIST)); |
| 259 const base::DictionaryValue* forced_list_pref = | 259 const base::DictionaryValue* forced_list_pref = |
| 260 static_cast<const base::DictionaryValue*>(LoadPreference( | 260 static_cast<const base::DictionaryValue*>(LoadPreference( |
| 261 pref_names::kInstallForceList, true, base::Value::TYPE_DICTIONARY)); | 261 pref_names::kInstallForceList, true, base::Value::Type::DICTIONARY)); |
| 262 const base::ListValue* install_sources_pref = | 262 const base::ListValue* install_sources_pref = |
| 263 static_cast<const base::ListValue*>(LoadPreference( | 263 static_cast<const base::ListValue*>(LoadPreference( |
| 264 pref_names::kAllowedInstallSites, true, base::Value::TYPE_LIST)); | 264 pref_names::kAllowedInstallSites, true, base::Value::Type::LIST)); |
| 265 const base::ListValue* allowed_types_pref = | 265 const base::ListValue* allowed_types_pref = |
| 266 static_cast<const base::ListValue*>(LoadPreference( | 266 static_cast<const base::ListValue*>(LoadPreference( |
| 267 pref_names::kAllowedTypes, true, base::Value::TYPE_LIST)); | 267 pref_names::kAllowedTypes, true, base::Value::Type::LIST)); |
| 268 const base::DictionaryValue* dict_pref = | 268 const base::DictionaryValue* dict_pref = |
| 269 static_cast<const base::DictionaryValue*>( | 269 static_cast<const base::DictionaryValue*>( |
| 270 LoadPreference(pref_names::kExtensionManagement, | 270 LoadPreference(pref_names::kExtensionManagement, |
| 271 true, | 271 true, |
| 272 base::Value::TYPE_DICTIONARY)); | 272 base::Value::Type::DICTIONARY)); |
| 273 | 273 |
| 274 // Reset all settings. | 274 // Reset all settings. |
| 275 global_settings_.reset(new internal::GlobalSettings()); | 275 global_settings_.reset(new internal::GlobalSettings()); |
| 276 settings_by_id_.clear(); | 276 settings_by_id_.clear(); |
| 277 default_settings_.reset(new internal::IndividualSettings()); | 277 default_settings_.reset(new internal::IndividualSettings()); |
| 278 | 278 |
| 279 // Parse default settings. | 279 // Parse default settings. |
| 280 const base::StringValue wildcard("*"); | 280 const base::StringValue wildcard("*"); |
| 281 if (denied_list_pref && | 281 if (denied_list_pref && |
| 282 denied_list_pref->Find(wildcard) != denied_list_pref->end()) { | 282 denied_list_pref->Find(wildcard) != denied_list_pref->end()) { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 content::BrowserContext* context) const { | 497 content::BrowserContext* context) const { |
| 498 return chrome::GetBrowserContextRedirectedInIncognito(context); | 498 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 499 } | 499 } |
| 500 | 500 |
| 501 void ExtensionManagementFactory::RegisterProfilePrefs( | 501 void ExtensionManagementFactory::RegisterProfilePrefs( |
| 502 user_prefs::PrefRegistrySyncable* user_prefs) { | 502 user_prefs::PrefRegistrySyncable* user_prefs) { |
| 503 user_prefs->RegisterDictionaryPref(pref_names::kExtensionManagement); | 503 user_prefs->RegisterDictionaryPref(pref_names::kExtensionManagement); |
| 504 } | 504 } |
| 505 | 505 |
| 506 } // namespace extensions | 506 } // namespace extensions |
| OLD | NEW |