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_ITEM_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
| 12 #include <vector> |
12 | 13 |
13 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
19 #include "content/browser/download/download_destination_observer.h" | 20 #include "content/browser/download/download_destination_observer.h" |
20 #include "content/browser/download/download_net_log_parameters.h" | 21 #include "content/browser/download/download_net_log_parameters.h" |
21 #include "content/browser/download/download_request_handle.h" | 22 #include "content/browser/download/download_request_handle.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 const GURL& site_url, | 55 const GURL& site_url, |
55 const GURL& tab_url, | 56 const GURL& tab_url, |
56 const GURL& tab_referrer_url, | 57 const GURL& tab_referrer_url, |
57 const std::string& suggested_filename, | 58 const std::string& suggested_filename, |
58 const base::FilePath& forced_file_path, | 59 const base::FilePath& forced_file_path, |
59 ui::PageTransition transition_type, | 60 ui::PageTransition transition_type, |
60 bool has_user_gesture, | 61 bool has_user_gesture, |
61 const std::string& remote_address, | 62 const std::string& remote_address, |
62 base::Time start_time); | 63 base::Time start_time); |
63 RequestInfo(); | 64 RequestInfo(); |
64 RequestInfo(const RequestInfo& other); | 65 explicit RequestInfo(const RequestInfo& other); |
65 RequestInfo(const GURL& url); | 66 explicit RequestInfo(const GURL& url); |
66 ~RequestInfo(); | 67 ~RequestInfo(); |
67 | 68 |
68 // The chain of redirects that leading up to and including the final URL. | 69 // The chain of redirects that leading up to and including the final URL. |
69 std::vector<GURL> url_chain; | 70 std::vector<GURL> url_chain; |
70 | 71 |
71 // The URL of the page that initiated the download. | 72 // The URL of the page that initiated the download. |
72 GURL referrer_url; | 73 GURL referrer_url; |
73 | 74 |
74 // Site URL for the site instance that initiated this download. | 75 // Site URL for the site instance that initiated this download. |
75 GURL site_url; | 76 GURL site_url; |
(...skipping 28 matching lines...) Expand all Loading... |
104 | 105 |
105 // Information about the current state of the download destination. | 106 // Information about the current state of the download destination. |
106 struct CONTENT_EXPORT DestinationInfo { | 107 struct CONTENT_EXPORT DestinationInfo { |
107 DestinationInfo(const base::FilePath& target_path, | 108 DestinationInfo(const base::FilePath& target_path, |
108 const base::FilePath& current_path, | 109 const base::FilePath& current_path, |
109 int64_t received_bytes, | 110 int64_t received_bytes, |
110 bool all_data_saved, | 111 bool all_data_saved, |
111 const std::string& hash, | 112 const std::string& hash, |
112 base::Time end_time); | 113 base::Time end_time); |
113 DestinationInfo(); | 114 DestinationInfo(); |
114 DestinationInfo(TargetDisposition target_disposition); | 115 explicit DestinationInfo(TargetDisposition target_disposition); |
115 DestinationInfo(const DestinationInfo& other); | 116 explicit DestinationInfo(const DestinationInfo& other); |
116 ~DestinationInfo(); | 117 ~DestinationInfo(); |
117 | 118 |
118 // Whether the target should be overwritten, uniquified or prompted for. | 119 // Whether the target should be overwritten, uniquified or prompted for. |
119 TargetDisposition target_disposition = TARGET_DISPOSITION_OVERWRITE; | 120 TargetDisposition target_disposition = TARGET_DISPOSITION_OVERWRITE; |
120 | 121 |
121 // Target path of an in-progress download. We may be downloading to a | 122 // Target path of an in-progress download. We may be downloading to a |
122 // temporary or intermediate file (specified by |current_path|). Once the | 123 // temporary or intermediate file (specified by |current_path|). Once the |
123 // download completes, we will rename the file to |target_path|. | 124 // download completes, we will rename the file to |target_path|. |
124 base::FilePath target_path; | 125 base::FilePath target_path; |
125 | 126 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 bool CanShowInFolder() override; | 272 bool CanShowInFolder() override; |
272 bool CanOpenDownload() override; | 273 bool CanOpenDownload() override; |
273 bool ShouldOpenFileBasedOnExtension() override; | 274 bool ShouldOpenFileBasedOnExtension() override; |
274 bool GetOpenWhenComplete() const override; | 275 bool GetOpenWhenComplete() const override; |
275 bool GetAutoOpened() override; | 276 bool GetAutoOpened() override; |
276 bool GetOpened() const override; | 277 bool GetOpened() const override; |
277 base::Time GetLastAccessTime() const override; | 278 base::Time GetLastAccessTime() const override; |
278 bool IsTransient() const override; | 279 bool IsTransient() const override; |
279 BrowserContext* GetBrowserContext() const override; | 280 BrowserContext* GetBrowserContext() const override; |
280 WebContents* GetWebContents() const override; | 281 WebContents* GetWebContents() const override; |
281 void OnContentCheckCompleted(DownloadDangerType danger_type) override; | 282 void OnContentCheckCompleted(DownloadDangerType danger_type, |
| 283 DownloadInterruptReason reason) override; |
282 void SetOpenWhenComplete(bool open) override; | 284 void SetOpenWhenComplete(bool open) override; |
283 void SetOpened(bool opened) override; | 285 void SetOpened(bool opened) override; |
284 void SetLastAccessTime(base::Time last_access_time) override; | 286 void SetLastAccessTime(base::Time last_access_time) override; |
285 void SetDisplayName(const base::FilePath& name) override; | 287 void SetDisplayName(const base::FilePath& name) override; |
286 std::string DebugString(bool verbose) const override; | 288 std::string DebugString(bool verbose) const override; |
287 | 289 |
288 // All remaining public interfaces virtual to allow for DownloadItemImpl | 290 // All remaining public interfaces virtual to allow for DownloadItemImpl |
289 // mocks. | 291 // mocks. |
290 | 292 |
291 // Determines the resume mode for an interrupted download. Requires | 293 // Determines the resume mode for an interrupted download. Requires |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 int64_t received_bytes_at_length_mismatch = -1; | 751 int64_t received_bytes_at_length_mismatch = -1; |
750 | 752 |
751 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 753 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
752 | 754 |
753 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 755 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
754 }; | 756 }; |
755 | 757 |
756 } // namespace content | 758 } // namespace content |
757 | 759 |
758 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 760 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
OLD | NEW |