Chromium Code Reviews| 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/prefs/pref_notifier.h" | 7 #include "base/prefs/pref_notifier.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1172 blacklist_state, extension_dict); | 1172 blacklist_state, extension_dict); |
| 1173 FinishExtensionInfoPrefs(extension->id(), install_time, | 1173 FinishExtensionInfoPrefs(extension->id(), install_time, |
| 1174 extension->RequiresSortOrdinal(), | 1174 extension->RequiresSortOrdinal(), |
| 1175 page_ordinal, extension_dict); | 1175 page_ordinal, extension_dict); |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, | 1178 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, |
| 1179 const Manifest::Location& location, | 1179 const Manifest::Location& location, |
| 1180 bool external_uninstall) { | 1180 bool external_uninstall) { |
| 1181 extension_sorting_->ClearOrdinals(extension_id); | 1181 extension_sorting_->ClearOrdinals(extension_id); |
| 1182 app_list_extension_sorting_->Erase(extension_id); | |
| 1182 | 1183 |
| 1183 // For external extensions, we save a preference reminding ourself not to try | 1184 // For external extensions, we save a preference reminding ourself not to try |
| 1184 // and install the extension anymore (except when |external_uninstall| is | 1185 // and install the extension anymore (except when |external_uninstall| is |
| 1185 // true, which signifies that the registry key was deleted or the pref file | 1186 // true, which signifies that the registry key was deleted or the pref file |
| 1186 // no longer lists the extension). | 1187 // no longer lists the extension). |
| 1187 if (!external_uninstall && Manifest::IsExternalLocation(location)) { | 1188 if (!external_uninstall && Manifest::IsExternalLocation(location)) { |
| 1188 UpdateExtensionPref(extension_id, kPrefState, | 1189 UpdateExtensionPref(extension_id, kPrefState, |
| 1189 Value::CreateIntegerValue( | 1190 Value::CreateIntegerValue( |
| 1190 Extension::EXTERNAL_EXTENSION_UNINSTALLED)); | 1191 Extension::EXTERNAL_EXTENSION_UNINSTALLED)); |
| 1191 extension_pref_value_map_->SetExtensionState(extension_id, false); | 1192 extension_pref_value_map_->SetExtensionState(extension_id, false); |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1598 ext_id != extension_ids.end(); ++ext_id) { | 1599 ext_id != extension_ids.end(); ++ext_id) { |
| 1599 ScopedExtensionPrefUpdate update(prefs_, *ext_id); | 1600 ScopedExtensionPrefUpdate update(prefs_, *ext_id); |
| 1600 // This creates an empty dictionary if none is stored. | 1601 // This creates an empty dictionary if none is stored. |
| 1601 update.Get(); | 1602 update.Get(); |
| 1602 } | 1603 } |
| 1603 | 1604 |
| 1604 FixMissingPrefs(extension_ids); | 1605 FixMissingPrefs(extension_ids); |
| 1605 MigratePermissions(extension_ids); | 1606 MigratePermissions(extension_ids); |
| 1606 MigrateDisableReasons(extension_ids); | 1607 MigrateDisableReasons(extension_ids); |
| 1607 extension_sorting_->Initialize(extension_ids); | 1608 extension_sorting_->Initialize(extension_ids); |
| 1609 app_list_extension_sorting_->Initialize(extension_ids, | |
| 1610 extension_sorting_.get()); | |
|
koz (OOO until 15th September)
2013/08/20 07:16:57
Better to have this take the list of extension ids
| |
| 1608 | 1611 |
| 1609 PreferenceAPI::InitExtensionControlledPrefs(this, extension_pref_value_map_); | 1612 PreferenceAPI::InitExtensionControlledPrefs(this, extension_pref_value_map_); |
| 1610 | 1613 |
| 1611 extension_pref_value_map_->NotifyInitializationCompleted(); | 1614 extension_pref_value_map_->NotifyInitializationCompleted(); |
| 1612 } | 1615 } |
| 1613 | 1616 |
| 1614 bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) { | 1617 bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) { |
| 1615 bool has_incognito_pref_value = false; | 1618 bool has_incognito_pref_value = false; |
| 1616 extension_pref_value_map_->GetEffectivePrefValue(pref_key, | 1619 extension_pref_value_map_->GetEffectivePrefValue(pref_key, |
| 1617 true, | 1620 true, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1662 ExtensionPrefs::ExtensionPrefs( | 1665 ExtensionPrefs::ExtensionPrefs( |
| 1663 PrefService* prefs, | 1666 PrefService* prefs, |
| 1664 const base::FilePath& root_dir, | 1667 const base::FilePath& root_dir, |
| 1665 ExtensionPrefValueMap* extension_pref_value_map, | 1668 ExtensionPrefValueMap* extension_pref_value_map, |
| 1666 scoped_ptr<TimeProvider> time_provider, | 1669 scoped_ptr<TimeProvider> time_provider, |
| 1667 bool extensions_disabled) | 1670 bool extensions_disabled) |
| 1668 : prefs_(prefs), | 1671 : prefs_(prefs), |
| 1669 install_directory_(root_dir), | 1672 install_directory_(root_dir), |
| 1670 extension_pref_value_map_(extension_pref_value_map), | 1673 extension_pref_value_map_(extension_pref_value_map), |
| 1671 extension_sorting_(new ExtensionSorting(this)), | 1674 extension_sorting_(new ExtensionSorting(this)), |
| 1675 app_list_extension_sorting_(new AppListExtensionSorting(this)), | |
| 1672 content_settings_store_(new ContentSettingsStore()), | 1676 content_settings_store_(new ContentSettingsStore()), |
| 1673 time_provider_(time_provider.Pass()), | 1677 time_provider_(time_provider.Pass()), |
| 1674 extensions_disabled_(extensions_disabled) { | 1678 extensions_disabled_(extensions_disabled) { |
| 1675 MakePathsRelative(); | 1679 MakePathsRelative(); |
| 1676 InitPrefStore(); | 1680 InitPrefStore(); |
| 1677 } | 1681 } |
| 1678 | 1682 |
| 1679 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) { | 1683 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) { |
| 1680 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value); | 1684 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value); |
| 1681 } | 1685 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1842 is_enabled = initial_state == Extension::ENABLED; | 1846 is_enabled = initial_state == Extension::ENABLED; |
| 1843 } | 1847 } |
| 1844 | 1848 |
| 1845 extension_pref_value_map_->RegisterExtension(extension_id, install_time, | 1849 extension_pref_value_map_->RegisterExtension(extension_id, install_time, |
| 1846 is_enabled); | 1850 is_enabled); |
| 1847 content_settings_store_->RegisterExtension(extension_id, install_time, | 1851 content_settings_store_->RegisterExtension(extension_id, install_time, |
| 1848 is_enabled); | 1852 is_enabled); |
| 1849 } | 1853 } |
| 1850 | 1854 |
| 1851 } // namespace extensions | 1855 } // namespace extensions |
| OLD | NEW |