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

Side by Side Diff: content/public/browser/download_item.h

Issue 11571025: Initial CL for Downloads resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments. Created 7 years, 11 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 // Each download is represented by a DownloadItem, and all DownloadItems 5 // Each download is represented by a DownloadItem, and all DownloadItems
6 // are owned by the DownloadManager which maintains a global list of all 6 // are owned by the DownloadManager which maintains a global list of all
7 // downloads. DownloadItems are created when a user initiates a download, 7 // downloads. DownloadItems are created when a user initiates a download,
8 // and exist for the duration of the browser life time. 8 // and exist for the duration of the browser life time.
9 // 9 //
10 // Download observers: 10 // Download observers:
11 // DownloadItem::Observer: 11 // DownloadItem::Observer:
12 // - allows observers to receive notifications about one download from start 12 // - allows observers to receive notifications about one download from start
13 // to completion 13 // to completion
14 // Use AddObserver() / RemoveObserver() on the appropriate download object to 14 // Use AddObserver() / RemoveObserver() on the appropriate download object to
15 // receive state updates. 15 // receive state updates.
16 16
17 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ 17 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_
18 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ 18 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_
19 19
20 #include <map> 20 #include <map>
21 #include <string> 21 #include <string>
22 #include <vector> 22 #include <vector>
23 23
24 #include "base/file_path.h" 24 #include "base/file_path.h"
25 #include "base/string16.h" 25 #include "base/string16.h"
26 #include "base/supports_user_data.h" 26 #include "base/supports_user_data.h"
27 #include "content/public/browser/download_danger_type.h" 27 #include "content/public/browser/download_danger_type.h"
28 #include "content/public/browser/download_interrupt_reasons.h" 28 #include "content/public/browser/download_interrupt_reasons.h"
29 #include "content/public/common/page_transition_types.h" 29 #include "content/public/common/page_transition_types.h"
30 #include "net/base/net_log.h"
benjhayden 2013/01/08 16:41:17 necessary?
Randy Smith (Not in Mondays) 2013/01/09 22:34:37 Apparently not :-}.
30 31
31 class FilePath; 32 class FilePath;
32 class GURL; 33 class GURL;
33 34
34 namespace base { 35 namespace base {
35 class Time; 36 class Time;
36 class TimeDelta; 37 class TimeDelta;
37 } 38 }
38 39
39 namespace content { 40 namespace content {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 virtual void UpdateObservers() = 0; 116 virtual void UpdateObservers() = 0;
116 117
117 // User Actions -------------------------------------------------------------- 118 // User Actions --------------------------------------------------------------
118 119
119 // Called when the user has validated the download of a dangerous file. 120 // Called when the user has validated the download of a dangerous file.
120 virtual void DangerousDownloadValidated() = 0; 121 virtual void DangerousDownloadValidated() = 0;
121 122
122 // Allow the user to temporarily pause a download or resume a paused download. 123 // Allow the user to temporarily pause a download or resume a paused download.
123 virtual void TogglePause() = 0; 124 virtual void TogglePause() = 0;
124 125
126 // Resume a download that's been interrupted.
127 virtual void ResumeInterruptedDownload() = 0;
128
125 // Cancel the download operation. We need to distinguish between cancels at 129 // Cancel the download operation. We need to distinguish between cancels at
126 // exit (DownloadManager destructor) from user interface initiated cancels 130 // exit (DownloadManager destructor) from user interface initiated cancels
127 // because at exit, the history system may not exist, and any updates to it 131 // because at exit, the history system may not exist, and any updates to it
128 // require AddRef'ing the DownloadManager in the destructor which results in 132 // require AddRef'ing the DownloadManager in the destructor which results in
129 // a DCHECK failure. Set |user_cancel| to false when canceling from at 133 // a DCHECK failure. Set |user_cancel| to false when canceling from at
130 // exit to prevent this crash. This may result in a difference between the 134 // exit to prevent this crash. This may result in a difference between the
131 // downloaded file's size on disk, and what the history system's last record 135 // downloaded file's size on disk, and what the history system's last record
132 // of it is. At worst, we'll end up re-downloading a small portion of the file 136 // of it is. At worst, we'll end up re-downloading a small portion of the file
133 // when resuming a download (assuming the server supports byte ranges). 137 // when resuming a download (assuming the server supports byte ranges).
134 virtual void Cancel(bool user_cancel) = 0; 138 virtual void Cancel(bool user_cancel) = 0;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 virtual void SetDisplayName(const FilePath& name) = 0; 323 virtual void SetDisplayName(const FilePath& name) = 0;
320 324
321 // Debug/testing ------------------------------------------------------------- 325 // Debug/testing -------------------------------------------------------------
322 virtual std::string DebugString(bool verbose) const = 0; 326 virtual std::string DebugString(bool verbose) const = 0;
323 virtual void MockDownloadOpenForTesting() = 0; 327 virtual void MockDownloadOpenForTesting() = 0;
324 }; 328 };
325 329
326 } // namespace content 330 } // namespace content
327 331
328 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ 332 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698