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

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: Changes as per review comments. 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 7390a2634453b556993d174c536f97864ad116f0..fc5a38258a6fe390fd4fedadd2c8e70517fae5fc 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -104,6 +104,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;
@@ -1507,13 +1508,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());
}
}
@@ -1967,17 +1970,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