[email protected] | 002c918 | 2012-10-02 01:33:24 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "chrome/browser/download/test_download_shelf.h" | ||||
6 | |||||
[email protected] | 8542e68d | 2013-01-10 04:33:47 | [diff] [blame] | 7 | #include "content/public/browser/download_manager.h" |
8 | |||||
[email protected] | 002c918 | 2012-10-02 01:33:24 | [diff] [blame] | 9 | TestDownloadShelf::TestDownloadShelf() |
[email protected] | 8542e68d | 2013-01-10 04:33:47 | [diff] [blame] | 10 | : is_showing_(false), |
[email protected] | 86107c1 | 2013-05-23 12:47:05 | [diff] [blame] | 11 | did_add_download_(false), |
12 | download_manager_(NULL) { | ||||
[email protected] | 002c918 | 2012-10-02 01:33:24 | [diff] [blame] | 13 | } |
14 | |||||
15 | TestDownloadShelf::~TestDownloadShelf() { | ||||
[email protected] | 86107c1 | 2013-05-23 12:47:05 | [diff] [blame] | 16 | if (download_manager_) |
17 | download_manager_->RemoveObserver(this); | ||||
[email protected] | 002c918 | 2012-10-02 01:33:24 | [diff] [blame] | 18 | } |
19 | |||||
20 | bool TestDownloadShelf::IsShowing() const { | ||||
21 | return is_showing_; | ||||
22 | } | ||||
23 | |||||
24 | bool TestDownloadShelf::IsClosing() const { | ||||
25 | return false; | ||||
26 | } | ||||
27 | |||||
28 | Browser* TestDownloadShelf::browser() const { | ||||
29 | return NULL; | ||||
30 | } | ||||
31 | |||||
[email protected] | 8542e68d | 2013-01-10 04:33:47 | [diff] [blame] | 32 | void TestDownloadShelf::set_download_manager( |
33 | content::DownloadManager* download_manager) { | ||||
[email protected] | 86107c1 | 2013-05-23 12:47:05 | [diff] [blame] | 34 | if (download_manager_) |
35 | download_manager_->RemoveObserver(this); | ||||
[email protected] | 8542e68d | 2013-01-10 04:33:47 | [diff] [blame] | 36 | download_manager_ = download_manager; |
[email protected] | 86107c1 | 2013-05-23 12:47:05 | [diff] [blame] | 37 | if (download_manager_) |
38 | download_manager_->AddObserver(this); | ||||
39 | } | ||||
40 | |||||
41 | void TestDownloadShelf::ManagerGoingDown(content::DownloadManager* manager) { | ||||
42 | DCHECK_EQ(manager, download_manager_); | ||||
43 | download_manager_ = NULL; | ||||
[email protected] | 8542e68d | 2013-01-10 04:33:47 | [diff] [blame] | 44 | } |
45 | |||||
[email protected] | 41b0021 | 2013-01-08 18:27:29 | [diff] [blame] | 46 | void TestDownloadShelf::DoAddDownload(content::DownloadItem* download) { |
[email protected] | 8542e68d | 2013-01-10 04:33:47 | [diff] [blame] | 47 | did_add_download_ = true; |
[email protected] | 002c918 | 2012-10-02 01:33:24 | [diff] [blame] | 48 | } |
49 | |||||
sdy | 7578925 | 2017-02-17 17:25:57 | [diff] [blame^] | 50 | void TestDownloadShelf::DoOpen() { |
[email protected] | 002c918 | 2012-10-02 01:33:24 | [diff] [blame] | 51 | is_showing_ = true; |
52 | } | ||||
53 | |||||
[email protected] | 6fab103 | 2013-04-01 17:29:17 | [diff] [blame] | 54 | void TestDownloadShelf::DoClose(CloseReason reason) { |
[email protected] | 002c918 | 2012-10-02 01:33:24 | [diff] [blame] | 55 | is_showing_ = false; |
56 | } | ||||
57 | |||||
sdy | 7578925 | 2017-02-17 17:25:57 | [diff] [blame^] | 58 | void TestDownloadShelf::DoHide() { |
59 | is_showing_ = false; | ||||
60 | } | ||||
61 | |||||
62 | void TestDownloadShelf::DoUnhide() { | ||||
63 | is_showing_ = true; | ||||
64 | } | ||||
65 | |||||
[email protected] | 8542e68d | 2013-01-10 04:33:47 | [diff] [blame] | 66 | base::TimeDelta TestDownloadShelf::GetTransientDownloadShowDelay() { |
67 | return base::TimeDelta(); | ||||
68 | } | ||||
69 | |||||
70 | content::DownloadManager* TestDownloadShelf::GetDownloadManager() { | ||||
[email protected] | 86107c1 | 2013-05-23 12:47:05 | [diff] [blame] | 71 | return download_manager_; |
[email protected] | 8542e68d | 2013-01-10 04:33:47 | [diff] [blame] | 72 | } |