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

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

Issue 230103002: [Downloads] Ask DownloadHistory if a download was from history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build 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 | 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 "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 17 matching lines...) Expand all
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 virtual ~DownloadService();
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. 38 // no HistoryService for profile. Virtual for testing.
39 DownloadHistory* GetDownloadHistory(); 39 virtual DownloadHistory* GetDownloadHistory();
40 40
41 #if !defined(OS_ANDROID) 41 #if !defined(OS_ANDROID)
42 extensions::ExtensionDownloadsEventRouter* GetExtensionEventRouter() { 42 extensions::ExtensionDownloadsEventRouter* GetExtensionEventRouter() {
43 return extension_event_router_.get(); 43 return extension_event_router_.get();
44 } 44 }
45 #endif 45 #endif
46 46
47 // Has a download manager been created? 47 // Has a download manager been created?
48 bool HasCreatedDownloadManager(); 48 bool HasCreatedDownloadManager();
49 49
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // ChromeDownloadManagerDelegate may be the target of callbacks from 81 // ChromeDownloadManagerDelegate may be the target of callbacks from
82 // the history service/DB thread and must be kept alive for those 82 // the history service/DB thread and must be kept alive for those
83 // callbacks. 83 // callbacks.
84 scoped_ptr<ChromeDownloadManagerDelegate> manager_delegate_; 84 scoped_ptr<ChromeDownloadManagerDelegate> manager_delegate_;
85 85
86 scoped_ptr<DownloadHistory> download_history_; 86 scoped_ptr<DownloadHistory> download_history_;
87 87
88 // The UI controller is responsible for observing the download manager and 88 // The UI controller is responsible for observing the download manager and
89 // notifying the UI of any new downloads. Its lifetime matches that of the 89 // notifying the UI of any new downloads. Its lifetime matches that of the
90 // associated download manager. 90 // associated download manager.
91 // Note on destruction order: download_ui_ depends on download_history_ and
92 // should be destroyed before the latter.
91 scoped_ptr<DownloadUIController> download_ui_; 93 scoped_ptr<DownloadUIController> download_ui_;
92 94
93 // On Android, GET downloads are not handled by the DownloadManager. 95 // On Android, GET downloads are not handled by the DownloadManager.
94 // Once we have extensions on android, we probably need the EventRouter 96 // Once we have extensions on android, we probably need the EventRouter
95 // in ContentViewDownloadDelegate which knows about both GET and POST 97 // in ContentViewDownloadDelegate which knows about both GET and POST
96 // downloads. 98 // downloads.
97 #if !defined(OS_ANDROID) 99 #if !defined(OS_ANDROID)
98 // The ExtensionDownloadsEventRouter dispatches download creation, change, and 100 // The ExtensionDownloadsEventRouter dispatches download creation, change, and
99 // erase events to extensions. Like ChromeDownloadManagerDelegate, it's a 101 // erase events to extensions. Like ChromeDownloadManagerDelegate, it's a
100 // chrome-level concept and its lifetime should match DownloadManager. There 102 // chrome-level concept and its lifetime should match DownloadManager. There
101 // 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.
102 // 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
103 // off-record profiles, so ExtensionSystem cannot own the EDER. 105 // off-record profiles, so ExtensionSystem cannot own the EDER.
104 scoped_ptr<extensions::ExtensionDownloadsEventRouter> extension_event_router_; 106 scoped_ptr<extensions::ExtensionDownloadsEventRouter> extension_event_router_;
105 #endif 107 #endif
106 108
107 DISALLOW_COPY_AND_ASSIGN(DownloadService); 109 DISALLOW_COPY_AND_ASSIGN(DownloadService);
108 }; 110 };
109 111
110 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_ 112 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_item_model.cc ('k') | chrome/browser/download/download_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698