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

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

Issue 6932046: Added DownloadProcessHandle class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments. Created 9 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
« no previous file with comments | « chrome/browser/download/download_item.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // The DownloadManager object manages the process of downloading, including 5 // The DownloadManager object manages the process of downloading, including
6 // updates to the history system and providing the information for displaying 6 // updates to the history system and providing the information for displaying
7 // the downloads view in the Destinations tab. There is one DownloadManager per 7 // the downloads view in the Destinations tab. There is one DownloadManager per
8 // active profile in Chrome. 8 // active profile in Chrome.
9 // 9 //
10 // Download observers: 10 // Download observers:
(...skipping 24 matching lines...) Expand all
35 35
36 #include "base/basictypes.h" 36 #include "base/basictypes.h"
37 #include "base/file_path.h" 37 #include "base/file_path.h"
38 #include "base/gtest_prod_util.h" 38 #include "base/gtest_prod_util.h"
39 #include "base/memory/ref_counted.h" 39 #include "base/memory/ref_counted.h"
40 #include "base/memory/weak_ptr.h" 40 #include "base/memory/weak_ptr.h"
41 #include "base/observer_list.h" 41 #include "base/observer_list.h"
42 #include "base/scoped_ptr.h" 42 #include "base/scoped_ptr.h"
43 #include "base/time.h" 43 #include "base/time.h"
44 #include "chrome/browser/download/download_status_updater_delegate.h" 44 #include "chrome/browser/download/download_status_updater_delegate.h"
45 #include "chrome/browser/download/download_process_handle.h"
45 #include "chrome/browser/ui/shell_dialogs.h" 46 #include "chrome/browser/ui/shell_dialogs.h"
46 #include "content/browser/browser_thread.h" 47 #include "content/browser/browser_thread.h"
47 48
48 class DownloadFileManager; 49 class DownloadFileManager;
49 class DownloadHistory; 50 class DownloadHistory;
50 class DownloadItem; 51 class DownloadItem;
51 class DownloadPrefs; 52 class DownloadPrefs;
52 class DownloadStatusUpdater; 53 class DownloadStatusUpdater;
53 class GURL; 54 class GURL;
54 class Profile; 55 class Profile;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // Remove a download observer from ourself. 192 // Remove a download observer from ourself.
192 void RemoveObserver(Observer* observer); 193 void RemoveObserver(Observer* observer);
193 194
194 // Methods called on completion of a query sent to the history system. 195 // Methods called on completion of a query sent to the history system.
195 void OnQueryDownloadEntriesComplete( 196 void OnQueryDownloadEntriesComplete(
196 std::vector<DownloadCreateInfo>* entries); 197 std::vector<DownloadCreateInfo>* entries);
197 void OnCreateDownloadEntryComplete( 198 void OnCreateDownloadEntryComplete(
198 DownloadCreateInfo info, int64 db_handle); 199 DownloadCreateInfo info, int64 db_handle);
199 200
200 // Display a new download in the appropriate browser UI. 201 // Display a new download in the appropriate browser UI.
201 void ShowDownloadInBrowser(const DownloadCreateInfo& info, 202 void ShowDownloadInBrowser(DownloadProcessHandle* process_handle,
202 DownloadItem* download); 203 DownloadItem* download);
203 204
204 // The number of in progress (including paused) downloads. 205 // The number of in progress (including paused) downloads.
205 int in_progress_count() const { 206 int in_progress_count() const {
206 return static_cast<int>(in_progress_.size()); 207 return static_cast<int>(in_progress_.size());
207 } 208 }
208 209
209 Profile* profile() { return profile_; } 210 Profile* profile() { return profile_; }
210 211
211 DownloadHistory* download_history() { return download_history_.get(); } 212 DownloadHistory* download_history() { return download_history_.get(); }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // Called on the UI thread once the DownloadManager has determined whether the 283 // Called on the UI thread once the DownloadManager has determined whether the
283 // suggested file path exists. 284 // suggested file path exists.
284 void OnPathExistenceAvailable(DownloadCreateInfo* info); 285 void OnPathExistenceAvailable(DownloadCreateInfo* info);
285 286
286 // Called back after a target path for the file to be downloaded to has been 287 // Called back after a target path for the file to be downloaded to has been
287 // determined, either automatically based on the suggested file name, or by 288 // determined, either automatically based on the suggested file name, or by
288 // the user in a Save As dialog box. 289 // the user in a Save As dialog box.
289 void AttachDownloadItem(DownloadCreateInfo* info); 290 void AttachDownloadItem(DownloadCreateInfo* info);
290 291
291 // Download cancel helper function. 292 // Download cancel helper function.
293 // |process_handle| is passed by value because it is ultimately passed to
294 // other threads, and this way we don't have to worry about object lifetimes.
292 void DownloadCancelledInternal(int download_id, 295 void DownloadCancelledInternal(int download_id,
293 int render_process_id, 296 DownloadProcessHandle process_handle);
294 int request_id);
295 297
296 // All data has been downloaded. 298 // All data has been downloaded.
297 // |hash| is sha256 hash for the downloaded file. It is empty when the hash 299 // |hash| is sha256 hash for the downloaded file. It is empty when the hash
298 // is not available. 300 // is not available.
299 void OnAllDataSaved(int32 download_id, int64 size, const std::string& hash); 301 void OnAllDataSaved(int32 download_id, int64 size, const std::string& hash);
300 302
301 // An error occurred in the download. 303 // An error occurred in the download.
302 void OnDownloadError(int32 download_id, int64 size, int os_error); 304 void OnDownloadError(int32 download_id, int64 size, int os_error);
303 305
304 // Updates the app icon about the overall download progress. 306 // Updates the app icon about the overall download progress.
305 void UpdateAppIcon(); 307 void UpdateAppIcon();
306 308
307 // Makes the ResourceDispatcherHost pause/un-pause a download request. 309 // Makes the ResourceDispatcherHost pause/un-pause a download request.
308 // Called on the IO thread. 310 // Called on the IO thread.
311 // |process_handle| is passed by value because this is called from other
312 // threads, and this way we don't have to worry about object lifetimes.
309 void PauseDownloadRequest(ResourceDispatcherHost* rdh, 313 void PauseDownloadRequest(ResourceDispatcherHost* rdh,
310 int render_process_id, 314 DownloadProcessHandle process_handle,
311 int request_id,
312 bool pause); 315 bool pause);
313 316
314 // Inform observers that the model has changed. 317 // Inform observers that the model has changed.
315 void NotifyModelChanged(); 318 void NotifyModelChanged();
316 319
317 DownloadItem* GetDownloadItem(int id); 320 DownloadItem* GetDownloadItem(int id);
318 321
319 // Debugging routine to confirm relationship between below 322 // Debugging routine to confirm relationship between below
320 // containers; no-op if NDEBUG. 323 // containers; no-op if NDEBUG.
321 void AssertContainersConsistent() const; 324 void AssertContainersConsistent() const;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // The "Save As" dialog box used to ask the user where a file should be 397 // The "Save As" dialog box used to ask the user where a file should be
395 // saved. 398 // saved.
396 scoped_refptr<SelectFileDialog> select_file_dialog_; 399 scoped_refptr<SelectFileDialog> select_file_dialog_;
397 400
398 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; 401 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_;
399 402
400 DISALLOW_COPY_AND_ASSIGN(DownloadManager); 403 DISALLOW_COPY_AND_ASSIGN(DownloadManager);
401 }; 404 };
402 405
403 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ 406 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_item.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698