| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "net/base/ssl_cert_request_info.h" | 55 #include "net/base/ssl_cert_request_info.h" |
| 56 #include "net/url_request/url_request.h" | 56 #include "net/url_request/url_request.h" |
| 57 #include "net/url_request/url_request_context.h" | 57 #include "net/url_request/url_request_context.h" |
| 58 #include "webkit/appcache/appcache_interceptor.h" | 58 #include "webkit/appcache/appcache_interceptor.h" |
| 59 #include "webkit/appcache/appcache_interfaces.h" | 59 #include "webkit/appcache/appcache_interfaces.h" |
| 60 | 60 |
| 61 // TODO(port): Move these includes to the above section when porting is done. | 61 // TODO(port): Move these includes to the above section when porting is done. |
| 62 #if defined(OS_POSIX) | 62 #if defined(OS_POSIX) |
| 63 #include "chrome/common/temp_scaffolding_stubs.h" | 63 #include "chrome/common/temp_scaffolding_stubs.h" |
| 64 #elif defined(OS_WIN) | 64 #elif defined(OS_WIN) |
| 65 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | |
| 66 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 65 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 67 #endif | 66 #endif |
| 68 | 67 |
| 69 | 68 |
| 70 // Uncomment to enable logging of request traffic. | 69 // Uncomment to enable logging of request traffic. |
| 71 // #define LOG_RESOURCE_DISPATCHER_REQUESTS | 70 // #define LOG_RESOURCE_DISPATCHER_REQUESTS |
| 72 | 71 |
| 73 #ifdef LOG_RESOURCE_DISPATCHER_REQUESTS | 72 #ifdef LOG_RESOURCE_DISPATCHER_REQUESTS |
| 74 # define RESOURCE_LOG(stuff) LOG(INFO) << stuff | 73 # define RESOURCE_LOG(stuff) LOG(INFO) << stuff |
| 75 #else | 74 #else |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 return; | 649 return; |
| 651 | 650 |
| 652 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); | 651 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); |
| 653 info->set_waiting_for_upload_progress_ack(false); | 652 info->set_waiting_for_upload_progress_ack(false); |
| 654 } | 653 } |
| 655 | 654 |
| 656 void ResourceDispatcherHost::OnCancelRequest(int request_id) { | 655 void ResourceDispatcherHost::OnCancelRequest(int request_id) { |
| 657 CancelRequest(receiver_->id(), request_id, true, true); | 656 CancelRequest(receiver_->id(), request_id, true, true); |
| 658 } | 657 } |
| 659 | 658 |
| 660 void ResourceDispatcherHost::OnFollowRedirect(int request_id) { | 659 void ResourceDispatcherHost::OnFollowRedirect( |
| 661 FollowDeferredRedirect(receiver_->id(), request_id); | 660 int request_id, |
| 661 const GURL& new_first_party_for_cookies) { |
| 662 FollowDeferredRedirect(receiver_->id(), request_id, |
| 663 new_first_party_for_cookies); |
| 662 } | 664 } |
| 663 | 665 |
| 664 void ResourceDispatcherHost::OnClosePageACK( | 666 void ResourceDispatcherHost::OnClosePageACK( |
| 665 const ViewMsg_ClosePage_Params& params) { | 667 const ViewMsg_ClosePage_Params& params) { |
| 666 if (params.for_cross_site_transition) { | 668 if (params.for_cross_site_transition) { |
| 667 // Closes for cross-site transitions are handled such that the cross-site | 669 // Closes for cross-site transitions are handled such that the cross-site |
| 668 // transition continues. | 670 // transition continues. |
| 669 GlobalRequestID global_id(params.new_render_process_host_id, | 671 GlobalRequestID global_id(params.new_render_process_host_id, |
| 670 params.new_request_id); | 672 params.new_request_id); |
| 671 PendingRequestList::iterator i = pending_requests_.find(global_id); | 673 PendingRequestList::iterator i = pending_requests_.find(global_id); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 | 824 |
| 823 BeginRequestInternal(request); | 825 BeginRequestInternal(request); |
| 824 } | 826 } |
| 825 | 827 |
| 826 void ResourceDispatcherHost::CancelRequest(int child_id, | 828 void ResourceDispatcherHost::CancelRequest(int child_id, |
| 827 int request_id, | 829 int request_id, |
| 828 bool from_renderer) { | 830 bool from_renderer) { |
| 829 CancelRequest(child_id, request_id, from_renderer, true); | 831 CancelRequest(child_id, request_id, from_renderer, true); |
| 830 } | 832 } |
| 831 | 833 |
| 832 void ResourceDispatcherHost::FollowDeferredRedirect(int child_id, | 834 void ResourceDispatcherHost::FollowDeferredRedirect( |
| 833 int request_id) { | 835 int child_id, |
| 836 int request_id, |
| 837 const GURL& new_first_party_for_cookies) { |
| 834 PendingRequestList::iterator i = pending_requests_.find( | 838 PendingRequestList::iterator i = pending_requests_.find( |
| 835 GlobalRequestID(child_id, request_id)); | 839 GlobalRequestID(child_id, request_id)); |
| 836 if (i == pending_requests_.end()) { | 840 if (i == pending_requests_.end()) { |
| 837 DLOG(WARNING) << "FollowDeferredRedirect for invalid request"; | 841 DLOG(WARNING) << "FollowDeferredRedirect for invalid request"; |
| 838 return; | 842 return; |
| 839 } | 843 } |
| 840 | 844 |
| 845 if (!new_first_party_for_cookies.is_empty()) |
| 846 i->second->set_first_party_for_cookies(new_first_party_for_cookies); |
| 841 i->second->FollowDeferredRedirect(); | 847 i->second->FollowDeferredRedirect(); |
| 842 } | 848 } |
| 843 | 849 |
| 844 bool ResourceDispatcherHost::WillSendData(int child_id, | 850 bool ResourceDispatcherHost::WillSendData(int child_id, |
| 845 int request_id) { | 851 int request_id) { |
| 846 PendingRequestList::iterator i = pending_requests_.find( | 852 PendingRequestList::iterator i = pending_requests_.find( |
| 847 GlobalRequestID(child_id, request_id)); | 853 GlobalRequestID(child_id, request_id)); |
| 848 if (i == pending_requests_.end()) { | 854 if (i == pending_requests_.end()) { |
| 849 NOTREACHED() << "WillSendData for invalid request"; | 855 NOTREACHED() << "WillSendData for invalid request"; |
| 850 return false; | 856 return false; |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 case ViewHostMsg_UploadProgress_ACK::ID: | 1815 case ViewHostMsg_UploadProgress_ACK::ID: |
| 1810 case ViewHostMsg_SyncLoad::ID: | 1816 case ViewHostMsg_SyncLoad::ID: |
| 1811 return true; | 1817 return true; |
| 1812 | 1818 |
| 1813 default: | 1819 default: |
| 1814 break; | 1820 break; |
| 1815 } | 1821 } |
| 1816 | 1822 |
| 1817 return false; | 1823 return false; |
| 1818 } | 1824 } |
| OLD | NEW |