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

Side by Side Diff: chrome/browser/extensions/extension_prefs.cc

Issue 17038002: Separate the NTP app ordering from the app list app ordering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert lazy initialzation Created 7 years, 3 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
OLDNEW
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 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 blacklist_state, extension_dict); 1168 blacklist_state, extension_dict);
1169 FinishExtensionInfoPrefs(extension->id(), install_time, 1169 FinishExtensionInfoPrefs(extension->id(), install_time,
1170 extension->RequiresSortOrdinal(), 1170 extension->RequiresSortOrdinal(),
1171 page_ordinal, extension_dict); 1171 page_ordinal, extension_dict);
1172 } 1172 }
1173 1173
1174 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, 1174 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id,
1175 const Manifest::Location& location, 1175 const Manifest::Location& location,
1176 bool external_uninstall) { 1176 bool external_uninstall) {
1177 extension_sorting_->ClearOrdinals(extension_id); 1177 extension_sorting_->ClearOrdinals(extension_id);
1178 app_list_extension_sorting_->Erase(extension_id);
1178 1179
1179 // For external extensions, we save a preference reminding ourself not to try 1180 // For external extensions, we save a preference reminding ourself not to try
1180 // and install the extension anymore (except when |external_uninstall| is 1181 // and install the extension anymore (except when |external_uninstall| is
1181 // true, which signifies that the registry key was deleted or the pref file 1182 // true, which signifies that the registry key was deleted or the pref file
1182 // no longer lists the extension). 1183 // no longer lists the extension).
1183 if (!external_uninstall && Manifest::IsExternalLocation(location)) { 1184 if (!external_uninstall && Manifest::IsExternalLocation(location)) {
1184 UpdateExtensionPref(extension_id, kPrefState, 1185 UpdateExtensionPref(extension_id, kPrefState,
1185 new base::FundamentalValue( 1186 new base::FundamentalValue(
1186 Extension::EXTERNAL_EXTENSION_UNINSTALLED)); 1187 Extension::EXTERNAL_EXTENSION_UNINSTALLED));
1187 extension_pref_value_map_->SetExtensionState(extension_id, false); 1188 extension_pref_value_map_->SetExtensionState(extension_id, false);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 ScopedExtensionPrefUpdate update(prefs_, *ext_id); 1625 ScopedExtensionPrefUpdate update(prefs_, *ext_id);
1625 // This creates an empty dictionary if none is stored. 1626 // This creates an empty dictionary if none is stored.
1626 update.Get(); 1627 update.Get();
1627 } 1628 }
1628 1629
1629 FixMissingPrefs(extension_ids); 1630 FixMissingPrefs(extension_ids);
1630 MigratePermissions(extension_ids); 1631 MigratePermissions(extension_ids);
1631 MigrateDisableReasons(extension_ids); 1632 MigrateDisableReasons(extension_ids);
1632 extension_sorting_->Initialize(extension_ids); 1633 extension_sorting_->Initialize(extension_ids);
1633 1634
1635 extensions::ExtensionIdList ntp_sorted_extension_ids;
1636 extension_sorting_->GetOrderedExtensionIds(&ntp_sorted_extension_ids);
1637 app_list_extension_sorting_->Initialize(extension_ids,
1638 ntp_sorted_extension_ids);
1639
1634 PreferenceAPI::InitExtensionControlledPrefs(this, extension_pref_value_map_); 1640 PreferenceAPI::InitExtensionControlledPrefs(this, extension_pref_value_map_);
1635 1641
1636 extension_pref_value_map_->NotifyInitializationCompleted(); 1642 extension_pref_value_map_->NotifyInitializationCompleted();
1637 } 1643 }
1638 1644
1639 bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) { 1645 bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) {
1640 bool has_incognito_pref_value = false; 1646 bool has_incognito_pref_value = false;
1641 extension_pref_value_map_->GetEffectivePrefValue(pref_key, 1647 extension_pref_value_map_->GetEffectivePrefValue(pref_key,
1642 true, 1648 true,
1643 &has_incognito_pref_value); 1649 &has_incognito_pref_value);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 ExtensionPrefs::ExtensionPrefs( 1693 ExtensionPrefs::ExtensionPrefs(
1688 PrefService* prefs, 1694 PrefService* prefs,
1689 const base::FilePath& root_dir, 1695 const base::FilePath& root_dir,
1690 ExtensionPrefValueMap* extension_pref_value_map, 1696 ExtensionPrefValueMap* extension_pref_value_map,
1691 scoped_ptr<TimeProvider> time_provider, 1697 scoped_ptr<TimeProvider> time_provider,
1692 bool extensions_disabled) 1698 bool extensions_disabled)
1693 : prefs_(prefs), 1699 : prefs_(prefs),
1694 install_directory_(root_dir), 1700 install_directory_(root_dir),
1695 extension_pref_value_map_(extension_pref_value_map), 1701 extension_pref_value_map_(extension_pref_value_map),
1696 extension_sorting_(new ExtensionSorting(this)), 1702 extension_sorting_(new ExtensionSorting(this)),
1703 app_list_extension_sorting_(new AppListExtensionSorting(this)),
1697 content_settings_store_(new ContentSettingsStore()), 1704 content_settings_store_(new ContentSettingsStore()),
1698 time_provider_(time_provider.Pass()), 1705 time_provider_(time_provider.Pass()),
1699 extensions_disabled_(extensions_disabled) { 1706 extensions_disabled_(extensions_disabled) {
1700 MakePathsRelative(); 1707 MakePathsRelative();
1701 InitPrefStore(); 1708 InitPrefStore();
1702 } 1709 }
1703 1710
1704 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) { 1711 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) {
1705 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value); 1712 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value);
1706 } 1713 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 is_enabled = initial_state == Extension::ENABLED; 1875 is_enabled = initial_state == Extension::ENABLED;
1869 } 1876 }
1870 1877
1871 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 1878 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
1872 is_enabled); 1879 is_enabled);
1873 content_settings_store_->RegisterExtension(extension_id, install_time, 1880 content_settings_store_->RegisterExtension(extension_id, install_time,
1874 is_enabled); 1881 is_enabled);
1875 } 1882 }
1876 1883
1877 } // namespace extensions 1884 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698