| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/profiles/profile_keyed_service.h" | 14 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 15 | 15 |
| 16 class ChromeDownloadManagerDelegate; | 16 class ChromeDownloadManagerDelegate; |
| 17 class DownloadHistory; | 17 class DownloadHistory; |
| 18 class DownloadUIController; |
| 18 class ExtensionDownloadsEventRouter; | 19 class ExtensionDownloadsEventRouter; |
| 19 class Profile; | 20 class Profile; |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 class DownloadManager; | 23 class DownloadManager; |
| 23 } | 24 } |
| 24 | 25 |
| 25 // Owning class for ChromeDownloadManagerDelegate. | 26 // Owning class for ChromeDownloadManagerDelegate. |
| 26 class DownloadService : public ProfileKeyedService { | 27 class DownloadService : public ProfileKeyedService { |
| 27 public: | 28 public: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 bool download_manager_created_; | 66 bool download_manager_created_; |
| 66 Profile* profile_; | 67 Profile* profile_; |
| 67 | 68 |
| 68 // ChromeDownloadManagerDelegate may be the target of callbacks from | 69 // ChromeDownloadManagerDelegate may be the target of callbacks from |
| 69 // the history service/DB thread and must be kept alive for those | 70 // the history service/DB thread and must be kept alive for those |
| 70 // callbacks. | 71 // callbacks. |
| 71 scoped_refptr<ChromeDownloadManagerDelegate> manager_delegate_; | 72 scoped_refptr<ChromeDownloadManagerDelegate> manager_delegate_; |
| 72 | 73 |
| 73 scoped_ptr<DownloadHistory> download_history_; | 74 scoped_ptr<DownloadHistory> download_history_; |
| 74 | 75 |
| 76 // The UI controller is responsible for observing the download manager and |
| 77 // notifying the UI of any new downloads. Its lifetime matches that of the |
| 78 // associated download manager. |
| 79 scoped_ptr<DownloadUIController> download_ui_; |
| 80 |
| 75 // On Android, GET downloads are not handled by the DownloadManager. | 81 // On Android, GET downloads are not handled by the DownloadManager. |
| 76 // Once we have extensions on android, we probably need the EventRouter | 82 // Once we have extensions on android, we probably need the EventRouter |
| 77 // in ContentViewDownloadDelegate which knows about both GET and POST | 83 // in ContentViewDownloadDelegate which knows about both GET and POST |
| 78 // downloads. | 84 // downloads. |
| 79 #if !defined(OS_ANDROID) | 85 #if !defined(OS_ANDROID) |
| 80 // The ExtensionDownloadsEventRouter dispatches download creation, change, and | 86 // The ExtensionDownloadsEventRouter dispatches download creation, change, and |
| 81 // erase events to extensions. Like ChromeDownloadManagerDelegate, it's a | 87 // erase events to extensions. Like ChromeDownloadManagerDelegate, it's a |
| 82 // chrome-level concept and its lifetime should match DownloadManager. There | 88 // chrome-level concept and its lifetime should match DownloadManager. There |
| 83 // should be a separate EDER for on-record and off-record managers. | 89 // should be a separate EDER for on-record and off-record managers. |
| 84 // There does not appear to be a separate ExtensionSystem for on-record and | 90 // There does not appear to be a separate ExtensionSystem for on-record and |
| 85 // off-record profiles, so ExtensionSystem cannot own the EDER. | 91 // off-record profiles, so ExtensionSystem cannot own the EDER. |
| 86 scoped_ptr<ExtensionDownloadsEventRouter> extension_event_router_; | 92 scoped_ptr<ExtensionDownloadsEventRouter> extension_event_router_; |
| 87 #endif | 93 #endif |
| 88 | 94 |
| 89 DISALLOW_COPY_AND_ASSIGN(DownloadService); | 95 DISALLOW_COPY_AND_ASSIGN(DownloadService); |
| 90 }; | 96 }; |
| 91 | 97 |
| 92 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ | 98 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ |
| OLD | NEW |