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

Side by Side Diff: content/browser/download/download_persistent_store_info.h

Issue 8404049: Added member data to classes to support download resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rearranged structures for greater consistency. Created 9 years, 1 month 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) 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 // Download struct used for informing and querying the download system's 5 // Download struct used for informing and querying the download system's
6 // persitent store. 6 // persitent store.
7 7
8 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_ 8 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_
9 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_ 9 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_
10 #pragma once 10 #pragma once
11 11
12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/file_path.h" 15 #include "base/file_path.h"
15 #include "base/time.h" 16 #include "base/time.h"
17 #include "content/browser/download/interrupt_reasons.h"
16 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
17 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
18 20
19 class DownloadItem; 21 class DownloadItem;
20 22
21 // Contains the information that is stored in the download system's persistent 23 // Contains the information that is stored in the download system's persistent
22 // store (or refers to it). Managed by the DownloadItem. When used to create a 24 // store (or refers to it). Managed by the DownloadItem. When used to create a
23 // history entry, all fields except for |db_handle| are set by DownloadItem and 25 // history entry, all fields except for |db_handle| are set by DownloadItem and
24 // read by DownloadDatabase. When used to update a history entry, DownloadItem 26 // read by DownloadDatabase. When used to update a history entry, DownloadItem
25 // sets all fields, but DownloadDatabase only reads |end_time|, 27 // sets all fields, but DownloadDatabase only reads |end_time|,
26 // |received_bytes|, |state|, and |opened|, and uses |db_handle| to select the 28 // |received_bytes|, |state|, and |opened|, and uses |db_handle| to select the
27 // row in the database table to update. When used to load DownloadItems from 29 // row in the database table to update. When used to load DownloadItems from
28 // the history, all fields except |referrer_url| are set by the DownloadDatabase 30 // the history, all fields except |referrer_url| are set by the DownloadDatabase
29 // and read by the DownloadItem. 31 // and read by the DownloadItem.
30 struct CONTENT_EXPORT DownloadPersistentStoreInfo { 32 struct CONTENT_EXPORT DownloadPersistentStoreInfo {
31 // TODO(ahendrickson) -- Reduce the number of constructors.
32 DownloadPersistentStoreInfo(); 33 DownloadPersistentStoreInfo();
33 DownloadPersistentStoreInfo(const FilePath& path, 34 DownloadPersistentStoreInfo(const FilePath& path,
35 const FilePath& target,
34 const GURL& url, 36 const GURL& url,
35 const GURL& referrer, 37 const GURL& referrer,
36 const base::Time& start, 38 const base::Time& start,
37 const base::Time& end, 39 const base::Time& end,
38 int64 received, 40 int64 received,
39 int64 total, 41 int64 total,
40 int32 download_state, 42 int32 download_state,
41 int64 handle, 43 int64 handle,
42 bool download_opened); 44 bool download_opened,
45 const std::string& hash_state_pickle,
Randy Smith (Not in Mondays) 2011/11/22 17:37:49 nit: I'd like to use consistent vocabulary for thi
ahendrickson 2011/11/22 23:46:44 Done.
46 const std::string& last_modified,
47 const std::string& etag,
48 InterruptReason reason);
43 ~DownloadPersistentStoreInfo(); // For linux-clang. 49 ~DownloadPersistentStoreInfo(); // For linux-clang.
44 50
45 // The final path where the download is saved. 51 // The file name that we are currently using.
46 FilePath path; 52 FilePath path;
47 53
54 // The final path where the download will be saved.
55 FilePath target_name;
56
48 // The URL from which we are downloading. This is the final URL after any 57 // The URL from which we are downloading. This is the final URL after any
49 // redirection by the server for |url_chain|. Is not changed by UpdateEntry(). 58 // redirection by the server for |url_chain|. Is not changed by UpdateEntry().
50 GURL url; 59 GURL url;
51 60
52 // The URL that referred us. 61 // The URL that referred us.
53 GURL referrer_url; 62 GURL referrer_url;
54 63
55 // The time when the download started. Is not changed by UpdateEntry(). 64 // The time when the download started. Is not changed by UpdateEntry().
56 base::Time start_time; 65 base::Time start_time;
57 66
58 // The time when the download completed. 67 // The time when the download completed.
59 base::Time end_time; 68 base::Time end_time;
60 69
61 // The number of bytes received (so far). 70 // The number of bytes received (so far).
62 int64 received_bytes; 71 int64 received_bytes;
63 72
64 // The total number of bytes in the download. Is not changed by UpdateEntry(). 73 // The total number of bytes in the download. Is not changed by UpdateEntry().
65 int64 total_bytes; 74 int64 total_bytes;
66 75
67 // The current state of the download. 76 // The current state of the download.
68 int32 state; 77 int32 state;
69 78
70 // The handle of the download in the database. Is not changed by 79 // The handle of the download in the database. Is not changed by
71 // UpdateEntry(). 80 // UpdateEntry().
72 int64 db_handle; 81 int64 db_handle;
73 82
74 // Whether this download has ever been opened from the browser. 83 // Whether this download has ever been opened from the browser.
75 bool opened; 84 bool opened;
85
86 // The state of the Sha256 hash of the content.
87 std::string hash_state;
88
89 // Server's time stamp for the file.
90 std::string last_modified_time;
91
92 // Server's ETAG for the file.
93 std::string etag;
94
95 // The reason that the download was interrupted (if it was).
96 InterruptReason last_reason;
76 }; 97 };
77 98
78 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_ 99 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698