Chromium Code Reviews| Index: chrome/browser/extensions/api/downloads/downloads_api.cc |
| diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc |
| index 91c66b31d505e5d8571c7f3bfd88b4a69932e09b..f504b6b21419869c3d38916c393bb6e3cdae545e 100644 |
| --- a/chrome/browser/extensions/api/downloads/downloads_api.cc |
| +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc |
| @@ -69,6 +69,7 @@ |
| #include "extensions/browser/event_router.h" |
| #include "extensions/browser/extension_function_dispatcher.h" |
| #include "extensions/browser/extension_prefs.h" |
| +#include "extensions/browser/extension_registry.h" |
| #include "extensions/browser/extension_system.h" |
| #include "extensions/common/extension.h" |
| #include "extensions/common/permissions/permissions_data.h" |
| @@ -508,8 +509,7 @@ void RunDownloadQuery( |
| query_out.Limit(limit); |
| } |
| - std::string state_string = |
| - downloads::ToString(query_in.state); |
| + std::string state_string = downloads::ToString(query_in.state); |
| if (!state_string.empty()) { |
| DownloadItem::DownloadState state = StateEnumFromString(state_string); |
| if (state == DownloadItem::MAX_DOWNLOAD_STATE) { |
| @@ -1522,11 +1522,12 @@ ExtensionDownloadsEventRouter::ExtensionDownloadsEventRouter( |
| Profile* profile, |
| DownloadManager* manager) |
| : profile_(profile), |
| - notifier_(manager, this) { |
| + notifier_(manager, this), |
| + scoped_extension_registry_observer_(this) { |
| DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| DCHECK(profile_); |
| - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| - content::Source<Profile>(profile_)); |
| + scoped_extension_registry_observer_.Add( |
| + extensions::ExtensionRegistry::Get(profile_)); |
| extensions::EventRouter* router = extensions::EventRouter::Get(profile_); |
| if (router) |
| router->RegisterObserver(this, |
| @@ -1897,20 +1898,13 @@ void ExtensionDownloadsEventRouter::DispatchEvent( |
| content::Details<std::string>(&json_args)); |
| } |
| -void ExtensionDownloadsEventRouter::Observe( |
| - int type, |
| - const content::NotificationSource& source, |
| - const content::NotificationDetails& details) { |
| +void ExtensionDownloadsEventRouter::OnExtensionUnloaded( |
| + content::BrowserContext* browser_context, |
| + const extensions::Extension* extension, |
| + extensions::UnloadedExtensionInfo::Reason reason) { |
| DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| - switch (type) { |
| - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| - extensions::UnloadedExtensionInfo* unloaded = |
| - content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); |
| - std::set<const extensions::Extension*>::iterator iter = |
| - shelf_disabling_extensions_.find(unloaded->extension); |
| + std::set<const extensions::Extension*>::iterator iter = |
| + shelf_disabling_extensions_.find(extension); |
| if (iter != shelf_disabling_extensions_.end()) |
|
benjhayden
2014/04/24 17:38:48
Is the indentation correct here? I can't tell.
limasdf
2014/04/24 18:27:47
My bad. Done.
|
| shelf_disabling_extensions_.erase(iter); |
| - break; |
| - } |
| - } |
| } |