diff options
author | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 17:43:35 +0000 |
---|---|---|
committer | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 17:43:35 +0000 |
commit | 9bb54ee0d274f9ae59898b6bba050d50b88c0163 (patch) | |
tree | 496b773fc152caba664d031ac0528a896cd98dde /content | |
parent | 6e68de66949a24f7c80d715f492e94a4b69223d8 (diff) | |
download | chromium_src-9bb54ee0d274f9ae59898b6bba050d50b88c0163.zip chromium_src-9bb54ee0d274f9ae59898b6bba050d50b88c0163.tar.gz chromium_src-9bb54ee0d274f9ae59898b6bba050d50b88c0163.tar.bz2 |
Refactor downloads into a ProfileKeyedService.
BUG=94383
TEST=
Review URL: http://codereview.chromium.org/8135017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/browser_context.h | 1 | ||||
-rw-r--r-- | content/browser/download/download_manager.cc | 5 | ||||
-rw-r--r-- | content/browser/download/download_manager.h | 8 | ||||
-rw-r--r-- | content/shell/shell_browser_context.cc | 4 | ||||
-rw-r--r-- | content/shell/shell_browser_context.h | 1 | ||||
-rw-r--r-- | content/shell/shell_download_manager_delegate.h | 2 | ||||
-rw-r--r-- | content/test/test_browser_context.cc | 4 | ||||
-rw-r--r-- | content/test/test_browser_context.h | 1 |
8 files changed, 11 insertions, 15 deletions
diff --git a/content/browser/browser_context.h b/content/browser/browser_context.h index 8a3e39a..2b88d47 100644 --- a/content/browser/browser_context.h +++ b/content/browser/browser_context.h @@ -58,7 +58,6 @@ class BrowserContext { // Returns the DownloadManager associated with this context. virtual DownloadManager* GetDownloadManager() = 0; - virtual bool HasCreatedDownloadManager() const = 0; // Returns the request context information associated with this context. Call // this only on the UI thread, since it can send notifications that should diff --git a/content/browser/download/download_manager.cc b/content/browser/download/download_manager.cc index 99036f4..881beb9 100644 --- a/content/browser/download/download_manager.cc +++ b/content/browser/download/download_manager.cc @@ -613,6 +613,11 @@ void DownloadManager::RemoveFromActiveList(DownloadItem* download) { } } +void DownloadManager::SetDownloadManagerDelegate( + DownloadManagerDelegate* delegate) { + delegate_ = delegate; +} + void DownloadManager::UpdateDownloadProgress() { delegate_->DownloadProgressUpdated(); } diff --git a/content/browser/download/download_manager.h b/content/browser/download/download_manager.h index 822c1f7..d16ad2a 100644 --- a/content/browser/download/download_manager.h +++ b/content/browser/download/download_manager.h @@ -294,22 +294,24 @@ class CONTENT_EXPORT DownloadManager DownloadManagerDelegate* delegate() const { return delegate_; } + // For testing only. May be called from tests indirectly (through + // other for testing only methods). + void SetDownloadManagerDelegate(DownloadManagerDelegate* delegate); + private: typedef std::set<DownloadItem*> DownloadSet; typedef base::hash_map<int64, DownloadItem*> DownloadMap; // For testing. friend class DownloadManagerTest; - friend class MockDownloadManager; friend class DownloadTest; + friend class MockDownloadManager; friend class base::RefCountedThreadSafe<DownloadManager, BrowserThread::DeleteOnUIThread>; friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class DeleteTask<DownloadManager>; - void set_delegate(DownloadManagerDelegate* delegate) { delegate_ = delegate; } - virtual ~DownloadManager(); // Called on the FILE thread to check the existence of a downloaded file. diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index 28b4f2a..561382e 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -130,10 +130,6 @@ DownloadManager* ShellBrowserContext::GetDownloadManager() { return download_manager_.get(); } -bool ShellBrowserContext::HasCreatedDownloadManager() const { - return download_manager_.get() != NULL; -} - net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { if (!url_request_getter_) { url_request_getter_ = new ShellURLRequestContextGetter( diff --git a/content/shell/shell_browser_context.h b/content/shell/shell_browser_context.h index fc9f26e..595392e 100644 --- a/content/shell/shell_browser_context.h +++ b/content/shell/shell_browser_context.h @@ -35,7 +35,6 @@ class ShellBrowserContext : public BrowserContext { virtual bool IsOffTheRecord() OVERRIDE; virtual SSLHostState* GetSSLHostState() OVERRIDE; virtual DownloadManager* GetDownloadManager() OVERRIDE; - virtual bool HasCreatedDownloadManager() const OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( int renderer_child_id) OVERRIDE; diff --git a/content/shell/shell_download_manager_delegate.h b/content/shell/shell_download_manager_delegate.h index 56baf55..7d13cce 100644 --- a/content/shell/shell_download_manager_delegate.h +++ b/content/shell/shell_download_manager_delegate.h @@ -21,7 +21,7 @@ class ShellDownloadManagerDelegate public: ShellDownloadManagerDelegate(); - void SetDownloadManager(DownloadManager* download_manager); + void SetDownloadManager(DownloadManager* manager); virtual void Shutdown() OVERRIDE; virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; diff --git a/content/test/test_browser_context.cc b/content/test/test_browser_context.cc index 7ec34d5b..46ec0ec 100644 --- a/content/test/test_browser_context.cc +++ b/content/test/test_browser_context.cc @@ -30,10 +30,6 @@ DownloadManager* TestBrowserContext::GetDownloadManager() { return NULL; } -bool TestBrowserContext::HasCreatedDownloadManager() const { - return false; -} - net::URLRequestContextGetter* TestBrowserContext::GetRequestContext() { return NULL; } diff --git a/content/test/test_browser_context.h b/content/test/test_browser_context.h index dc65565..7d26d16 100644 --- a/content/test/test_browser_context.h +++ b/content/test/test_browser_context.h @@ -21,7 +21,6 @@ class TestBrowserContext : public content::BrowserContext { virtual bool IsOffTheRecord() OVERRIDE; virtual SSLHostState* GetSSLHostState() OVERRIDE; virtual DownloadManager* GetDownloadManager() OVERRIDE; - virtual bool HasCreatedDownloadManager() const OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( int renderer_child_id) OVERRIDE; |