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 // 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 "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // No security info needed, connection not established. | 164 // No security info needed, connection not established. |
165 request_complete_data.completion_time = base::TimeTicks(); | 165 request_complete_data.completion_time = base::TimeTicks(); |
166 request_complete_data.encoded_data_length = 0; | 166 request_complete_data.encoded_data_length = 0; |
167 filter->Send(new ResourceMsg_RequestComplete( | 167 filter->Send(new ResourceMsg_RequestComplete( |
168 request_id, request_complete_data)); | 168 request_id, request_complete_data)); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 void SetReferrerForRequest(net::URLRequest* request, const Referrer& referrer) { | 172 void SetReferrerForRequest(net::URLRequest* request, const Referrer& referrer) { |
173 if (!referrer.url.is_valid() || | 173 if (!referrer.url.is_valid() || |
174 CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoReferrers)) { | 174 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 175 switches::kNoReferrers)) { |
175 request->SetReferrer(std::string()); | 176 request->SetReferrer(std::string()); |
176 } else { | 177 } else { |
177 request->SetReferrer(referrer.url.spec()); | 178 request->SetReferrer(referrer.url.spec()); |
178 } | 179 } |
179 | 180 |
180 net::URLRequest::ReferrerPolicy net_referrer_policy = | 181 net::URLRequest::ReferrerPolicy net_referrer_policy = |
181 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE; | 182 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE; |
182 switch (referrer.policy) { | 183 switch (referrer.policy) { |
183 case blink::WebReferrerPolicyDefault: | 184 case blink::WebReferrerPolicyDefault: |
184 net_referrer_policy = | 185 net_referrer_policy = |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 handler.Pass())); | 1154 handler.Pass())); |
1154 } | 1155 } |
1155 | 1156 |
1156 // Install a CrossSiteResourceHandler for all main frame requests. This will | 1157 // Install a CrossSiteResourceHandler for all main frame requests. This will |
1157 // let us check whether a transfer is required and pause for the unload | 1158 // let us check whether a transfer is required and pause for the unload |
1158 // handler either if so or if a cross-process navigation is already under way. | 1159 // handler either if so or if a cross-process navigation is already under way. |
1159 bool is_swappable_navigation = | 1160 bool is_swappable_navigation = |
1160 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; | 1161 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; |
1161 // If we are using --site-per-process, install it for subframes as well. | 1162 // If we are using --site-per-process, install it for subframes as well. |
1162 if (!is_swappable_navigation && | 1163 if (!is_swappable_navigation && |
1163 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) { | 1164 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1165 switches::kSitePerProcess)) { |
1164 is_swappable_navigation = | 1166 is_swappable_navigation = |
1165 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; | 1167 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; |
1166 } | 1168 } |
1167 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) | 1169 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) |
1168 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); | 1170 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); |
1169 | 1171 |
1170 // Insert a buffered event handler before the actual one. | 1172 // Insert a buffered event handler before the actual one. |
1171 handler.reset( | 1173 handler.reset( |
1172 new BufferedResourceHandler(handler.Pass(), this, request)); | 1174 new BufferedResourceHandler(handler.Pass(), this, request)); |
1173 | 1175 |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 | 1980 |
1979 // Add a flag to selectively bypass the data reduction proxy if the resource | 1981 // Add a flag to selectively bypass the data reduction proxy if the resource |
1980 // type is not an image. | 1982 // type is not an image. |
1981 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 1983 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
1982 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 1984 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
1983 | 1985 |
1984 return load_flags; | 1986 return load_flags; |
1985 } | 1987 } |
1986 | 1988 |
1987 } // namespace content | 1989 } // namespace content |
OLD | NEW |