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

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: Changed implementation 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 6a0b4b6e4410f62ba0964d252c1a163df7999f7b..4a9fecd17c439e4f78c67fd6b20f282f80620bfd 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1433,11 +1433,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()));
tapted 2014/07/17 04:29:46 are ephemeral apps never displayed in the new tab
tmdiep 2014/07/17 05:48:57 I wish it could be just fully encapsulated in the
tapted 2014/07/17 05:59:53 Ah - drat.
+ 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);
@@ -1845,8 +1848,11 @@ 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) {
tapted 2014/07/17 04:29:46 After tracing down ordinal CHECK()s in the past I'
tmdiep 2014/07/17 05:48:57 I've refactored to always call EnsureValidOrdinals
// 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());

Powered by Google App Engine
This is Rietveld 408576698