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

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

Issue 397903002: Do not assign launch ordinals to ephemeral apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ephemapp_unload_review
Patch Set: Minor clean up Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/chrome_app_sorting_unittest.cc ('k') | extensions/browser/app_sorting.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 22f001baa249083600e50324bf455aa8391f249b..a4b586278f7f2a1480112c835b7056438d8d0475 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1410,11 +1410,14 @@ 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()) {
- if (!extension->ShouldDisplayInNewTabPage()) {
- extension_prefs_->app_sorting()->MarkExtensionAsHidden(extension->id());
+ extension_prefs_->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());
}
- extension_prefs_->app_sorting()->EnsureValidOrdinals(
- extension->id(), syncer::StringOrdinal());
}
registry_->AddEnabled(extension);
@@ -1817,15 +1820,21 @@ void ExtensionService::PromoteEphemeralApp(
DCHECK(GetInstalledExtension(extension->id()) &&
extension_prefs_->IsEphemeralApp(extension->id()));
- if (!is_from_sync) {
- if (extension->RequiresSortOrdinal()) {
+ if (extension->RequiresSortOrdinal()) {
+ extension_prefs_->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());
- extension_prefs_->app_sorting()->EnsureValidOrdinals(
- extension->id(), syncer::StringOrdinal());
}
+ extension_prefs_->app_sorting()->EnsureValidOrdinals(
+ extension->id(), syncer::StringOrdinal());
+ }
+
+ if (!is_from_sync) {
// Cached ephemeral apps may be updated and disabled due to permissions
// increase. The app can be enabled as the install was user-acknowledged.
if (extension_prefs_->DidExtensionEscalatePermissions(extension->id()))
« no previous file with comments | « chrome/browser/extensions/chrome_app_sorting_unittest.cc ('k') | extensions/browser/app_sorting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698