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_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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 virtual void Shutdown() OVERRIDE; | 54 virtual void Shutdown() OVERRIDE; |
55 virtual content::DownloadId GetNextId() OVERRIDE; | 55 virtual content::DownloadId GetNextId() OVERRIDE; |
56 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; | 56 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; |
57 virtual void ChooseDownloadPath(content::WebContents* web_contents, | 57 virtual void ChooseDownloadPath(content::WebContents* web_contents, |
58 const FilePath& suggested_path, | 58 const FilePath& suggested_path, |
59 int32 download_id) OVERRIDE; | 59 int32 download_id) OVERRIDE; |
60 virtual FilePath GetIntermediatePath(const FilePath& suggested_path) OVERRIDE; | 60 virtual FilePath GetIntermediatePath(const FilePath& suggested_path) OVERRIDE; |
61 virtual content::WebContents* | 61 virtual content::WebContents* |
62 GetAlternativeWebContentsToNotifyForDownload() OVERRIDE; | 62 GetAlternativeWebContentsToNotifyForDownload() OVERRIDE; |
63 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; | 63 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; |
64 virtual bool ShouldCompleteDownload(content::DownloadItem* item) OVERRIDE; | 64 virtual bool ShouldCompleteDownload( |
| 65 content::DownloadItem* item, |
| 66 const base::Closure& complete_callback) OVERRIDE; |
65 virtual bool ShouldOpenDownload(content::DownloadItem* item) OVERRIDE; | 67 virtual bool ShouldOpenDownload(content::DownloadItem* item) OVERRIDE; |
66 virtual bool GenerateFileHash() OVERRIDE; | 68 virtual bool GenerateFileHash() OVERRIDE; |
67 virtual void AddItemToPersistentStore(content::DownloadItem* item) OVERRIDE; | 69 virtual void AddItemToPersistentStore(content::DownloadItem* item) OVERRIDE; |
68 virtual void UpdateItemInPersistentStore( | 70 virtual void UpdateItemInPersistentStore( |
69 content::DownloadItem* item) OVERRIDE; | 71 content::DownloadItem* item) OVERRIDE; |
70 virtual void UpdatePathForItemInPersistentStore( | 72 virtual void UpdatePathForItemInPersistentStore( |
71 content::DownloadItem* item, | 73 content::DownloadItem* item, |
72 const FilePath& new_path) OVERRIDE; | 74 const FilePath& new_path) OVERRIDE; |
73 virtual void RemoveItemFromPersistentStore( | 75 virtual void RemoveItemFromPersistentStore( |
74 content::DownloadItem* item) OVERRIDE; | 76 content::DownloadItem* item) OVERRIDE; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Callback from history system. | 148 // Callback from history system. |
147 void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle); | 149 void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle); |
148 | 150 |
149 // Check policy of whether we should open this download with a web intents | 151 // Check policy of whether we should open this download with a web intents |
150 // dispatch. | 152 // dispatch. |
151 bool ShouldOpenWithWebIntents(const content::DownloadItem* item); | 153 bool ShouldOpenWithWebIntents(const content::DownloadItem* item); |
152 | 154 |
153 // Open the given item with a web intent dispatch. | 155 // Open the given item with a web intent dispatch. |
154 void OpenWithWebIntent(const content::DownloadItem* item); | 156 void OpenWithWebIntent(const content::DownloadItem* item); |
155 | 157 |
| 158 // Internal gateway for ShouldCompleteDownload(). |
| 159 void ShouldCompleteDownloadInternal( |
| 160 content::DownloadItem* item, |
| 161 const base::Closure& user_complete_callback); |
| 162 |
156 Profile* profile_; | 163 Profile* profile_; |
157 int next_download_id_; | 164 int next_download_id_; |
158 scoped_ptr<DownloadPrefs> download_prefs_; | 165 scoped_ptr<DownloadPrefs> download_prefs_; |
159 scoped_ptr<DownloadHistory> download_history_; | 166 scoped_ptr<DownloadHistory> download_history_; |
160 | 167 |
161 // Maps from pending extension installations to DownloadItem IDs. | 168 // Maps from pending extension installations to DownloadItem IDs. |
162 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; | 169 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; |
163 CrxInstallerMap crx_installers_; | 170 CrxInstallerMap crx_installers_; |
164 | 171 |
165 content::NotificationRegistrar registrar_; | 172 content::NotificationRegistrar registrar_; |
166 | 173 |
167 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); | 174 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); |
168 }; | 175 }; |
169 | 176 |
170 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ | 177 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |