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

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: 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
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..392d56c2a5c05487e739a0c5db0a318718a0c2be 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1573,8 +1573,14 @@ 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 other than the
+ // web store (which is considered an app, and may try to set this value).
+ DCHECK_EQ(extension_id, std::string(extension_misc::kWebStoreAppId));
+
+ // If we are here with the CWS, make sure the we aren't trying to
+ // change it.
+ DCHECK_EQ(enabled, IsIncognitoEnabled(extension_id));
+
return;
}
@@ -2050,6 +2056,27 @@ void ExtensionService::AddExtension(const Extension* extension) {
return;
}
+ // Make sure that CWS has valid ordinals on initialization.
+ if (extension->id() == extension_misc::kWebStoreAppId) {
+ ExtensionSorting* extension_sorting = extension_prefs_->extension_sorting();
+
+ StringOrdinal page_ordinal =
+ extension_sorting->GetPageOrdinal(extension->id());
+ if (!page_ordinal.IsValid()) {
+ page_ordinal = extension_sorting->CreateFirstAppPageOrdinal();
+ extension_sorting->SetPageOrdinal(extension->id(), page_ordinal);
+ }
+
+ StringOrdinal app_launch_ordinal =
+ extension_sorting->GetAppLaunchOrdinal(extension->id());
+ if (!app_launch_ordinal.IsValid()) {
+ app_launch_ordinal =
+ extension_sorting->CreateFirstAppLaunchOrdinal(page_ordinal);
Finnur 2012/02/07 10:12:53 nit: indentation.
csharp 2012/02/07 15:49:41 Done.
+ 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') | chrome/common/extensions/extension.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698