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

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

Issue 23496076: WIP - Refactor programmatic downloads Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/browser/download/download_file.h" 14 #include "content/browser/download/download_file.h"
15 #include "content/browser/download/download_request_handle.h" 15 #include "content/browser/download/download_request_handle.h"
16 #include "content/browser/loader/global_routing_id.h"
16 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
17 #include "content/public/browser/download_save_info.h"
18 #include "content/public/common/page_transition_types.h" 18 #include "content/public/common/page_transition_types.h"
19 #include "net/base/net_log.h" 19 #include "net/base/net_log.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 namespace content { 22 namespace content {
23 23
24 class ByteStreamReader;
25 struct DownloadSaveInfo;
26
24 // Used for informing the download manager of a new download, since we don't 27 // Used for informing the download manager of a new download, since we don't
25 // want to pass |DownloadItem|s between threads. 28 // want to pass |DownloadItem|s between threads.
26 struct CONTENT_EXPORT DownloadCreateInfo { 29 struct CONTENT_EXPORT DownloadCreateInfo {
27 DownloadCreateInfo(const base::Time& start_time, 30 DownloadCreateInfo(const base::Time& start_time,
28 int64 total_bytes, 31 int64 total_bytes,
29 const net::BoundNetLog& bound_net_log, 32 const net::BoundNetLog& bound_net_log,
30 bool has_user_gesture, 33 bool has_user_gesture,
31 PageTransition transition_type); 34 PageTransition transition_type,
35 scoped_ptr<DownloadSaveInfo> save_info);
32 DownloadCreateInfo(); 36 DownloadCreateInfo();
33 ~DownloadCreateInfo(); 37 ~DownloadCreateInfo();
34 38
39 // True if this is a SavePackage download. Such downloads aren't associated
40 // with a URLRequest and the download process is managed by SavePackage.
41 // TODO(asanka): Get rid of this when SavePackage downloads share more code
42 // with the rest of the downloads system. http://crbug.com/6025
43 bool is_save_package_download;
44
35 std::string DebugString() const; 45 std::string DebugString() const;
36 46
37 // The URL from which we are downloading. This is the final URL after any 47 // The URL from which we are downloading. This is the final URL after any
38 // redirection by the server for |url_chain|. 48 // redirection by the server for |url_chain|.
39 const GURL& url() const; 49 const GURL& url() const;
40 50
41 // The chain of redirects that leading up to and including the final URL. 51 // The chain of redirects that leading up to and including the final URL.
42 std::vector<GURL> url_chain; 52 std::vector<GURL> url_chain;
43 53
44 // The URL that referred us. 54 // The URL that referred us.
45 GURL referrer_url; 55 GURL referrer_url;
46 56
47 // The time when the download started. 57 // The time when the download started.
48 base::Time start_time; 58 base::Time start_time;
49 59
50 // The total download size. 60 // The total download size.
51 int64 total_bytes; 61 int64 total_bytes;
52 62
53 // The ID of the download.
54 uint32 download_id;
55
56 // True if the download was initiated by user action. 63 // True if the download was initiated by user action.
57 bool has_user_gesture; 64 bool has_user_gesture;
58 65
59 PageTransition transition_type; 66 PageTransition transition_type;
60 67
61 // The content-disposition string from the response header. 68 // The content-disposition string from the response header.
62 std::string content_disposition; 69 std::string content_disposition;
63 70
64 // The mime type string from the response header (may be overridden). 71 // The mime type string from the response header (may be overridden).
65 std::string mime_type; 72 std::string mime_type;
66 73
67 // The value of the content type header sent with the downloaded item. It 74 // The value of the content type header sent with the downloaded item. It
68 // may be different from |mime_type|, which may be set based on heuristics 75 // may be different from |mime_type|, which may be set based on heuristics
69 // which may look at the file extension and first few bytes of the file. 76 // which may look at the file extension and first few bytes of the file.
70 std::string original_mime_type; 77 std::string original_mime_type;
71 78
72 // For continuing a download, the modification time of the file. 79 // For continuing a download, the modification time of the file.
73 // Storing as a string for exact match to server format on 80 // Storing as a string for exact match to server format on
74 // "If-Unmodified-Since" comparison. 81 // "If-Unmodified-Since" comparison.
75 std::string last_modified; 82 std::string last_modified;
76 83
77 // For continuing a download, the ETAG of the file. 84 // For continuing a download, the ETAG of the file.
78 std::string etag; 85 std::string etag;
79 86
80 // The download file save info. 87 // The download file save info.
81 scoped_ptr<DownloadSaveInfo> save_info; 88 scoped_ptr<DownloadSaveInfo> save_info;
82 89
90 // Stream reader.
91 scoped_ptr<ByteStreamReader> stream_reader;
92
83 // The remote IP address where the download was fetched from. Copied from 93 // The remote IP address where the download was fetched from. Copied from
84 // UrlRequest::GetSocketAddress(). 94 // UrlRequest::GetSocketAddress().
85 std::string remote_address; 95 std::string remote_address;
86 96
87 // The handle to the URLRequest sourcing this download. 97 // Route associated with this download. This is used to locate the associated
88 DownloadRequestHandle request_handle; 98 // WebContents if one is available.
99 GlobalRoutingID route_id;
89 100
90 // The request's |BoundNetLog|, for "source_dependency" linking with the 101 // The request's |BoundNetLog|, for "source_dependency" linking with the
91 // download item's. 102 // download item's.
92 const net::BoundNetLog request_bound_net_log; 103 const net::BoundNetLog request_bound_net_log;
93 104
94 private: 105 private:
95 DISALLOW_COPY_AND_ASSIGN(DownloadCreateInfo); 106 DISALLOW_COPY_AND_ASSIGN(DownloadCreateInfo);
96 }; 107 };
97 108
98 } // namespace content 109 } // namespace content
99 110
100 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ 111 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_browsertest.cc ('k') | content/browser/download/download_create_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698