Chromium Code Reviews| Index: chrome/browser/download/download_extension_api.cc |
| diff --git a/chrome/browser/download/download_extension_api.cc b/chrome/browser/download/download_extension_api.cc |
| index ecc78c9ff5b0c519ebdf2d3c9623253456e020f2..25bd9aee4734c41f6c3871caad385bdca538a401 100644 |
| --- a/chrome/browser/download/download_extension_api.cc |
| +++ b/chrome/browser/download/download_extension_api.cc |
| @@ -11,6 +11,7 @@ |
| #include <string> |
| #include "base/bind.h" |
| +#include "base/bind_helpers.h" |
| #include "base/callback.h" |
| #include "base/json/json_writer.h" |
| #include "base/logging.h" |
| @@ -474,16 +475,18 @@ base::DictionaryValue* DownloadItemToJSON(DownloadItem* item) { |
| } |
| } // anonymous namespace |
| -ExtensionDownloadsEventRouter::ExtensionDownloadsEventRouter( |
| - Profile* profile) |
| +ExtensionDownloadsEventRouter::ExtensionDownloadsEventRouter(Profile* profile) |
| : profile_(profile), |
| - manager_( |
| - profile ? |
| - DownloadServiceFactory::GetForProfile(profile)->GetDownloadManager() : |
| - NULL) { |
| + manager_(NULL) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| DCHECK(profile_); |
| - DCHECK(manager_); |
| + DownloadServiceFactory::GetForProfile(profile)->OnManagerCreated(base::Bind( |
|
Randy Smith (Not in Mondays)
2011/12/06 17:12:41
nit: Add a comment explaining what's going on here
benjhayden
2011/12/06 18:45:06
Done.
|
| + &ExtensionDownloadsEventRouter::Init, base::Unretained(this))); |
| +} |
| + |
| +void ExtensionDownloadsEventRouter::Init(DownloadManager* manager) { |
| + DCHECK(manager_ == NULL); |
| + manager_ = manager; |
| manager_->AddObserver(this); |
| } |