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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 1419823011: app_sorting() calls should go via ExtensionSystem intsead of prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 0fa7c9e76b1e729cedd759261c011eee8b57bd14..0d47eb260ec4148b47bf6975117597b16d5e5d11 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -105,6 +105,7 @@ using content::BrowserContext;
using content::BrowserThread;
using content::DevToolsAgentHost;
using extensions::APIPermission;
+using extensions::AppSorting;
using extensions::CrxInstaller;
using extensions::Extension;
using extensions::ExtensionIdSet;
@@ -1508,13 +1509,15 @@ void ExtensionService::AddExtension(const Extension* extension) {
// All apps that are displayed in the launcher are ordered by their ordinals
// so we must ensure they have valid ordinals.
if (extension->RequiresSortOrdinal()) {
- extension_prefs_->app_sorting()->SetExtensionVisible(
+ AppSorting* app_sorting =
+ extensions::ExtensionSystem::Get(GetBrowserContext())->app_sorting();
+ app_sorting->SetExtensionVisible(
extension->id(),
extension->ShouldDisplayInNewTabPage() &&
!extension_prefs_->IsEphemeralApp(extension->id()));
if (!extension_prefs_->IsEphemeralApp(extension->id())) {
- extension_prefs_->app_sorting()->EnsureValidOrdinals(
- extension->id(), syncer::StringOrdinal());
+ app_sorting->EnsureValidOrdinals(extension->id(),
+ syncer::StringOrdinal());
}
}
@@ -1965,17 +1968,18 @@ void ExtensionService::PromoteEphemeralApp(
extension_prefs_->IsEphemeralApp(extension->id()));
if (extension->RequiresSortOrdinal()) {
- extension_prefs_->app_sorting()->SetExtensionVisible(
- extension->id(), extension->ShouldDisplayInNewTabPage());
+ AppSorting* app_sorting =
+ extensions::ExtensionSystem::Get(GetBrowserContext())->app_sorting();
+ app_sorting->SetExtensionVisible(extension->id(),
+ extension->ShouldDisplayInNewTabPage());
if (!is_from_sync) {
// Reset the sort ordinals of the app to ensure it is added to the default
// position, like newly installed apps would.
- extension_prefs_->app_sorting()->ClearOrdinals(extension->id());
+ app_sorting->ClearOrdinals(extension->id());
}
- extension_prefs_->app_sorting()->EnsureValidOrdinals(
- extension->id(), syncer::StringOrdinal());
+ app_sorting->EnsureValidOrdinals(extension->id(), syncer::StringOrdinal());
}
// Remove the ephemeral flags from the preferences.

Powered by Google App Engine
This is Rietveld 408576698