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 #include "content/browser/download/download_manager_impl.h" | 5 #include "content/browser/download/download_manager_impl.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "content/public/browser/browser_context.h" | 36 #include "content/public/browser/browser_context.h" |
37 #include "content/public/browser/content_browser_client.h" | 37 #include "content/public/browser/content_browser_client.h" |
38 #include "content/public/browser/download_interrupt_reasons.h" | 38 #include "content/public/browser/download_interrupt_reasons.h" |
39 #include "content/public/browser/download_manager_delegate.h" | 39 #include "content/public/browser/download_manager_delegate.h" |
40 #include "content/public/browser/download_url_parameters.h" | 40 #include "content/public/browser/download_url_parameters.h" |
41 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
42 #include "content/public/browser/notification_types.h" | 42 #include "content/public/browser/notification_types.h" |
43 #include "content/public/browser/render_process_host.h" | 43 #include "content/public/browser/render_process_host.h" |
44 #include "content/public/browser/resource_context.h" | 44 #include "content/public/browser/resource_context.h" |
45 #include "content/public/browser/web_contents_delegate.h" | 45 #include "content/public/browser/web_contents_delegate.h" |
| 46 #include "content/public/common/previews_state.h" |
46 #include "content/public/common/referrer.h" | 47 #include "content/public/common/referrer.h" |
47 #include "net/base/elements_upload_data_stream.h" | 48 #include "net/base/elements_upload_data_stream.h" |
48 #include "net/base/load_flags.h" | 49 #include "net/base/load_flags.h" |
49 #include "net/base/request_priority.h" | 50 #include "net/base/request_priority.h" |
50 #include "net/base/upload_bytes_element_reader.h" | 51 #include "net/base/upload_bytes_element_reader.h" |
51 #include "net/log/net_log_source_type.h" | 52 #include "net/log/net_log_source_type.h" |
52 #include "net/log/net_log_with_source.h" | 53 #include "net/log/net_log_with_source.h" |
53 #include "net/url_request/url_request_context.h" | 54 #include "net/url_request/url_request_context.h" |
54 #include "storage/browser/blob/blob_url_request_job_factory.h" | 55 #include "storage/browser/blob/blob_url_request_job_factory.h" |
55 #include "url/origin.h" | 56 #include "url/origin.h" |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 bool do_not_prompt_for_login) { | 541 bool do_not_prompt_for_login) { |
541 if (ResourceDispatcherHostImpl::Get()->is_shutdown()) | 542 if (ResourceDispatcherHostImpl::Get()->is_shutdown()) |
542 return DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN; | 543 return DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN; |
543 | 544 |
544 // The URLRequest needs to be initialized with the referrer and other | 545 // The URLRequest needs to be initialized with the referrer and other |
545 // information prior to issuing it. | 546 // information prior to issuing it. |
546 ResourceDispatcherHostImpl::Get()->InitializeURLRequest( | 547 ResourceDispatcherHostImpl::Get()->InitializeURLRequest( |
547 url_request.get(), referrer, | 548 url_request.get(), referrer, |
548 true, // download. | 549 true, // download. |
549 render_process_id, render_view_route_id, render_frame_route_id, | 550 render_process_id, render_view_route_id, render_frame_route_id, |
550 resource_context); | 551 PREVIEWS_OFF, resource_context); |
551 | 552 |
552 // We treat a download as a main frame load, and thus update the policy URL on | 553 // We treat a download as a main frame load, and thus update the policy URL on |
553 // redirects. | 554 // redirects. |
554 // | 555 // |
555 // TODO(davidben): Is this correct? If this came from a | 556 // TODO(davidben): Is this correct? If this came from a |
556 // ViewHostMsg_DownloadUrl in a frame, should it have first-party URL set | 557 // ViewHostMsg_DownloadUrl in a frame, should it have first-party URL set |
557 // appropriately? | 558 // appropriately? |
558 url_request->set_first_party_url_policy( | 559 url_request->set_first_party_url_policy( |
559 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); | 560 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); |
560 | 561 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 if (delegate_) | 765 if (delegate_) |
765 delegate_->OpenDownload(download); | 766 delegate_->OpenDownload(download); |
766 } | 767 } |
767 | 768 |
768 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 769 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
769 if (delegate_) | 770 if (delegate_) |
770 delegate_->ShowDownloadInShell(download); | 771 delegate_->ShowDownloadInShell(download); |
771 } | 772 } |
772 | 773 |
773 } // namespace content | 774 } // namespace content |
OLD | NEW |