Chromium Code Reviews| 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); |