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

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: Merged with trunk 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"
16 #include "base/pickle.h"
15 #include "base/time.h" 17 #include "base/time.h"
18 #include "content/browser/download/interrupt_reasons.h"
16 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
17 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
18 21
19 class DownloadItem; 22 class DownloadItem;
20 23
21 // Contains the information that is stored in the download system's persistent 24 // 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 25 // 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 26 // 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 27 // read by DownloadDatabase. When used to update a history entry, DownloadItem
25 // sets all fields, but DownloadDatabase only reads |end_time|, 28 // sets all fields, but DownloadDatabase only reads |end_time|,
26 // |received_bytes|, |state|, and |opened|, and uses |db_handle| to select the 29 // |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 30 // 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 31 // the history, all fields except |referrer_url| are set by the DownloadDatabase
29 // and read by the DownloadItem. 32 // and read by the DownloadItem.
30 struct CONTENT_EXPORT DownloadPersistentStoreInfo { 33 struct CONTENT_EXPORT DownloadPersistentStoreInfo {
31 // TODO(ahendrickson) -- Reduce the number of constructors.
32 DownloadPersistentStoreInfo(); 34 DownloadPersistentStoreInfo();
33 DownloadPersistentStoreInfo(const FilePath& path, 35 DownloadPersistentStoreInfo(const FilePath& path,
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 Pickle& hash_state_pickle,
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 final path where the download is saved.
46 FilePath path; 52 FilePath path;
47 53
48 // The URL from which we are downloading. This is the final URL after any 54 // 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(). 55 // redirection by the server for |url_chain|. Is not changed by UpdateEntry().
50 GURL url; 56 GURL url;
51 57
52 // The URL that referred us. 58 // The URL that referred us.
(...skipping 13 matching lines...) Expand all
66 72
67 // The current state of the download. 73 // The current state of the download.
68 int32 state; 74 int32 state;
69 75
70 // The handle of the download in the database. Is not changed by 76 // The handle of the download in the database. Is not changed by
71 // UpdateEntry(). 77 // UpdateEntry().
72 int64 db_handle; 78 int64 db_handle;
73 79
74 // Whether this download has ever been opened from the browser. 80 // Whether this download has ever been opened from the browser.
75 bool opened; 81 bool opened;
82
83 // Pickle containing the state of the Sha256 hash of the content.
84 Pickle hash_state;
85
86 // Server's time stamp for the file.
87 std::string last_modified_time;
88
89 // Server's ETAG for the file.
90 std::string etag;
91
92 // The reason that the download was interrupted (if it was).
93 InterruptReason last_reason;
76 }; 94 };
77 95
78 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_ 96 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698