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

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

Issue 11574006: Implement chrome.downloads.onDeterminingFilename() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r185803 Created 7 years, 9 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 | Annotate | Revision Log
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 <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 ExtensionDownloadsEventRouter;
18 class Profile; 19 class Profile;
19 20
20 namespace content { 21 namespace content {
21 class DownloadManager; 22 class DownloadManager;
22 } 23 }
23 24
24 // Owning class for ChromeDownloadManagerDelegate. 25 // Owning class for ChromeDownloadManagerDelegate.
25 class DownloadService : public ProfileKeyedService { 26 class DownloadService : public ProfileKeyedService {
26 public: 27 public:
27 explicit DownloadService(Profile* profile); 28 explicit DownloadService(Profile* profile);
28 virtual ~DownloadService(); 29 virtual ~DownloadService();
29 30
30 // Get the download manager delegate, creating it if it doesn't already exist. 31 // Get the download manager delegate, creating it if it doesn't already exist.
31 ChromeDownloadManagerDelegate* GetDownloadManagerDelegate(); 32 ChromeDownloadManagerDelegate* GetDownloadManagerDelegate();
32 33
33 // Get the interface to the history system. Returns NULL if profile is 34 // Get the interface to the history system. Returns NULL if profile is
34 // incognito or if the DownloadManager hasn't been created yet or if there is 35 // incognito or if the DownloadManager hasn't been created yet or if there is
35 // no HistoryService for profile. 36 // no HistoryService for profile.
36 DownloadHistory* GetDownloadHistory(); 37 DownloadHistory* GetDownloadHistory();
37 38
39 #if !defined(OS_ANDROID)
40 ExtensionDownloadsEventRouter* GetExtensionEventRouter() {
41 return extension_event_router_.get();
42 }
43 #endif
44
38 // Has a download manager been created? 45 // Has a download manager been created?
39 bool HasCreatedDownloadManager(); 46 bool HasCreatedDownloadManager();
40 47
41 // Number of downloads associated with this instance of the service. 48 // Number of downloads associated with this instance of the service.
42 int DownloadCount() const; 49 int DownloadCount() const;
43 50
44 // Number of downloads associated with all profiles. 51 // Number of downloads associated with all profiles.
45 static int DownloadCountAllProfiles(); 52 static int DownloadCountAllProfiles();
46 53
47 // Sets the DownloadManagerDelegate associated with this object and 54 // Sets the DownloadManagerDelegate associated with this object and
(...skipping 10 matching lines...) Expand all
58 bool download_manager_created_; 65 bool download_manager_created_;
59 Profile* profile_; 66 Profile* profile_;
60 67
61 // ChromeDownloadManagerDelegate may be the target of callbacks from 68 // ChromeDownloadManagerDelegate may be the target of callbacks from
62 // the history service/DB thread and must be kept alive for those 69 // the history service/DB thread and must be kept alive for those
63 // callbacks. 70 // callbacks.
64 scoped_refptr<ChromeDownloadManagerDelegate> manager_delegate_; 71 scoped_refptr<ChromeDownloadManagerDelegate> manager_delegate_;
65 72
66 scoped_ptr<DownloadHistory> download_history_; 73 scoped_ptr<DownloadHistory> download_history_;
67 74
75 // On Android, GET downloads are not handled by the DownloadManager.
76 // Once we have extensions on android, we probably need the EventRouter
77 // in ContentViewDownloadDelegate which knows about both GET and POST
78 // downloads.
79 #if !defined(OS_ANDROID)
80 // The ExtensionDownloadsEventRouter dispatches download creation, change, and
81 // erase events to extensions. Like ChromeDownloadManagerDelegate, it's a
82 // chrome-level concept and its lifetime should match DownloadManager. There
83 // 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
85 // off-record profiles, so ExtensionSystem cannot own the EDER.
86 scoped_ptr<ExtensionDownloadsEventRouter> extension_event_router_;
87 #endif
88
68 DISALLOW_COPY_AND_ASSIGN(DownloadService); 89 DISALLOW_COPY_AND_ASSIGN(DownloadService);
69 }; 90 };
70 91
71 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ 92 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/download/download_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698