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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 Delegate(); | 39 Delegate(); |
40 virtual ~Delegate(); | 40 virtual ~Delegate(); |
41 | 41 |
42 // Used for catching use-after-free errors. | 42 // Used for catching use-after-free errors. |
43 void Attach(); | 43 void Attach(); |
44 void Detach(); | 44 void Detach(); |
45 | 45 |
46 // Tests if a file type should be opened automatically. | 46 // Tests if a file type should be opened automatically. |
47 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) = 0; | 47 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) = 0; |
48 | 48 |
| 49 // Allows the delegate to indicate whether the download item should be |
| 50 // dispatched as a web intent. |
| 51 virtual bool ShouldOpenWithWebIntent(DownloadItem* download) = 0; |
| 52 |
49 // Allows the delegate to override the opening of a download. If it returns | 53 // Allows the delegate to override the opening of a download. If it returns |
50 // true then it's reponsible for opening the item. | 54 // true then it's reponsible for opening the item. |
51 virtual bool ShouldOpenDownload(DownloadItem* download) = 0; | 55 virtual bool ShouldOpenDownload(DownloadItem* download) = 0; |
52 | 56 |
53 // Checks whether a downloaded file still exists and updates the | 57 // Checks whether a downloaded file still exists and updates the |
54 // file's state if the file is already removed. | 58 // file's state if the file is already removed. |
55 // The check may or may not result in a later asynchronous call | 59 // The check may or may not result in a later asynchronous call |
56 // to OnDownloadedFileRemoved(). | 60 // to OnDownloadedFileRemoved(). |
57 virtual void CheckForFileRemoval(DownloadItem* download_item) = 0; | 61 virtual void CheckForFileRemoval(DownloadItem* download_item) = 0; |
58 | 62 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 242 |
239 // Called when safety_state_ should be recomputed from is_dangerous_file | 243 // Called when safety_state_ should be recomputed from is_dangerous_file |
240 // and is_dangerous_url. | 244 // and is_dangerous_url. |
241 void UpdateSafetyState(); | 245 void UpdateSafetyState(); |
242 | 246 |
243 // Helper function to recompute |state_info_.target_name| when | 247 // Helper function to recompute |state_info_.target_name| when |
244 // it may have changed. (If it's non-null it should be left alone, | 248 // it may have changed. (If it's non-null it should be left alone, |
245 // otherwise updated from |full_path_|.) | 249 // otherwise updated from |full_path_|.) |
246 void UpdateTarget(); | 250 void UpdateTarget(); |
247 | 251 |
| 252 // Dispatch the content of the downloaded resource as a web intent. This will |
| 253 // trigger a call to the WebContentsDelegate of the initiating context. |
| 254 void DispatchAsWebIntent(); |
| 255 |
248 // State information used by the download manager. | 256 // State information used by the download manager. |
249 DownloadStateInfo state_info_; | 257 DownloadStateInfo state_info_; |
250 | 258 |
251 // Display name for the download if different from the target filename. | 259 // Display name for the download if different from the target filename. |
252 FilePath display_name_; | 260 FilePath display_name_; |
253 | 261 |
254 // The handle to the request information. Used for operations outside the | 262 // The handle to the request information. Used for operations outside the |
255 // download system. | 263 // download system. |
256 scoped_ptr<DownloadRequestHandleInterface> request_handle_; | 264 scoped_ptr<DownloadRequestHandleInterface> request_handle_; |
257 | 265 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 // are owned by the DownloadItemImpl. | 393 // are owned by the DownloadItemImpl. |
386 std::map<const void*, ExternalData*> external_data_map_; | 394 std::map<const void*, ExternalData*> external_data_map_; |
387 | 395 |
388 // Net log to use for this download. | 396 // Net log to use for this download. |
389 const net::BoundNetLog bound_net_log_; | 397 const net::BoundNetLog bound_net_log_; |
390 | 398 |
391 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 399 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
392 }; | 400 }; |
393 | 401 |
394 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 402 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
OLD | NEW |