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

Unified Diff: chrome/browser/download/download_extension_api.cc

Issue 8804018: Delay DownloadManager creation by adding a callback queue to DownloadService (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years 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/download/download_extension_api.h ('k') | chrome/browser/download/download_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/browser/download/download_extension_api.h ('k') | chrome/browser/download/download_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698