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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 326213004: Invoke callback from WebstoreInstaller when installation is fully complete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self nits Created 6 years, 6 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 unified diff | Download patch
OLDNEW
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 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 } 1971 }
1972 bool from_ephemeral = 1972 bool from_ephemeral =
1973 was_ephemeral && !extension_prefs_->IsEphemeralApp(extension->id()); 1973 was_ephemeral && !extension_prefs_->IsEphemeralApp(extension->id());
1974 extensions::InstalledExtensionInfo details( 1974 extensions::InstalledExtensionInfo details(
1975 extension, is_update, from_ephemeral, old_name); 1975 extension, is_update, from_ephemeral, old_name);
1976 content::NotificationService::current()->Notify( 1976 content::NotificationService::current()->Notify(
1977 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED, 1977 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED,
1978 content::Source<Profile>(profile_), 1978 content::Source<Profile>(profile_),
1979 content::Details<const extensions::InstalledExtensionInfo>(&details)); 1979 content::Details<const extensions::InstalledExtensionInfo>(&details));
1980 1980
1981 ExtensionRegistry::Get(profile_)->TriggerOnWillBeInstalled( 1981 registry_->TriggerOnWillBeInstalled(
1982 extension, is_update, from_ephemeral, old_name); 1982 extension, is_update, from_ephemeral, old_name);
1983 1983
1984 bool unacknowledged_external = IsUnacknowledgedExternalExtension(extension); 1984 bool unacknowledged_external = IsUnacknowledgedExternalExtension(extension);
1985 1985
1986 // Unpacked extensions default to allowing file access, but if that has been 1986 // Unpacked extensions default to allowing file access, but if that has been
1987 // overridden, don't reset the value. 1987 // overridden, don't reset the value.
1988 if (Manifest::ShouldAlwaysAllowFileAccess(extension->location()) && 1988 if (Manifest::ShouldAlwaysAllowFileAccess(extension->location()) &&
1989 !extension_prefs_->HasAllowFileAccessSetting(extension->id())) { 1989 !extension_prefs_->HasAllowFileAccessSetting(extension->id())) {
1990 extension_prefs_->SetAllowFileAccess(extension->id(), true); 1990 extension_prefs_->SetAllowFileAccess(extension->id(), true);
1991 } 1991 }
1992 1992
1993 AddExtension(extension); 1993 AddExtension(extension);
1994 1994
1995 // Notify observers that need to know when an installation is complete.
1996 registry_->TriggerOnInstalled(extension);
1997
1995 // If this is a new external extension that was disabled, alert the user 1998 // If this is a new external extension that was disabled, alert the user
1996 // so he can reenable it. We do this last so that it has already been 1999 // so he can reenable it. We do this last so that it has already been
1997 // added to our list of extensions. 2000 // added to our list of extensions.
1998 if (unacknowledged_external && !is_update) { 2001 if (unacknowledged_external && !is_update) {
1999 UpdateExternalExtensionAlert(); 2002 UpdateExternalExtensionAlert();
2000 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalExtensionEvent", 2003 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalExtensionEvent",
2001 EXTERNAL_EXTENSION_INSTALLED, 2004 EXTERNAL_EXTENSION_INSTALLED,
2002 EXTERNAL_EXTENSION_BUCKET_BOUNDARY); 2005 EXTERNAL_EXTENSION_BUCKET_BOUNDARY);
2003 if (extensions::ManifestURL::UpdatesFromGallery(extension)) { 2006 if (extensions::ManifestURL::UpdatesFromGallery(extension)) {
2004 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalExtensionEventWebstore", 2007 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalExtensionEventWebstore",
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 2074
2072 if (registry_->enabled_extensions().Contains(extension->id())) { 2075 if (registry_->enabled_extensions().Contains(extension->id())) {
2073 content::NotificationService::current()->Notify( 2076 content::NotificationService::current()->Notify(
2074 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, 2077 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
2075 content::Source<Profile>(profile_), 2078 content::Source<Profile>(profile_),
2076 content::Details<const Extension>(extension)); 2079 content::Details<const Extension>(extension));
2077 2080
2078 registry_->TriggerOnLoaded(extension); 2081 registry_->TriggerOnLoaded(extension);
2079 } 2082 }
2080 2083
2084 registry_->TriggerOnInstalled(extension);
2085
2081 if (!is_from_sync && extension_sync_service_) 2086 if (!is_from_sync && extension_sync_service_)
2082 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension); 2087 extension_sync_service_->SyncExtensionChangeIfNeeded(*extension);
2083 } 2088 }
2084 2089
2085 const Extension* ExtensionService::GetPendingExtensionUpdate( 2090 const Extension* ExtensionService::GetPendingExtensionUpdate(
2086 const std::string& id) const { 2091 const std::string& id) const {
2087 return delayed_installs_.GetByID(id); 2092 return delayed_installs_.GetByID(id);
2088 } 2093 }
2089 2094
2090 void ExtensionService::TrackTerminatedExtension(const Extension* extension) { 2095 void ExtensionService::TrackTerminatedExtension(const Extension* extension) {
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2549 } 2554 }
2550 2555
2551 void ExtensionService::OnProfileDestructionStarted() { 2556 void ExtensionService::OnProfileDestructionStarted() {
2552 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2557 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2553 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2558 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2554 it != ids_to_unload.end(); 2559 it != ids_to_unload.end();
2555 ++it) { 2560 ++it) {
2556 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2561 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2557 } 2562 }
2558 } 2563 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698