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/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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 extension_sorting_->SetPageOrdinal(id, new_page_ordinal); | 1109 extension_sorting_->SetPageOrdinal(id, new_page_ordinal); |
1110 if (!extension_sorting_->GetAppLaunchOrdinal(id).IsValid()) | 1110 if (!extension_sorting_->GetAppLaunchOrdinal(id).IsValid()) |
1111 extension_sorting_->SetAppLaunchOrdinal( | 1111 extension_sorting_->SetAppLaunchOrdinal( |
1112 id, extension_sorting_->CreateNextAppLaunchOrdinal(new_page_ordinal)); | 1112 id, extension_sorting_->CreateNextAppLaunchOrdinal(new_page_ordinal)); |
1113 } | 1113 } |
1114 | 1114 |
1115 extension_pref_value_map_->RegisterExtension( | 1115 extension_pref_value_map_->RegisterExtension( |
1116 id, install_time, initial_state == Extension::ENABLED); | 1116 id, install_time, initial_state == Extension::ENABLED); |
1117 content_settings_store_->RegisterExtension( | 1117 content_settings_store_->RegisterExtension( |
1118 id, install_time, initial_state == Extension::ENABLED); | 1118 id, install_time, initial_state == Extension::ENABLED); |
| 1119 |
| 1120 // Unpacked extensions default to allowing file access, but if that has been |
| 1121 // overridden, don't reset the value. |
| 1122 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && |
| 1123 !HasAllowFileAccessSetting(id)) { |
| 1124 SetAllowFileAccess(id, true); |
| 1125 } |
| 1126 |
| 1127 // If the extension should automatically block network startup (e.g., it uses |
| 1128 // the webRequest API), set the preference. Otherwise clear it, in case the |
| 1129 // extension stopped using a relevant API. |
| 1130 SetDelaysNetworkRequests(id, extension->ImplicitlyDelaysNetworkStartup()); |
1119 } | 1131 } |
1120 | 1132 |
1121 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, | 1133 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, |
1122 const Extension::Location& location, | 1134 const Extension::Location& location, |
1123 bool external_uninstall) { | 1135 bool external_uninstall) { |
1124 extension_sorting_->ClearOrdinals(extension_id); | 1136 extension_sorting_->ClearOrdinals(extension_id); |
1125 | 1137 |
1126 // For external extensions, we save a preference reminding ourself not to try | 1138 // For external extensions, we save a preference reminding ourself not to try |
1127 // and install the extension anymore (except when |external_uninstall| is | 1139 // and install the extension anymore (except when |external_uninstall| is |
1128 // true, which signifies that the registry key was deleted or the pref file | 1140 // true, which signifies that the registry key was deleted or the pref file |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, | 1759 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, |
1748 PrefService::UNSYNCABLE_PREF); | 1760 PrefService::UNSYNCABLE_PREF); |
1749 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, | 1761 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, |
1750 PrefService::UNSYNCABLE_PREF); | 1762 PrefService::UNSYNCABLE_PREF); |
1751 prefs->RegisterListPref(prefs::kExtensionInstallForceList, | 1763 prefs->RegisterListPref(prefs::kExtensionInstallForceList, |
1752 PrefService::UNSYNCABLE_PREF); | 1764 PrefService::UNSYNCABLE_PREF); |
1753 prefs->RegisterStringPref(kWebStoreLogin, | 1765 prefs->RegisterStringPref(kWebStoreLogin, |
1754 std::string() /* default_value */, | 1766 std::string() /* default_value */, |
1755 PrefService::UNSYNCABLE_PREF); | 1767 PrefService::UNSYNCABLE_PREF); |
1756 } | 1768 } |
OLD | NEW |