| OLD | NEW |
| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "content/browser/download/download_file.h" | 15 #include "content/browser/download/download_file.h" |
| 16 #include "content/browser/download/download_types.h" | 16 #include "content/browser/download/download_types.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "content/public/browser/download_id.h" | 18 #include "content/public/browser/download_id.h" |
| 19 #include "content/public/common/page_transition_types.h" | 19 #include "content/public/common/page_transition_types.h" |
| 20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 #include "net/base/net_log.h" | 21 #include "net/base/net_log.h" |
| 22 | 22 |
| 23 // Used for informing the download manager of a new download, since we don't | 23 // Used for informing the download manager of a new download, since we don't |
| 24 // want to pass |DownloadItem|s between threads. | 24 // want to pass |DownloadItem|s between threads. |
| 25 struct CONTENT_EXPORT DownloadCreateInfo { | 25 struct CONTENT_EXPORT DownloadCreateInfo { |
| 26 DownloadCreateInfo(const FilePath& path, | 26 DownloadCreateInfo(const base::Time& start_time, |
| 27 const GURL& url, | |
| 28 const base::Time& start_time, | |
| 29 int64 received_bytes, | 27 int64 received_bytes, |
| 30 int64 total_bytes, | 28 int64 total_bytes, |
| 31 int32 state, | 29 int32 state, |
| 32 const net::BoundNetLog& bound_net_log, | 30 const net::BoundNetLog& bound_net_log, |
| 33 bool has_user_gesture, | 31 bool has_user_gesture, |
| 34 content::PageTransition transition_type); | 32 content::PageTransition transition_type); |
| 35 DownloadCreateInfo(); | 33 DownloadCreateInfo(); |
| 36 ~DownloadCreateInfo(); | 34 ~DownloadCreateInfo(); |
| 37 | 35 |
| 38 std::string DebugString() const; | 36 std::string DebugString() const; |
| 39 | 37 |
| 40 // The URL from which we are downloading. This is the final URL after any | 38 // The URL from which we are downloading. This is the final URL after any |
| 41 // redirection by the server for |url_chain|. | 39 // redirection by the server for |url_chain|. |
| 42 const GURL& url() const; | 40 const GURL& url() const; |
| 43 | 41 |
| 44 // DownloadItem fields | |
| 45 // The path where we want to save the download file. | |
| 46 FilePath path; | |
| 47 | |
| 48 // The chain of redirects that leading up to and including the final URL. | 42 // The chain of redirects that leading up to and including the final URL. |
| 49 std::vector<GURL> url_chain; | 43 std::vector<GURL> url_chain; |
| 50 | 44 |
| 51 // The URL that referred us. | 45 // The URL that referred us. |
| 52 GURL referrer_url; | 46 GURL referrer_url; |
| 53 | 47 |
| 54 // The time when the download started. | 48 // The time when the download started. |
| 55 base::Time start_time; | 49 base::Time start_time; |
| 56 | 50 |
| 57 // The number of bytes that have been received. | 51 // The number of bytes that have been received. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 86 |
| 93 // For continuing a download, the ETAG of the file. | 87 // For continuing a download, the ETAG of the file. |
| 94 std::string etag; | 88 std::string etag; |
| 95 | 89 |
| 96 // True if we should display the 'save as...' UI and prompt the user | 90 // True if we should display the 'save as...' UI and prompt the user |
| 97 // for the download location. | 91 // for the download location. |
| 98 // False if the UI should be suppressed and the download performed to the | 92 // False if the UI should be suppressed and the download performed to the |
| 99 // default location. | 93 // default location. |
| 100 bool prompt_user_for_save_location; | 94 bool prompt_user_for_save_location; |
| 101 | 95 |
| 102 // The original name for a dangerous download. | |
| 103 FilePath original_name; | |
| 104 | |
| 105 // The charset of the referring page where the download request comes from. | 96 // The charset of the referring page where the download request comes from. |
| 106 // It's used to construct a suggested filename. | 97 // It's used to construct a suggested filename. |
| 107 std::string referrer_charset; | 98 std::string referrer_charset; |
| 108 | 99 |
| 109 // The download file save info. | 100 // The download file save info. |
| 110 DownloadSaveInfo save_info; | 101 DownloadSaveInfo save_info; |
| 111 | 102 |
| 112 // The remote IP address where the download was fetched from. Copied from | 103 // The remote IP address where the download was fetched from. Copied from |
| 113 // UrlRequest::GetSocketAddress(). | 104 // UrlRequest::GetSocketAddress(). |
| 114 std::string remote_address; | 105 std::string remote_address; |
| 115 | 106 |
| 116 // The request's |BoundNetLog|, for "source_dependency" linking with the | 107 // The request's |BoundNetLog|, for "source_dependency" linking with the |
| 117 // download item's. | 108 // download item's. |
| 118 const net::BoundNetLog request_bound_net_log; | 109 const net::BoundNetLog request_bound_net_log; |
| 119 }; | 110 }; |
| 120 | 111 |
| 121 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ | 112 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ |
| OLD | NEW |