OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 // was not available. | 1838 // was not available. |
1839 if (SharedModuleInfo::IsSharedModule(extension)) | 1839 if (SharedModuleInfo::IsSharedModule(extension)) |
1840 MaybeFinishDelayedInstallations(); | 1840 MaybeFinishDelayedInstallations(); |
1841 } | 1841 } |
1842 | 1842 |
1843 void ExtensionService::PromoteEphemeralApp( | 1843 void ExtensionService::PromoteEphemeralApp( |
1844 const extensions::Extension* extension, bool is_from_sync) { | 1844 const extensions::Extension* extension, bool is_from_sync) { |
1845 DCHECK(GetInstalledExtension(extension->id()) && | 1845 DCHECK(GetInstalledExtension(extension->id()) && |
1846 extension_prefs_->IsEphemeralApp(extension->id())); | 1846 extension_prefs_->IsEphemeralApp(extension->id())); |
1847 | 1847 |
| 1848 // Remove the ephemeral flags from the preferences. |
| 1849 extension_prefs_->OnEphemeralAppPromoted(extension->id()); |
| 1850 |
1848 if (!is_from_sync) { | 1851 if (!is_from_sync) { |
1849 if (extension->RequiresSortOrdinal()) { | 1852 if (extension->RequiresSortOrdinal()) { |
1850 // Reset the sort ordinals of the app to ensure it is added to the default | 1853 // Reset the sort ordinals of the app to ensure it is added to the default |
1851 // position, like newly installed apps would. | 1854 // position, like newly installed apps would. |
1852 extension_prefs_->app_sorting()->ClearOrdinals(extension->id()); | 1855 extension_prefs_->app_sorting()->ClearOrdinals(extension->id()); |
1853 extension_prefs_->app_sorting()->EnsureValidOrdinals( | 1856 extension_prefs_->app_sorting()->EnsureValidOrdinals( |
1854 extension->id(), syncer::StringOrdinal()); | 1857 extension->id(), syncer::StringOrdinal()); |
1855 } | 1858 } |
1856 } | 1859 } |
1857 | 1860 |
1858 // Remove the ephemeral flags from the preferences. | |
1859 extension_prefs_->OnEphemeralAppPromoted(extension->id()); | |
1860 | |
1861 // Fire install-related events to allow observers to handle the promotion | 1861 // Fire install-related events to allow observers to handle the promotion |
1862 // of the ephemeral app. | 1862 // of the ephemeral app. |
1863 extensions::InstalledExtensionInfo details( | 1863 extensions::InstalledExtensionInfo details( |
1864 extension, | 1864 extension, |
1865 true /* is update */, | 1865 true /* is update */, |
1866 true /* from ephemeral */, | 1866 true /* from ephemeral */, |
1867 extension->name() /* old name */); | 1867 extension->name() /* old name */); |
1868 content::NotificationService::current()->Notify( | 1868 content::NotificationService::current()->Notify( |
1869 chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, | 1869 chrome::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, |
1870 content::Source<Profile>(profile_), | 1870 content::Source<Profile>(profile_), |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 } | 2375 } |
2376 | 2376 |
2377 void ExtensionService::OnProfileDestructionStarted() { | 2377 void ExtensionService::OnProfileDestructionStarted() { |
2378 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2378 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2379 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2379 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2380 it != ids_to_unload.end(); | 2380 it != ids_to_unload.end(); |
2381 ++it) { | 2381 ++it) { |
2382 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2382 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2383 } | 2383 } |
2384 } | 2384 } |
OLD | NEW |