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

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

Issue 9340007: Make the Chrome Web Store Icon Syncable (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Better detection of what apps need ordinals Created 8 years, 10 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 | « no previous file | chrome/browser/extensions/extension_service_unittest.cc » ('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 84397982cc4e10874b4d7d1a24dfd29d71d0adef..403f070f1a23de310dcdb6fc523ef0c521980a5c 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1573,8 +1573,13 @@ void ExtensionService::SetIsIncognitoEnabled(
const std::string& extension_id, bool enabled) {
const Extension* extension = GetInstalledExtension(extension_id);
if (extension && extension->location() == Extension::COMPONENT) {
- // This shouldn't be called for component extensions.
- NOTREACHED();
+ // This shouldn't be called for component extensions unless they are
+ // syncable.
+ DCHECK(extension->IsSyncable());
+
+ // If we are here, make sure the we aren't trying to change the value.
+ DCHECK_EQ(enabled, IsIncognitoEnabled(extension_id));
+
return;
}
@@ -2050,6 +2055,33 @@ void ExtensionService::AddExtension(const Extension* extension) {
return;
}
+ // All apps that are displayed in the launcher are ordered by their ordinals
+ // so we must ensure they have valid ordinals.
+ if (extension->ShouldDisplayInLauncher()) {
Aaron Boodman 2012/02/09 00:05:46 Last comment: Is it possible to pull all this code
csharp 2012/02/09 15:45:45 Done.
+ ExtensionSorting* extension_sorting = extension_prefs_->extension_sorting();
+
+ StringOrdinal page_ordinal =
+ extension_sorting->GetPageOrdinal(extension->id());
+ if (!page_ordinal.IsValid()) {
+ // The webstore app should always start be on the first page.
+ page_ordinal = extension->id() == extension_misc::kWebStoreAppId ?
+ extension_sorting->CreateFirstAppPageOrdinal() :
+ extension_sorting->GetNaturalAppPageOrdinal();
+ extension_sorting->SetPageOrdinal(extension->id(), page_ordinal);
+ }
+
+ StringOrdinal app_launch_ordinal =
+ extension_sorting->GetAppLaunchOrdinal(extension->id());
+ if (!app_launch_ordinal.IsValid()) {
+ // The webstore app should always start in the position.
+ app_launch_ordinal = extension->id() == extension_misc::kWebStoreAppId ?
+ extension_sorting->CreateFirstAppLaunchOrdinal(page_ordinal) :
+ extension_sorting->CreateNextAppLaunchOrdinal(page_ordinal);
+ extension_sorting->SetAppLaunchOrdinal(extension->id(),
+ app_launch_ordinal);
+ }
+ }
+
extensions_.Insert(scoped_extension);
SyncExtensionChangeIfNeeded(*extension);
NotifyExtensionLoaded(extension);
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698