OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 FilePath* website_save_dir, | 76 FilePath* website_save_dir, |
77 FilePath* download_save_dir) OVERRIDE; | 77 FilePath* download_save_dir) OVERRIDE; |
78 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package, | 78 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package, |
79 const FilePath& suggested_path, | 79 const FilePath& suggested_path, |
80 bool can_save_as_complete) OVERRIDE; | 80 bool can_save_as_complete) OVERRIDE; |
81 virtual void DownloadProgressUpdated() OVERRIDE; | 81 virtual void DownloadProgressUpdated() OVERRIDE; |
82 | 82 |
83 DownloadPrefs* download_prefs() { return download_prefs_.get(); } | 83 DownloadPrefs* download_prefs() { return download_prefs_.get(); } |
84 DownloadHistory* download_history() { return download_history_.get(); } | 84 DownloadHistory* download_history() { return download_history_.get(); } |
85 | 85 |
| 86 protected: |
| 87 // So that test classes can inherit from this for override purposes. |
| 88 virtual ~ChromeDownloadManagerDelegate(); |
| 89 |
| 90 // So that test classes that inherit from this for override purposes |
| 91 // can call back into the DownloadManager. |
| 92 scoped_refptr<DownloadManager> download_manager_; |
| 93 |
86 private: | 94 private: |
87 friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>; | 95 friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>; |
88 virtual ~ChromeDownloadManagerDelegate(); | |
89 | 96 |
90 // NotificationObserver implementation. | 97 // NotificationObserver implementation. |
91 virtual void Observe(int type, | 98 virtual void Observe(int type, |
92 const NotificationSource& source, | 99 const NotificationSource& source, |
93 const NotificationDetails& details) OVERRIDE; | 100 const NotificationDetails& details) OVERRIDE; |
94 | 101 |
95 // Callback function after url is checked with safebrowsing service. | 102 // Callback function after url is checked with safebrowsing service. |
96 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url); | 103 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url); |
97 | 104 |
98 // Callback function after we check whether the referrer URL has been visited | 105 // Callback function after we check whether the referrer URL has been visited |
(...skipping 22 matching lines...) Expand all Loading... |
121 bool visited_referrer_before); | 128 bool visited_referrer_before); |
122 | 129 |
123 // Callback from history system. | 130 // Callback from history system. |
124 void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle); | 131 void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle); |
125 | 132 |
126 // Callback function after download file hash is checked with safebrowsing | 133 // Callback function after download file hash is checked with safebrowsing |
127 // service. | 134 // service. |
128 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); | 135 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); |
129 | 136 |
130 Profile* profile_; | 137 Profile* profile_; |
131 scoped_refptr<DownloadManager> download_manager_; | |
132 scoped_ptr<DownloadPrefs> download_prefs_; | 138 scoped_ptr<DownloadPrefs> download_prefs_; |
133 scoped_ptr<DownloadHistory> download_history_; | 139 scoped_ptr<DownloadHistory> download_history_; |
134 | 140 |
135 // Maps from pending extension installations to DownloadItem IDs. | 141 // Maps from pending extension installations to DownloadItem IDs. |
136 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; | 142 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; |
137 CrxInstallerMap crx_installers_; | 143 CrxInstallerMap crx_installers_; |
138 | 144 |
139 NotificationRegistrar registrar_; | 145 NotificationRegistrar registrar_; |
140 | 146 |
141 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); | 147 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); |
142 }; | 148 }; |
143 | 149 |
144 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 150 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |