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..b25726a4d90a6fee9f80acaebc0b158d419b2377 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)); |
Aaron Boodman
2012/02/08 18:23:28
Can't this just be:
DCHECK(extension->IsSyncable(
csharp
2012/02/08 20:02:26
Done.
|
+ |
+ // 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,31 @@ void ExtensionService::AddExtension(const Extension* extension) { |
return; |
} |
+ // All apps will appear on the NTP and are ordered by their ordinals so we |
+ // must ensure they have valid ordinals. |
+ if (extension->is_app()) { |
Aaron Boodman
2012/02/08 18:23:28
But you just said this isn't true. Will it be bad
csharp
2012/02/08 20:02:26
Changing to only do if the extension Should displa
|
+ ExtensionSorting* extension_sorting = extension_prefs_->extension_sorting(); |
+ |
+ StringOrdinal page_ordinal = |
+ extension_sorting->GetPageOrdinal(extension->id()); |
+ if (!page_ordinal.IsValid()) { |
+ page_ordinal = extension->id() == extension_misc::kWebStoreAppId ? |
akalin
2012/02/08 18:27:43
add a comment explaining the special cases for the
csharp
2012/02/08 20:02:26
Done.
|
+ 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()) { |
+ 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); |