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_DOWNLOAD_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/keyed_service/core/keyed_service.h" | 11 #include "components/keyed_service/core/keyed_service.h" |
| 12 #include "extensions/features/features.h" |
12 | 13 |
13 class ChromeDownloadManagerDelegate; | 14 class ChromeDownloadManagerDelegate; |
14 class DownloadHistory; | 15 class DownloadHistory; |
15 class ExtensionDownloadsEventRouter; | 16 class ExtensionDownloadsEventRouter; |
16 class Profile; | 17 class Profile; |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 class DownloadManager; | 20 class DownloadManager; |
20 } | 21 } |
21 | 22 |
22 namespace extensions { | 23 namespace extensions { |
23 class ExtensionDownloadsEventRouter; | 24 class ExtensionDownloadsEventRouter; |
24 } | 25 } |
25 | 26 |
26 // Abstract base class for the download service; see DownloadServiceImpl for | 27 // Abstract base class for the download service; see DownloadServiceImpl for |
27 // implementation. | 28 // implementation. |
28 class DownloadService : public KeyedService { | 29 class DownloadService : public KeyedService { |
29 public: | 30 public: |
30 DownloadService(); | 31 DownloadService(); |
31 ~DownloadService() override; | 32 ~DownloadService() override; |
32 | 33 |
33 // Get the download manager delegate, creating it if it doesn't already exist. | 34 // Get the download manager delegate, creating it if it doesn't already exist. |
34 virtual ChromeDownloadManagerDelegate* GetDownloadManagerDelegate() = 0; | 35 virtual ChromeDownloadManagerDelegate* GetDownloadManagerDelegate() = 0; |
35 | 36 |
36 // Get the interface to the history system. Returns NULL if profile is | 37 // Get the interface to the history system. Returns NULL if profile is |
37 // incognito or if the DownloadManager hasn't been created yet or if there is | 38 // incognito or if the DownloadManager hasn't been created yet or if there is |
38 // no HistoryService for profile. Virtual for testing. | 39 // no HistoryService for profile. Virtual for testing. |
39 virtual DownloadHistory* GetDownloadHistory() = 0; | 40 virtual DownloadHistory* GetDownloadHistory() = 0; |
40 | 41 |
41 #if defined(ENABLE_EXTENSIONS) | 42 #if BUILDFLAG(ENABLE_EXTENSIONS) |
42 virtual extensions::ExtensionDownloadsEventRouter* | 43 virtual extensions::ExtensionDownloadsEventRouter* |
43 GetExtensionEventRouter() = 0; | 44 GetExtensionEventRouter() = 0; |
44 #endif | 45 #endif |
45 | 46 |
46 // Has a download manager been created? | 47 // Has a download manager been created? |
47 virtual bool HasCreatedDownloadManager() = 0; | 48 virtual bool HasCreatedDownloadManager() = 0; |
48 | 49 |
49 // Number of non-malicious downloads associated with this instance of the | 50 // Number of non-malicious downloads associated with this instance of the |
50 // service. | 51 // service. |
51 virtual int NonMaliciousDownloadCount() const = 0; | 52 virtual int NonMaliciousDownloadCount() const = 0; |
(...skipping 15 matching lines...) Expand all Loading... |
67 | 68 |
68 // Returns false if at least one extension has disabled the shelf, true | 69 // Returns false if at least one extension has disabled the shelf, true |
69 // otherwise. | 70 // otherwise. |
70 virtual bool IsShelfEnabled() = 0; | 71 virtual bool IsShelfEnabled() = 0; |
71 | 72 |
72 private: | 73 private: |
73 DISALLOW_COPY_AND_ASSIGN(DownloadService); | 74 DISALLOW_COPY_AND_ASSIGN(DownloadService); |
74 }; | 75 }; |
75 | 76 |
76 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ | 77 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ |
OLD | NEW |