summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_service.h
diff options
context:
space:
mode:
authorbenjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-10 00:17:16 +0000
committerbenjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-10 00:17:16 +0000
commitc579aa27044d28290382119a957bd7dda7cdbf45 (patch)
tree9c6ca6f0fe9790f118b75a99477b7ad0c9d0264f /chrome/browser/download/download_service.h
parentbb8fdacc6097766c54fb48e05c7a38662363da2c (diff)
downloadchromium_src-c579aa27044d28290382119a957bd7dda7cdbf45.zip
chromium_src-c579aa27044d28290382119a957bd7dda7cdbf45.tar.gz
chromium_src-c579aa27044d28290382119a957bd7dda7cdbf45.tar.bz2
Delay DownloadManager creation by adding a callback queue to DownloadService.
ExtensionDownloadsEventRouter's ctor pushes a Callback to this queue instead of calling GetDownloadManager(), which would create the manager. EDER doesn't really need the manager in its ctor, it just needs the manager before the manager does something interesting. BUG=106502 Review URL: http://codereview.chromium.org/8804018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_service.h')
-rw-r--r--chrome/browser/download/download_service.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/download/download_service.h b/chrome/browser/download/download_service.h
index 2317de1..41f659b 100644
--- a/chrome/browser/download/download_service.h
+++ b/chrome/browser/download/download_service.h
@@ -6,7 +6,10 @@
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_
#pragma once
+#include <vector>
+
#include "base/basictypes.h"
+#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
@@ -25,6 +28,10 @@ class DownloadService : public ProfileKeyedService {
DownloadIdFactory* GetDownloadIdFactory() const;
+ // Register a callback to be called whenever the DownloadManager is created.
+ typedef base::Callback<void(DownloadManager*)> OnManagerCreatedCallback;
+ void OnManagerCreated(const OnManagerCreatedCallback& cb);
+
// Get the download manager. Creates the download manager if
// it does not already exist.
DownloadManager* GetDownloadManager();
@@ -64,6 +71,8 @@ class DownloadService : public ProfileKeyedService {
scoped_refptr<DownloadManager> manager_;
scoped_refptr<ChromeDownloadManagerDelegate> manager_delegate_;
+ std::vector<OnManagerCreatedCallback> on_manager_created_callbacks_;
+
DISALLOW_COPY_AND_ASSIGN(DownloadService);
};