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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 namespace extensions { | 23 namespace extensions { |
24 class ExtensionDownloadsEventRouter; | 24 class ExtensionDownloadsEventRouter; |
25 } | 25 } |
26 | 26 |
27 // Owning class for ChromeDownloadManagerDelegate. | 27 // Owning class for ChromeDownloadManagerDelegate. |
28 class DownloadService : public KeyedService { | 28 class DownloadService : public KeyedService { |
29 public: | 29 public: |
30 explicit DownloadService(Profile* profile); | 30 explicit DownloadService(Profile* profile); |
31 virtual ~DownloadService(); | 31 ~DownloadService() override; |
32 | 32 |
33 // Get the download manager delegate, creating it if it doesn't already exist. | 33 // Get the download manager delegate, creating it if it doesn't already exist. |
34 ChromeDownloadManagerDelegate* GetDownloadManagerDelegate(); | 34 ChromeDownloadManagerDelegate* GetDownloadManagerDelegate(); |
35 | 35 |
36 // Get the interface to the history system. Returns NULL if profile is | 36 // 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 | 37 // incognito or if the DownloadManager hasn't been created yet or if there is |
38 // no HistoryService for profile. Virtual for testing. | 38 // no HistoryService for profile. Virtual for testing. |
39 virtual DownloadHistory* GetDownloadHistory(); | 39 virtual DownloadHistory* GetDownloadHistory(); |
40 | 40 |
41 #if defined(ENABLE_EXTENSIONS) | 41 #if defined(ENABLE_EXTENSIONS) |
(...skipping 19 matching lines...) Expand all Loading... |
61 static void CancelAllDownloads(); | 61 static void CancelAllDownloads(); |
62 | 62 |
63 // Sets the DownloadManagerDelegate associated with this object and | 63 // Sets the DownloadManagerDelegate associated with this object and |
64 // its DownloadManager. Takes ownership of |delegate|, and destroys | 64 // its DownloadManager. Takes ownership of |delegate|, and destroys |
65 // the previous delegate. For testing. | 65 // the previous delegate. For testing. |
66 void SetDownloadManagerDelegateForTesting( | 66 void SetDownloadManagerDelegateForTesting( |
67 scoped_ptr<ChromeDownloadManagerDelegate> delegate); | 67 scoped_ptr<ChromeDownloadManagerDelegate> delegate); |
68 | 68 |
69 // Will be called to release references on other services as part | 69 // Will be called to release references on other services as part |
70 // of Profile shutdown. | 70 // of Profile shutdown. |
71 virtual void Shutdown() override; | 71 void Shutdown() override; |
72 | 72 |
73 // Returns false if at least one extension has disabled the shelf, true | 73 // Returns false if at least one extension has disabled the shelf, true |
74 // otherwise. | 74 // otherwise. |
75 bool IsShelfEnabled(); | 75 bool IsShelfEnabled(); |
76 | 76 |
77 private: | 77 private: |
78 bool download_manager_created_; | 78 bool download_manager_created_; |
79 Profile* profile_; | 79 Profile* profile_; |
80 | 80 |
81 // ChromeDownloadManagerDelegate may be the target of callbacks from | 81 // ChromeDownloadManagerDelegate may be the target of callbacks from |
(...skipping 21 matching lines...) Expand all Loading... |
103 // should be a separate EDER for on-record and off-record managers. | 103 // should be a separate EDER for on-record and off-record managers. |
104 // There does not appear to be a separate ExtensionSystem for on-record and | 104 // There does not appear to be a separate ExtensionSystem for on-record and |
105 // off-record profiles, so ExtensionSystem cannot own the EDER. | 105 // off-record profiles, so ExtensionSystem cannot own the EDER. |
106 scoped_ptr<extensions::ExtensionDownloadsEventRouter> extension_event_router_; | 106 scoped_ptr<extensions::ExtensionDownloadsEventRouter> extension_event_router_; |
107 #endif | 107 #endif |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(DownloadService); | 109 DISALLOW_COPY_AND_ASSIGN(DownloadService); |
110 }; | 110 }; |
111 | 111 |
112 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ | 112 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ |
OLD | NEW |