blob: 80711138cea1b4b6201608eeb01606bcc1c62e61 [file] [log] [blame]
[email protected]002c9182012-10-02 01:33:241// 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]8542e68d2013-01-10 04:33:477#include "content/public/browser/download_manager.h"
8
[email protected]002c9182012-10-02 01:33:249TestDownloadShelf::TestDownloadShelf()
[email protected]8542e68d2013-01-10 04:33:4710 : is_showing_(false),
[email protected]86107c12013-05-23 12:47:0511 did_add_download_(false),
12 download_manager_(NULL) {
[email protected]002c9182012-10-02 01:33:2413}
14
15TestDownloadShelf::~TestDownloadShelf() {
[email protected]86107c12013-05-23 12:47:0516 if (download_manager_)
17 download_manager_->RemoveObserver(this);
[email protected]002c9182012-10-02 01:33:2418}
19
20bool TestDownloadShelf::IsShowing() const {
21 return is_showing_;
22}
23
24bool TestDownloadShelf::IsClosing() const {
25 return false;
26}
27
28Browser* TestDownloadShelf::browser() const {
29 return NULL;
30}
31
[email protected]8542e68d2013-01-10 04:33:4732void TestDownloadShelf::set_download_manager(
33 content::DownloadManager* download_manager) {
[email protected]86107c12013-05-23 12:47:0534 if (download_manager_)
35 download_manager_->RemoveObserver(this);
[email protected]8542e68d2013-01-10 04:33:4736 download_manager_ = download_manager;
[email protected]86107c12013-05-23 12:47:0537 if (download_manager_)
38 download_manager_->AddObserver(this);
39}
40
41void TestDownloadShelf::ManagerGoingDown(content::DownloadManager* manager) {
42 DCHECK_EQ(manager, download_manager_);
43 download_manager_ = NULL;
[email protected]8542e68d2013-01-10 04:33:4744}
45
[email protected]41b00212013-01-08 18:27:2946void TestDownloadShelf::DoAddDownload(content::DownloadItem* download) {
[email protected]8542e68d2013-01-10 04:33:4747 did_add_download_ = true;
[email protected]002c9182012-10-02 01:33:2448}
49
sdy75789252017-02-17 17:25:5750void TestDownloadShelf::DoOpen() {
[email protected]002c9182012-10-02 01:33:2451 is_showing_ = true;
52}
53
[email protected]6fab1032013-04-01 17:29:1754void TestDownloadShelf::DoClose(CloseReason reason) {
[email protected]002c9182012-10-02 01:33:2455 is_showing_ = false;
56}
57
sdy75789252017-02-17 17:25:5758void TestDownloadShelf::DoHide() {
59 is_showing_ = false;
60}
61
62void TestDownloadShelf::DoUnhide() {
63 is_showing_ = true;
64}
65
[email protected]8542e68d2013-01-10 04:33:4766base::TimeDelta TestDownloadShelf::GetTransientDownloadShowDelay() {
67 return base::TimeDelta();
68}
69
70content::DownloadManager* TestDownloadShelf::GetDownloadManager() {
[email protected]86107c12013-05-23 12:47:0571 return download_manager_;
[email protected]8542e68d2013-01-10 04:33:4772}