| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/install_tracker.h" | 5 #include "chrome/browser/extensions/install_tracker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/install_tracker_factory.h" | 9 #include "chrome/browser/extensions/install_tracker_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
| 12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 13 #include "extensions/browser/extension_prefs.h" | 13 #include "extensions/browser/extension_prefs.h" |
| 14 #include "extensions/browser/pref_names.h" | 14 #include "extensions/browser/pref_names.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 InstallTracker::InstallTracker(Profile* profile, | 18 InstallTracker::InstallTracker(Profile* profile, |
| 19 extensions::ExtensionPrefs* prefs) { | 19 extensions::ExtensionPrefs* prefs) { |
| 20 AppSorting* sorting = prefs->app_sorting(); | 20 AppSorting* sorting = prefs->app_sorting(); |
| 21 | 21 |
| 22 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 22 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 23 content::Source<Profile>(profile)); | 23 content::Source<Profile>(profile)); |
| 24 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 24 registrar_.Add(this, |
| 25 content::Source<Profile>(profile)); | 25 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 26 content::Source<Profile>(profile)); |
| 26 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 27 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 27 content::Source<Profile>(profile)); | 28 content::Source<Profile>(profile)); |
| 28 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 29 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
| 29 content::Source<Profile>(profile)); | 30 content::Source<Profile>(profile)); |
| 30 registrar_.Add(this, | 31 registrar_.Add(this, |
| 31 chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, | 32 chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, |
| 32 content::Source<Profile>(profile)); | 33 content::Source<Profile>(profile)); |
| 33 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, | 34 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, |
| 34 content::Source<AppSorting>(sorting)); | 35 content::Source<AppSorting>(sorting)); |
| 35 registrar_.Add(this, chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST, | 36 registrar_.Add(this, chrome::NOTIFICATION_APP_INSTALLED_TO_APPLIST, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 const content::NotificationDetails& details) { | 102 const content::NotificationDetails& details) { |
| 102 switch (type) { | 103 switch (type) { |
| 103 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { | 104 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { |
| 104 const Extension* extension = | 105 const Extension* extension = |
| 105 content::Details<const InstalledExtensionInfo>(details).ptr()-> | 106 content::Details<const InstalledExtensionInfo>(details).ptr()-> |
| 106 extension; | 107 extension; |
| 107 FOR_EACH_OBSERVER(InstallObserver, observers_, | 108 FOR_EACH_OBSERVER(InstallObserver, observers_, |
| 108 OnExtensionInstalled(extension)); | 109 OnExtensionInstalled(extension)); |
| 109 break; | 110 break; |
| 110 } | 111 } |
| 111 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 112 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| 112 const Extension* extension = | 113 const Extension* extension = |
| 113 content::Details<const Extension>(details).ptr(); | 114 content::Details<const Extension>(details).ptr(); |
| 114 FOR_EACH_OBSERVER(InstallObserver, observers_, | 115 FOR_EACH_OBSERVER(InstallObserver, observers_, |
| 115 OnExtensionLoaded(extension)); | 116 OnExtensionLoaded(extension)); |
| 116 break; | 117 break; |
| 117 } | 118 } |
| 118 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { | 119 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 119 const content::Details<extensions::UnloadedExtensionInfo>& unload_info( | 120 const content::Details<extensions::UnloadedExtensionInfo>& unload_info( |
| 120 details); | 121 details); |
| 121 const Extension* extension = unload_info->extension; | 122 const Extension* extension = unload_info->extension; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 152 default: | 153 default: |
| 153 NOTREACHED(); | 154 NOTREACHED(); |
| 154 } | 155 } |
| 155 } | 156 } |
| 156 | 157 |
| 157 void InstallTracker::OnAppsReordered() { | 158 void InstallTracker::OnAppsReordered() { |
| 158 FOR_EACH_OBSERVER(InstallObserver, observers_, OnAppsReordered()); | 159 FOR_EACH_OBSERVER(InstallObserver, observers_, OnAppsReordered()); |
| 159 } | 160 } |
| 160 | 161 |
| 161 } // namespace extensions | 162 } // namespace extensions |
| OLD | NEW |