Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: chrome/browser/download/download_service.h

Issue 257983002: Move downloads API to extensions namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile error for unittest Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "components/keyed_service/core/keyed_service.h" 11 #include "components/keyed_service/core/keyed_service.h"
12 12
13 class ChromeDownloadManagerDelegate; 13 class ChromeDownloadManagerDelegate;
14 class DownloadHistory; 14 class DownloadHistory;
15 class DownloadUIController; 15 class DownloadUIController;
16 class ExtensionDownloadsEventRouter; 16 class ExtensionDownloadsEventRouter;
17 class Profile; 17 class Profile;
18 18
19 namespace content { 19 namespace content {
20 class DownloadManager; 20 class DownloadManager;
21 } 21 }
22 22
23 namespace extensions {
24 class ExtensionDownloadsEventRouter;
25 }
26
23 // Owning class for ChromeDownloadManagerDelegate. 27 // Owning class for ChromeDownloadManagerDelegate.
24 class DownloadService : public KeyedService { 28 class DownloadService : public KeyedService {
25 public: 29 public:
26 explicit DownloadService(Profile* profile); 30 explicit DownloadService(Profile* profile);
27 virtual ~DownloadService(); 31 virtual ~DownloadService();
28 32
29 // 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.
30 ChromeDownloadManagerDelegate* GetDownloadManagerDelegate(); 34 ChromeDownloadManagerDelegate* GetDownloadManagerDelegate();
31 35
32 // 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
33 // 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
34 // no HistoryService for profile. 38 // no HistoryService for profile.
35 DownloadHistory* GetDownloadHistory(); 39 DownloadHistory* GetDownloadHistory();
36 40
37 #if !defined(OS_ANDROID) 41 #if !defined(OS_ANDROID)
38 ExtensionDownloadsEventRouter* GetExtensionEventRouter() { 42 extensions::ExtensionDownloadsEventRouter* GetExtensionEventRouter() {
39 return extension_event_router_.get(); 43 return extension_event_router_.get();
40 } 44 }
41 #endif 45 #endif
42 46
43 // Has a download manager been created? 47 // Has a download manager been created?
44 bool HasCreatedDownloadManager(); 48 bool HasCreatedDownloadManager();
45 49
46 // Number of non-malicious downloads associated with this instance of the 50 // Number of non-malicious downloads associated with this instance of the
47 // service. 51 // service.
48 int NonMaliciousDownloadCount() const; 52 int NonMaliciousDownloadCount() const;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Once we have extensions on android, we probably need the EventRouter 94 // Once we have extensions on android, we probably need the EventRouter
91 // in ContentViewDownloadDelegate which knows about both GET and POST 95 // in ContentViewDownloadDelegate which knows about both GET and POST
92 // downloads. 96 // downloads.
93 #if !defined(OS_ANDROID) 97 #if !defined(OS_ANDROID)
94 // The ExtensionDownloadsEventRouter dispatches download creation, change, and 98 // The ExtensionDownloadsEventRouter dispatches download creation, change, and
95 // erase events to extensions. Like ChromeDownloadManagerDelegate, it's a 99 // erase events to extensions. Like ChromeDownloadManagerDelegate, it's a
96 // chrome-level concept and its lifetime should match DownloadManager. There 100 // chrome-level concept and its lifetime should match DownloadManager. There
97 // should be a separate EDER for on-record and off-record managers. 101 // should be a separate EDER for on-record and off-record managers.
98 // There does not appear to be a separate ExtensionSystem for on-record and 102 // There does not appear to be a separate ExtensionSystem for on-record and
99 // off-record profiles, so ExtensionSystem cannot own the EDER. 103 // off-record profiles, so ExtensionSystem cannot own the EDER.
100 scoped_ptr<ExtensionDownloadsEventRouter> extension_event_router_; 104 scoped_ptr<extensions::ExtensionDownloadsEventRouter> extension_event_router_;
101 #endif 105 #endif
102 106
103 DISALLOW_COPY_AND_ASSIGN(DownloadService); 107 DISALLOW_COPY_AND_ASSIGN(DownloadService);
104 }; 108 };
105 109
106 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ 110 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_history_unittest.cc ('k') | chrome/browser/download/download_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698