OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/loader/navigation_url_loader_impl_core.h" | 5 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/frame_host/navigation_request_info.h" | 10 #include "content/browser/frame_host/navigation_request_info.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 *request_info, this); | 51 *request_info, this); |
52 } | 52 } |
53 | 53 |
54 void NavigationURLLoaderImplCore::FollowRedirect() { | 54 void NavigationURLLoaderImplCore::FollowRedirect() { |
55 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 55 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
56 | 56 |
57 if (resource_handler_) | 57 if (resource_handler_) |
58 resource_handler_->FollowRedirect(); | 58 resource_handler_->FollowRedirect(); |
59 } | 59 } |
60 | 60 |
61 | |
62 void NavigationURLLoaderImplCore::NotifyRequestRedirected( | 61 void NavigationURLLoaderImplCore::NotifyRequestRedirected( |
63 const net::RedirectInfo& redirect_info, | 62 const net::RedirectInfo& redirect_info, |
64 ResourceResponse* response) { | 63 ResourceResponse* response, |
| 64 bool is_external_protocol) { |
65 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 65 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
66 | 66 |
67 // Make a copy of the ResourceResponse before it is passed to another thread. | 67 // Make a copy of the ResourceResponse before it is passed to another thread. |
68 // | 68 // |
69 // TODO(davidben): This copy could be avoided if ResourceResponse weren't | 69 // TODO(davidben): This copy could be avoided if ResourceResponse weren't |
70 // reference counted and the loader stack passed unique ownership of the | 70 // reference counted and the loader stack passed unique ownership of the |
71 // response. https://crbug.com/416050 | 71 // response. https://crbug.com/416050 |
72 BrowserThread::PostTask( | 72 BrowserThread::PostTask( |
73 BrowserThread::UI, FROM_HERE, | 73 BrowserThread::UI, FROM_HERE, |
74 base::Bind(&NavigationURLLoaderImpl::NotifyRequestRedirected, loader_, | 74 base::Bind(&NavigationURLLoaderImpl::NotifyRequestRedirected, loader_, |
75 redirect_info, response->DeepCopy())); | 75 redirect_info, response->DeepCopy(), is_external_protocol)); |
76 } | 76 } |
77 | 77 |
78 void NavigationURLLoaderImplCore::NotifyResponseStarted( | 78 void NavigationURLLoaderImplCore::NotifyResponseStarted( |
79 ResourceResponse* response, | 79 ResourceResponse* response, |
80 scoped_ptr<StreamHandle> body) { | 80 scoped_ptr<StreamHandle> body) { |
81 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 81 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
82 | 82 |
83 // If, by the time the task reaches the UI thread, |loader_| has already been | 83 // If, by the time the task reaches the UI thread, |loader_| has already been |
84 // destroyed, NotifyResponseStarted will not run. |body| will be destructed | 84 // destroyed, NotifyResponseStarted will not run. |body| will be destructed |
85 // and the request released at that point. | 85 // and the request released at that point. |
(...skipping 13 matching lines...) Expand all Loading... |
99 int net_error) { | 99 int net_error) { |
100 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 100 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
101 | 101 |
102 BrowserThread::PostTask( | 102 BrowserThread::PostTask( |
103 BrowserThread::UI, FROM_HERE, | 103 BrowserThread::UI, FROM_HERE, |
104 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_, | 104 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_, |
105 in_cache, net_error)); | 105 in_cache, net_error)); |
106 } | 106 } |
107 | 107 |
108 } // namespace content | 108 } // namespace content |
OLD | NEW |