OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_DOWNLOAD_TEST_DOWNLOAD_SHELF_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_TEST_DOWNLOAD_SHELF_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_TEST_DOWNLOAD_SHELF_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_TEST_DOWNLOAD_SHELF_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "chrome/browser/download/download_shelf.h" | 11 #include "chrome/browser/download/download_shelf.h" |
12 #include "content/public/browser/download_manager.h" | 12 #include "content/public/browser/download_manager.h" |
13 | 13 |
14 // An implementation of DownloadShelf for testing. | 14 // An implementation of DownloadShelf for testing. |
15 class TestDownloadShelf : public DownloadShelf, | 15 class TestDownloadShelf : public DownloadShelf, |
16 public content::DownloadManager::Observer { | 16 public content::DownloadManager::Observer { |
17 public: | 17 public: |
18 TestDownloadShelf(); | 18 TestDownloadShelf(); |
19 ~TestDownloadShelf() override; | 19 ~TestDownloadShelf() override; |
20 | 20 |
21 // DownloadShelf: | 21 // DownloadShelf: |
| 22 void RemoveDownload(content::DownloadItem* download) override; |
22 bool IsShowing() const override; | 23 bool IsShowing() const override; |
23 bool IsClosing() const override; | 24 bool IsClosing() const override; |
24 Browser* browser() const override; | 25 Browser* browser() const override; |
25 | 26 |
26 // Return |true| if a download was added to this shelf. | 27 // Return |true| if a download was added to this shelf. |
27 bool did_add_download() const { return did_add_download_; } | 28 bool did_add_download() const { return did_add_download_; } |
28 | 29 |
29 // Set download_manager_ (and the result of calling GetDownloadManager()) | 30 // Set download_manager_ (and the result of calling GetDownloadManager()) |
30 void set_download_manager(content::DownloadManager* download_manager); | 31 void set_download_manager(content::DownloadManager* download_manager); |
31 | 32 |
32 // DownloadManager::Observer implementation. | 33 // DownloadManager::Observer implementation. |
33 void ManagerGoingDown(content::DownloadManager* manager) override; | 34 void ManagerGoingDown(content::DownloadManager* manager) override; |
34 | 35 |
35 protected: | 36 protected: |
36 void DoAddDownload(content::DownloadItem* download) override; | 37 void DoAddDownload(content::DownloadItem* download) override; |
37 void DoShow() override; | 38 void DoShow() override; |
38 void DoClose(CloseReason reason) override; | 39 void DoClose(CloseReason reason) override; |
39 base::TimeDelta GetTransientDownloadShowDelay() override; | 40 base::TimeDelta GetTransientDownloadShowDelay() override; |
40 content::DownloadManager* GetDownloadManager() override; | 41 content::DownloadManager* GetDownloadManager() override; |
41 | 42 |
42 private: | 43 private: |
43 bool is_showing_; | 44 bool is_showing_; |
44 bool did_add_download_; | 45 bool did_add_download_; |
45 content::DownloadManager* download_manager_; | 46 content::DownloadManager* download_manager_; |
46 | 47 |
47 DISALLOW_COPY_AND_ASSIGN(TestDownloadShelf); | 48 DISALLOW_COPY_AND_ASSIGN(TestDownloadShelf); |
48 }; | 49 }; |
49 | 50 |
50 #endif // CHROME_BROWSER_DOWNLOAD_TEST_DOWNLOAD_SHELF_H_ | 51 #endif // CHROME_BROWSER_DOWNLOAD_TEST_DOWNLOAD_SHELF_H_ |
OLD | NEW |