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

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

Issue 11363222: Persist download interrupt reason, both target and current paths, and url_chain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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) 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 #ifndef CONTENT_PUBlIC_BROWSER_DOWNLOAD_PERSISTENT_STORE_INFO_H_ 5 #ifndef CONTENT_PUBlIC_BROWSER_DOWNLOAD_PERSISTENT_STORE_INFO_H_
6 #define CONTENT_PUBlIC_BROWSER_DOWNLOAD_PERSISTENT_STORE_INFO_H_ 6 #define CONTENT_PUBlIC_BROWSER_DOWNLOAD_PERSISTENT_STORE_INFO_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "content/public/browser/download_item.h" 11 #include "content/public/browser/download_item.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 // Contains the information that is stored in the download system's persistent 16 // Contains the information that is stored in the download system's persistent
17 // store (or refers to it). Managed by the DownloadItem. When used to create a 17 // store (or refers to it). Managed by the DownloadItem. When used to create a
18 // history entry, all fields except for |db_handle| are set by DownloadItem and 18 // history entry, all fields except for |db_handle| are set by DownloadItem and
19 // read by DownloadDatabase. When used to update a history entry, DownloadItem 19 // read by DownloadDatabase. When used to update a history entry, DownloadItem
20 // sets all fields, but DownloadDatabase only reads |end_time|, 20 // sets all fields, but DownloadDatabase only reads |end_time|,
21 // |received_bytes|, |state|, and |opened|, and uses |db_handle| to select the 21 // |received_bytes|, |state|, and |opened|, and uses |db_handle| to select the
22 // row in the database table to update. When used to load DownloadItems from 22 // row in the database table to update. When used to load DownloadItems from
23 // the history, all fields except |referrer_url| are set by the DownloadDatabase 23 // the history, all fields except |referrer_url| are set by the DownloadDatabase
24 // and read by the DownloadItem. 24 // and read by the DownloadItem.
25 struct CONTENT_EXPORT DownloadPersistentStoreInfo { 25 struct CONTENT_EXPORT DownloadPersistentStoreInfo {
26 DownloadPersistentStoreInfo(); 26 DownloadPersistentStoreInfo();
27 DownloadPersistentStoreInfo(const FilePath& path, 27 DownloadPersistentStoreInfo(const FilePath& target_path,
28 const GURL& url, 28 const FilePath& current_path,
29 const std::vector<GURL>& url_chain,
29 const GURL& referrer, 30 const GURL& referrer,
30 const base::Time& start, 31 const base::Time& start,
31 const base::Time& end, 32 const base::Time& end,
32 int64 received, 33 int64 received,
33 int64 total, 34 int64 total,
34 DownloadItem::DownloadState download_state, 35 DownloadItem::DownloadState download_state,
36 DownloadInterruptReason interrupt_reason,
35 int64 handle, 37 int64 handle,
36 bool download_opened); 38 bool download_opened);
37 ~DownloadPersistentStoreInfo(); // For linux-clang. 39 ~DownloadPersistentStoreInfo(); // For linux-clang.
38 40
39 // The final path where the download is saved. 41 // The target path where the download will go when it's complete.
40 FilePath path; 42 FilePath target_path;
41 43
42 // The URL from which we are downloading. This is the final URL after any 44 // The current path to the download (potentially different from final if
43 // redirection by the server for |url_chain|. Is not changed by UpdateEntry(). 45 // download is in progress or interrupted).
44 GURL url; 46 FilePath current_path;
47
48 // The URL redirect chain through which we are downloading. The front
49 // is the url that the initial request went to, and the back is the
50 // url from which we ended up getting data. This is not changed by
51 // UpdateEntry().
52 std::vector<GURL> url_chain;
45 53
46 // The URL that referred us. 54 // The URL that referred us.
47 GURL referrer_url; 55 GURL referrer_url;
48 56
49 // The time when the download started. Is not changed by UpdateEntry(). 57 // The time when the download started. Is not changed by UpdateEntry().
50 base::Time start_time; 58 base::Time start_time;
51 59
52 // The time when the download completed. 60 // The time when the download completed.
53 base::Time end_time; 61 base::Time end_time;
54 62
55 // The number of bytes received (so far). 63 // The number of bytes received (so far).
56 int64 received_bytes; 64 int64 received_bytes;
57 65
58 // The total number of bytes in the download. Is not changed by UpdateEntry(). 66 // The total number of bytes in the download. Is not changed by UpdateEntry().
59 int64 total_bytes; 67 int64 total_bytes;
60 68
61 // The current state of the download. 69 // The current state of the download.
62 DownloadItem::DownloadState state; 70 DownloadItem::DownloadState state;
63 71
72 // The reason the download was interrupted, if
73 // state == DownloadItem::INTERRUPTED
74 DownloadInterruptReason interrupt_reason;
75
64 // 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
65 // UpdateEntry(). 77 // UpdateEntry().
66 int64 db_handle; 78 int64 db_handle;
67 79
68 // Whether this download has ever been opened from the browser. 80 // Whether this download has ever been opened from the browser.
69 bool opened; 81 bool opened;
70 }; 82 };
71 83
72 } // namespace content 84 } // namespace content
73 85
74 #endif // CONTENT_PUBlIC_BROWSER_DOWNLOAD_PERSISTENT_STORE_INFO_H_ 86 #endif // CONTENT_PUBlIC_BROWSER_DOWNLOAD_PERSISTENT_STORE_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698