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