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

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

Issue 15575002: Use DownloadManager::Observer in TestDownloadShelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing OVERRIDE Created 7 years, 7 months 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/test_download_shelf.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/test_download_shelf.cc
diff --git a/chrome/browser/download/test_download_shelf.cc b/chrome/browser/download/test_download_shelf.cc
index c28cb0382f4fda4f408aedda7f82c7ea62b63bda..9538b7cdc0a8694ec344ba874c4621da833b02cd 100644
--- a/chrome/browser/download/test_download_shelf.cc
+++ b/chrome/browser/download/test_download_shelf.cc
@@ -8,10 +8,13 @@
TestDownloadShelf::TestDownloadShelf()
: is_showing_(false),
- did_add_download_(false) {
+ did_add_download_(false),
+ download_manager_(NULL) {
}
TestDownloadShelf::~TestDownloadShelf() {
+ if (download_manager_)
+ download_manager_->RemoveObserver(this);
}
bool TestDownloadShelf::IsShowing() const {
@@ -28,7 +31,16 @@ Browser* TestDownloadShelf::browser() const {
void TestDownloadShelf::set_download_manager(
content::DownloadManager* download_manager) {
+ if (download_manager_)
+ download_manager_->RemoveObserver(this);
download_manager_ = download_manager;
+ if (download_manager_)
+ download_manager_->AddObserver(this);
+}
+
+void TestDownloadShelf::ManagerGoingDown(content::DownloadManager* manager) {
+ DCHECK_EQ(manager, download_manager_);
+ download_manager_ = NULL;
}
void TestDownloadShelf::DoAddDownload(content::DownloadItem* download) {
@@ -48,5 +60,5 @@ base::TimeDelta TestDownloadShelf::GetTransientDownloadShowDelay() {
}
content::DownloadManager* TestDownloadShelf::GetDownloadManager() {
- return download_manager_.get();
+ return download_manager_;
}
« no previous file with comments | « chrome/browser/download/test_download_shelf.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698