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

Unified Diff: chrome/browser/extensions/install_tracker.cc

Issue 279073003: Add a function triggering extension installed to ExtensionRegistryObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add more DCHECK and test code Created 6 years, 7 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
« no previous file with comments | « chrome/browser/extensions/install_tracker.h ('k') | chrome/browser/extensions/webstore_installer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/install_tracker.cc
diff --git a/chrome/browser/extensions/install_tracker.cc b/chrome/browser/extensions/install_tracker.cc
index 81e72feded968487972f0656a1e7e2fb1951d03d..09eec52eac8228f52ed5fbcf2d118e5d312e7235 100644
--- a/chrome/browser/extensions/install_tracker.cc
+++ b/chrome/browser/extensions/install_tracker.cc
@@ -21,8 +21,6 @@ InstallTracker::InstallTracker(Profile* profile,
: extension_registry_observer_(this) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
- content::Source<Profile>(profile));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
content::Source<Profile>(profile));
registrar_.Add(this,
@@ -95,31 +93,10 @@ void InstallTracker::Shutdown() {
FOR_EACH_OBSERVER(InstallObserver, observers_, OnShutdown());
}
-void InstallTracker::OnExtensionLoaded(content::BrowserContext* browser_context,
- const Extension* extension) {
- FOR_EACH_OBSERVER(InstallObserver, observers_, OnExtensionLoaded(extension));
-}
-
-void InstallTracker::OnExtensionUnloaded(
- content::BrowserContext* browser_context,
- const Extension* extension,
- UnloadedExtensionInfo::Reason reason) {
- FOR_EACH_OBSERVER(
- InstallObserver, observers_, OnExtensionUnloaded(extension));
-}
-
void InstallTracker::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case chrome::NOTIFICATION_EXTENSION_INSTALLED: {
- const Extension* extension =
- content::Details<const InstalledExtensionInfo>(details).ptr()->
- extension;
- FOR_EACH_OBSERVER(InstallObserver, observers_,
- OnExtensionInstalled(extension));
- break;
- }
case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
const Extension* extension =
content::Details<const Extension>(details).ptr();
@@ -151,6 +128,28 @@ void InstallTracker::Observe(int type,
}
}
+void InstallTracker::OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) {
+ FOR_EACH_OBSERVER(InstallObserver, observers_, OnExtensionLoaded(extension));
+}
+
+void InstallTracker::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) {
+ FOR_EACH_OBSERVER(
+ InstallObserver, observers_, OnExtensionUnloaded(extension));
+}
+
+void InstallTracker::OnExtensionWillBeInstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ bool is_update,
+ const std::string& old_name) {
+ FOR_EACH_OBSERVER(
+ InstallObserver, observers_, OnExtensionInstalled(extension));
+}
+
void InstallTracker::OnAppsReordered() {
FOR_EACH_OBSERVER(InstallObserver, observers_, OnAppsReordered());
}
« no previous file with comments | « chrome/browser/extensions/install_tracker.h ('k') | chrome/browser/extensions/webstore_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698