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

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: add sync test Created 7 years, 6 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/string_util.h" 9 #include "base/string_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 extension_dict); 1234 extension_dict);
1235 FinishExtensionInfoPrefs(extension->id(), install_time, 1235 FinishExtensionInfoPrefs(extension->id(), install_time,
1236 extension->RequiresSortOrdinal(), 1236 extension->RequiresSortOrdinal(),
1237 page_ordinal, extension_dict); 1237 page_ordinal, extension_dict);
1238 } 1238 }
1239 1239
1240 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, 1240 void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id,
1241 const Manifest::Location& location, 1241 const Manifest::Location& location,
1242 bool external_uninstall) { 1242 bool external_uninstall) {
1243 extension_sorting_->ClearOrdinals(extension_id); 1243 extension_sorting_->ClearOrdinals(extension_id);
1244 app_list_extension_ordering_->Erase(extension_id);
1244 1245
1245 // For external extensions, we save a preference reminding ourself not to try 1246 // For external extensions, we save a preference reminding ourself not to try
1246 // and install the extension anymore (except when |external_uninstall| is 1247 // and install the extension anymore (except when |external_uninstall| is
1247 // true, which signifies that the registry key was deleted or the pref file 1248 // true, which signifies that the registry key was deleted or the pref file
1248 // no longer lists the extension). 1249 // no longer lists the extension).
1249 if (!external_uninstall && Manifest::IsExternalLocation(location)) { 1250 if (!external_uninstall && Manifest::IsExternalLocation(location)) {
1250 UpdateExtensionPref(extension_id, kPrefState, 1251 UpdateExtensionPref(extension_id, kPrefState,
1251 Value::CreateIntegerValue( 1252 Value::CreateIntegerValue(
1252 Extension::EXTERNAL_EXTENSION_UNINSTALLED)); 1253 Extension::EXTERNAL_EXTENSION_UNINSTALLED));
1253 extension_pref_value_map_->SetExtensionState(extension_id, false); 1254 extension_pref_value_map_->SetExtensionState(extension_id, false);
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 ext_id != extension_ids.end(); ++ext_id) { 1679 ext_id != extension_ids.end(); ++ext_id) {
1679 ScopedExtensionPrefUpdate update(prefs_, *ext_id); 1680 ScopedExtensionPrefUpdate update(prefs_, *ext_id);
1680 // This creates an empty dictionary if none is stored. 1681 // This creates an empty dictionary if none is stored.
1681 update.Get(); 1682 update.Get();
1682 } 1683 }
1683 1684
1684 FixMissingPrefs(extension_ids); 1685 FixMissingPrefs(extension_ids);
1685 MigratePermissions(extension_ids); 1686 MigratePermissions(extension_ids);
1686 MigrateDisableReasons(extension_ids); 1687 MigrateDisableReasons(extension_ids);
1687 extension_sorting_->Initialize(extension_ids); 1688 extension_sorting_->Initialize(extension_ids);
1689 app_list_extension_ordering_->Initialize(extension_ids);
1688 1690
1689 // Store extension controlled preference values in the 1691 // Store extension controlled preference values in the
1690 // |extension_pref_value_map_|, which then informs the subscribers 1692 // |extension_pref_value_map_|, which then informs the subscribers
1691 // (ExtensionPrefStores) about the winning values. 1693 // (ExtensionPrefStores) about the winning values.
1692 for (ExtensionIdList::iterator ext_id = extension_ids.begin(); 1694 for (ExtensionIdList::iterator ext_id = extension_ids.begin();
1693 ext_id != extension_ids.end(); ++ext_id) { 1695 ext_id != extension_ids.end(); ++ext_id) {
1694 extension_pref_value_map_->RegisterExtension( 1696 extension_pref_value_map_->RegisterExtension(
1695 *ext_id, 1697 *ext_id,
1696 GetInstallTime(*ext_id), 1698 GetInstallTime(*ext_id),
1697 !IsExtensionDisabled(*ext_id)); 1699 !IsExtensionDisabled(*ext_id));
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 ExtensionPrefs::ExtensionPrefs( 1885 ExtensionPrefs::ExtensionPrefs(
1884 PrefService* prefs, 1886 PrefService* prefs,
1885 const base::FilePath& root_dir, 1887 const base::FilePath& root_dir,
1886 ExtensionPrefValueMap* extension_pref_value_map, 1888 ExtensionPrefValueMap* extension_pref_value_map,
1887 scoped_ptr<TimeProvider> time_provider, 1889 scoped_ptr<TimeProvider> time_provider,
1888 bool extensions_disabled) 1890 bool extensions_disabled)
1889 : prefs_(prefs), 1891 : prefs_(prefs),
1890 install_directory_(root_dir), 1892 install_directory_(root_dir),
1891 extension_pref_value_map_(extension_pref_value_map), 1893 extension_pref_value_map_(extension_pref_value_map),
1892 extension_sorting_(new ExtensionSorting(this, prefs)), 1894 extension_sorting_(new ExtensionSorting(this, prefs)),
1895 app_list_extension_ordering_(new AppListExtensionOrdering(this)),
1893 content_settings_store_(new ContentSettingsStore()), 1896 content_settings_store_(new ContentSettingsStore()),
1894 time_provider_(time_provider.Pass()), 1897 time_provider_(time_provider.Pass()),
1895 extensions_disabled_(extensions_disabled) { 1898 extensions_disabled_(extensions_disabled) {
1896 MakePathsRelative(); 1899 MakePathsRelative();
1897 InitPrefStore(); 1900 InitPrefStore();
1898 content_settings_store_->AddObserver(this); 1901 content_settings_store_->AddObserver(this);
1899 } 1902 }
1900 1903
1901 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) { 1904 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) {
1902 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value); 1905 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 is_enabled = initial_state == Extension::ENABLED; 2062 is_enabled = initial_state == Extension::ENABLED;
2060 } 2063 }
2061 2064
2062 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 2065 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
2063 is_enabled); 2066 is_enabled);
2064 content_settings_store_->RegisterExtension(extension_id, install_time, 2067 content_settings_store_->RegisterExtension(extension_id, install_time,
2065 is_enabled); 2068 is_enabled);
2066 } 2069 }
2067 2070
2068 } // namespace extensions 2071 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698