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

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

Issue 10263019: DownloadManagerDelegate::ShouldCompleteDownload(callback) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 8 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_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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 virtual void Shutdown() OVERRIDE; 58 virtual void Shutdown() OVERRIDE;
59 virtual content::DownloadId GetNextId() OVERRIDE; 59 virtual content::DownloadId GetNextId() OVERRIDE;
60 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; 60 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE;
61 virtual void ChooseDownloadPath(content::WebContents* web_contents, 61 virtual void ChooseDownloadPath(content::WebContents* web_contents,
62 const FilePath& suggested_path, 62 const FilePath& suggested_path,
63 int32 download_id) OVERRIDE; 63 int32 download_id) OVERRIDE;
64 virtual FilePath GetIntermediatePath(const FilePath& suggested_path) OVERRIDE; 64 virtual FilePath GetIntermediatePath(const FilePath& suggested_path) OVERRIDE;
65 virtual content::WebContents* 65 virtual content::WebContents*
66 GetAlternativeWebContentsToNotifyForDownload() OVERRIDE; 66 GetAlternativeWebContentsToNotifyForDownload() OVERRIDE;
67 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; 67 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE;
68 virtual bool ShouldCompleteDownload(content::DownloadItem* item) OVERRIDE; 68 virtual bool ShouldCompleteDownload(
69 content::DownloadItem* item,
70 const base::Closure& complete_callback) OVERRIDE;
69 virtual bool ShouldOpenDownload(content::DownloadItem* item) OVERRIDE; 71 virtual bool ShouldOpenDownload(content::DownloadItem* item) OVERRIDE;
70 virtual bool GenerateFileHash() OVERRIDE; 72 virtual bool GenerateFileHash() OVERRIDE;
71 virtual void AddItemToPersistentStore(content::DownloadItem* item) OVERRIDE; 73 virtual void AddItemToPersistentStore(content::DownloadItem* item) OVERRIDE;
72 virtual void UpdateItemInPersistentStore( 74 virtual void UpdateItemInPersistentStore(
73 content::DownloadItem* item) OVERRIDE; 75 content::DownloadItem* item) OVERRIDE;
74 virtual void UpdatePathForItemInPersistentStore( 76 virtual void UpdatePathForItemInPersistentStore(
75 content::DownloadItem* item, 77 content::DownloadItem* item,
76 const FilePath& new_path) OVERRIDE; 78 const FilePath& new_path) OVERRIDE;
77 virtual void RemoveItemFromPersistentStore( 79 virtual void RemoveItemFromPersistentStore(
78 content::DownloadItem* item) OVERRIDE; 80 content::DownloadItem* item) OVERRIDE;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Callback from history system. 152 // Callback from history system.
151 void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle); 153 void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle);
152 154
153 // Check policy of whether we should open this download with a web intents 155 // Check policy of whether we should open this download with a web intents
154 // dispatch. 156 // dispatch.
155 bool ShouldOpenWithWebIntents(const content::DownloadItem* item); 157 bool ShouldOpenWithWebIntents(const content::DownloadItem* item);
156 158
157 // Open the given item with a web intent dispatch. 159 // Open the given item with a web intent dispatch.
158 void OpenWithWebIntent(const content::DownloadItem* item); 160 void OpenWithWebIntent(const content::DownloadItem* item);
159 161
162 // Internal gateways for ShouldCompleteDownload().
163 bool IsDownloadReadyForCompletion(
164 content::DownloadItem* item,
165 const base::Closure& internal_complete_callback);
166 void ShouldCompleteDownloadInternal(
167 int download_id,
168 const base::Closure& user_complete_callback);
169
160 Profile* profile_; 170 Profile* profile_;
161 int next_download_id_; 171 int next_download_id_;
162 scoped_ptr<DownloadPrefs> download_prefs_; 172 scoped_ptr<DownloadPrefs> download_prefs_;
163 scoped_ptr<DownloadHistory> download_history_; 173 scoped_ptr<DownloadHistory> download_history_;
164 174
165 // Maps from pending extension installations to DownloadItem IDs. 175 // Maps from pending extension installations to DownloadItem IDs.
166 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap; 176 typedef base::hash_map<CrxInstaller*, int> CrxInstallerMap;
167 CrxInstallerMap crx_installers_; 177 CrxInstallerMap crx_installers_;
168 178
169 content::NotificationRegistrar registrar_; 179 content::NotificationRegistrar registrar_;
170 180
171 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); 181 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate);
172 }; 182 };
173 183
174 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ 184 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_download_observer.cc ('k') | chrome/browser/download/chrome_download_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698