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

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: rebase Created 7 years, 2 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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 blacklist_state, extension_dict); 1167 blacklist_state, extension_dict);
1168 FinishExtensionInfoPrefs(extension->id(), install_time, 1168 FinishExtensionInfoPrefs(extension->id(), install_time,
1169 extension->RequiresSortOrdinal(), 1169 extension->RequiresSortOrdinal(),
1170 page_ordinal, extension_dict); 1170 page_ordinal, extension_dict);
1171 } 1171 }
1172 1172
1173 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, 1173 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id,
1174 const Manifest::Location& location, 1174 const Manifest::Location& location,
1175 bool external_uninstall) { 1175 bool external_uninstall) {
1176 extension_sorting_->ClearOrdinals(extension_id); 1176 extension_sorting_->ClearOrdinals(extension_id);
1177 app_list_extension_sorting_->Erase(extension_id);
1177 1178
1178 // For external extensions, we save a preference reminding ourself not to try 1179 // For external extensions, we save a preference reminding ourself not to try
1179 // and install the extension anymore (except when |external_uninstall| is 1180 // and install the extension anymore (except when |external_uninstall| is
1180 // true, which signifies that the registry key was deleted or the pref file 1181 // true, which signifies that the registry key was deleted or the pref file
1181 // no longer lists the extension). 1182 // no longer lists the extension).
1182 if (!external_uninstall && Manifest::IsExternalLocation(location)) { 1183 if (!external_uninstall && Manifest::IsExternalLocation(location)) {
1183 UpdateExtensionPref(extension_id, kPrefState, 1184 UpdateExtensionPref(extension_id, kPrefState,
1184 new base::FundamentalValue( 1185 new base::FundamentalValue(
1185 Extension::EXTERNAL_EXTENSION_UNINSTALLED)); 1186 Extension::EXTERNAL_EXTENSION_UNINSTALLED));
1186 extension_pref_value_map_->SetExtensionState(extension_id, false); 1187 extension_pref_value_map_->SetExtensionState(extension_id, false);
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 ScopedExtensionPrefUpdate update(prefs_, *ext_id); 1623 ScopedExtensionPrefUpdate update(prefs_, *ext_id);
1623 // This creates an empty dictionary if none is stored. 1624 // This creates an empty dictionary if none is stored.
1624 update.Get(); 1625 update.Get();
1625 } 1626 }
1626 1627
1627 FixMissingPrefs(extension_ids); 1628 FixMissingPrefs(extension_ids);
1628 MigratePermissions(extension_ids); 1629 MigratePermissions(extension_ids);
1629 MigrateDisableReasons(extension_ids); 1630 MigrateDisableReasons(extension_ids);
1630 extension_sorting_->Initialize(extension_ids); 1631 extension_sorting_->Initialize(extension_ids);
1631 1632
1633 extensions::ExtensionIdList ntp_sorted_extension_ids;
1634 extension_sorting_->GetOrderedExtensionIds(&ntp_sorted_extension_ids);
1635 app_list_extension_sorting_->Initialize(extension_ids,
1636 ntp_sorted_extension_ids);
1637
1632 PreferenceAPI::InitExtensionControlledPrefs(this, extension_pref_value_map_); 1638 PreferenceAPI::InitExtensionControlledPrefs(this, extension_pref_value_map_);
1633 1639
1634 extension_pref_value_map_->NotifyInitializationCompleted(); 1640 extension_pref_value_map_->NotifyInitializationCompleted();
1635 } 1641 }
1636 1642
1637 bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) { 1643 bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) {
1638 bool has_incognito_pref_value = false; 1644 bool has_incognito_pref_value = false;
1639 extension_pref_value_map_->GetEffectivePrefValue(pref_key, 1645 extension_pref_value_map_->GetEffectivePrefValue(pref_key,
1640 true, 1646 true,
1641 &has_incognito_pref_value); 1647 &has_incognito_pref_value);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 ExtensionPrefs::ExtensionPrefs( 1691 ExtensionPrefs::ExtensionPrefs(
1686 PrefService* prefs, 1692 PrefService* prefs,
1687 const base::FilePath& root_dir, 1693 const base::FilePath& root_dir,
1688 ExtensionPrefValueMap* extension_pref_value_map, 1694 ExtensionPrefValueMap* extension_pref_value_map,
1689 scoped_ptr<TimeProvider> time_provider, 1695 scoped_ptr<TimeProvider> time_provider,
1690 bool extensions_disabled) 1696 bool extensions_disabled)
1691 : prefs_(prefs), 1697 : prefs_(prefs),
1692 install_directory_(root_dir), 1698 install_directory_(root_dir),
1693 extension_pref_value_map_(extension_pref_value_map), 1699 extension_pref_value_map_(extension_pref_value_map),
1694 extension_sorting_(new ExtensionSorting(this)), 1700 extension_sorting_(new ExtensionSorting(this)),
1701 app_list_extension_sorting_(new AppListExtensionSorting(this)),
1695 content_settings_store_(new ContentSettingsStore()), 1702 content_settings_store_(new ContentSettingsStore()),
1696 time_provider_(time_provider.Pass()), 1703 time_provider_(time_provider.Pass()),
1697 extensions_disabled_(extensions_disabled) { 1704 extensions_disabled_(extensions_disabled) {
1698 MakePathsRelative(); 1705 MakePathsRelative();
1699 InitPrefStore(); 1706 InitPrefStore();
1700 } 1707 }
1701 1708
1702 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) { 1709 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) {
1703 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value); 1710 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value);
1704 } 1711 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 is_enabled = initial_state == Extension::ENABLED; 1886 is_enabled = initial_state == Extension::ENABLED;
1880 } 1887 }
1881 1888
1882 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 1889 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
1883 is_enabled); 1890 is_enabled);
1884 content_settings_store_->RegisterExtension(extension_id, install_time, 1891 content_settings_store_->RegisterExtension(extension_id, install_time,
1885 is_enabled); 1892 is_enabled);
1886 } 1893 }
1887 1894
1888 } // namespace extensions 1895 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698