| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ | |
| 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/file_path.h" | |
| 14 #include "base/time.h" | |
| 15 #include "chrome/browser/download/download_file.h" | |
| 16 #include "chrome/browser/download/download_request_handle.h" | |
| 17 #include "googleurl/src/gurl.h" | |
| 18 | |
| 19 // Used for informing the download manager of a new download, since we don't | |
| 20 // want to pass |DownloadItem|s between threads. | |
| 21 struct DownloadCreateInfo { | |
| 22 DownloadCreateInfo(const FilePath& path, | |
| 23 const GURL& url, | |
| 24 const base::Time& start_time, | |
| 25 int64 received_bytes, | |
| 26 int64 total_bytes, | |
| 27 int32 state, | |
| 28 int32 download_id, | |
| 29 bool has_user_gesture); | |
| 30 DownloadCreateInfo(); | |
| 31 ~DownloadCreateInfo(); | |
| 32 | |
| 33 std::string DebugString() const; | |
| 34 | |
| 35 // The URL from which we are downloading. This is the final URL after any | |
| 36 // redirection by the server for |url_chain|. | |
| 37 const GURL& url() const; | |
| 38 | |
| 39 // DownloadItem fields | |
| 40 // The path where we want to save the download file. | |
| 41 FilePath path; | |
| 42 | |
| 43 // The chain of redirects that leading up to and including the final URL. | |
| 44 std::vector<GURL> url_chain; | |
| 45 | |
| 46 // The URL that referred us. | |
| 47 GURL referrer_url; | |
| 48 | |
| 49 // A number that should be added to the suggested path to make it unique. | |
| 50 // 0 means no number should be appended. Not actually stored in the db. | |
| 51 int path_uniquifier; | |
| 52 | |
| 53 // The time when the download started. | |
| 54 base::Time start_time; | |
| 55 | |
| 56 // The number of bytes that have been received. | |
| 57 int64 received_bytes; | |
| 58 | |
| 59 // The total download size. | |
| 60 int64 total_bytes; | |
| 61 | |
| 62 // The current state of the download. | |
| 63 int32 state; | |
| 64 | |
| 65 // The (per-session) ID of the download. | |
| 66 int32 download_id; | |
| 67 | |
| 68 // True if the download was initiated by user action. | |
| 69 bool has_user_gesture; | |
| 70 | |
| 71 // The handle to the download request information. Used for operations | |
| 72 // outside the download system. | |
| 73 DownloadRequestHandle request_handle; | |
| 74 | |
| 75 // The handle of the download in the history database. | |
| 76 int64 db_handle; | |
| 77 | |
| 78 // The content-disposition string from the response header. | |
| 79 std::string content_disposition; | |
| 80 | |
| 81 // The mime type string from the response header (may be overridden). | |
| 82 std::string mime_type; | |
| 83 | |
| 84 // The value of the content type header sent with the downloaded item. It | |
| 85 // may be different from |mime_type|, which may be set based on heuristics | |
| 86 // which may look at the file extension and first few bytes of the file. | |
| 87 std::string original_mime_type; | |
| 88 | |
| 89 // True if we should display the 'save as...' UI and prompt the user | |
| 90 // for the download location. | |
| 91 // False if the UI should be supressed and the download performed to the | |
| 92 // default location. | |
| 93 bool prompt_user_for_save_location; | |
| 94 | |
| 95 // The original name for a dangerous download. | |
| 96 FilePath original_name; | |
| 97 | |
| 98 // Whether this download is for extension install or not. | |
| 99 bool is_extension_install; | |
| 100 | |
| 101 // The charset of the referring page where the download request comes from. | |
| 102 // It's used to construct a suggested filename. | |
| 103 std::string referrer_charset; | |
| 104 | |
| 105 // The download file save info. | |
| 106 DownloadSaveInfo save_info; | |
| 107 }; | |
| 108 | |
| 109 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_ | |
| OLD | NEW |