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

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: Incorporated Randy's comments. 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,
34 const GURL& url, 35 const GURL& url,
35 const GURL& referrer, 36 const GURL& referrer,
36 const base::Time& start, 37 const base::Time& start,
37 const base::Time& end, 38 const base::Time& end,
38 int64 received, 39 int64 received,
39 int64 total, 40 int64 total,
40 int32 download_state, 41 int32 download_state,
41 int64 handle, 42 int64 handle,
42 bool download_opened); 43 bool download_opened,
44 const std::string& hash,
45 const std::string& last_modified,
46 const std::string& etag,
47 InterruptReason reason);
43 ~DownloadPersistentStoreInfo(); // For linux-clang. 48 ~DownloadPersistentStoreInfo(); // For linux-clang.
44 49
45 // The final path where the download is saved. 50 // The final path where the download is saved.
46 FilePath path; 51 FilePath path;
47 52
48 // The URL from which we are downloading. This is the final URL after any 53 // 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(). 54 // redirection by the server for |url_chain|. Is not changed by UpdateEntry().
50 GURL url; 55 GURL url;
51 56
52 // The URL that referred us. 57 // The URL that referred us.
(...skipping 13 matching lines...) Expand all
66 71
67 // The current state of the download. 72 // The current state of the download.
68 int32 state; 73 int32 state;
69 74
70 // The handle of the download in the database. Is not changed by 75 // The handle of the download in the database. Is not changed by
71 // UpdateEntry(). 76 // UpdateEntry().
72 int64 db_handle; 77 int64 db_handle;
73 78
74 // Whether this download has ever been opened from the browser. 79 // Whether this download has ever been opened from the browser.
75 bool opened; 80 bool opened;
81
82 // Sha256 hash of the content. This might be empty either because
83 // the download hasn't started yet or because the hash isn't needed
84 // (ChromeDownloadManagerDelegate::GenerateFileHash() returned false).
85 std::string hash;
86
87 // Server's time stamp for the file.
88 std::string last_modified_time;
89
90 // Server's ETAG for the file.
91 std::string etag;
92
93 // The reason that the download was interrupted (if it was).
94 InterruptReason last_reason;
76 }; 95 };
77 96
78 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_ 97 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_PERSISTENT_STORE_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698