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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3292 } | 3292 } |
3293 | 3293 |
3294 WebKit::WebReferrerPolicy referrer_policy; | 3294 WebKit::WebReferrerPolicy referrer_policy; |
3295 if (document_state && document_state->is_referrer_policy_set()) { | 3295 if (document_state && document_state->is_referrer_policy_set()) { |
3296 referrer_policy = document_state->referrer_policy(); | 3296 referrer_policy = document_state->referrer_policy(); |
3297 document_state->clear_referrer_policy(); | 3297 document_state->clear_referrer_policy(); |
3298 } else { | 3298 } else { |
3299 referrer_policy = frame->document().referrerPolicy(); | 3299 referrer_policy = frame->document().referrerPolicy(); |
3300 } | 3300 } |
3301 | 3301 |
| 3302 // The request's extra data may indicate that we should set a custom user |
| 3303 // agent. This needs to be done here, after WebKit is through with setting the |
| 3304 // user agent on its own. |
| 3305 WebString custom_user_agent; |
| 3306 if (request.extraData()) { |
| 3307 webkit_glue::WebURLRequestExtraDataImpl* old_extra_data = |
| 3308 static_cast<webkit_glue::WebURLRequestExtraDataImpl*>( |
| 3309 request.extraData()); |
| 3310 custom_user_agent = old_extra_data->custom_user_agent(); |
| 3311 |
| 3312 if (!custom_user_agent.isNull()) { |
| 3313 if (custom_user_agent.isEmpty()) |
| 3314 request.clearHTTPHeaderField("User-Agent"); |
| 3315 else |
| 3316 request.setHTTPHeaderField("User-Agent", custom_user_agent); |
| 3317 } |
| 3318 } |
| 3319 |
3302 request.setExtraData( | 3320 request.setExtraData( |
3303 new RequestExtraData(referrer_policy, | 3321 new RequestExtraData(referrer_policy, |
| 3322 custom_user_agent, |
3304 (frame == top_frame), | 3323 (frame == top_frame), |
3305 frame->identifier(), | 3324 frame->identifier(), |
3306 frame->parent() == top_frame, | 3325 frame->parent() == top_frame, |
3307 frame->parent() ? frame->parent()->identifier() : -1, | 3326 frame->parent() ? frame->parent()->identifier() : -1, |
3308 navigation_state->allow_download(), | 3327 navigation_state->allow_download(), |
3309 transition_type, | 3328 transition_type, |
3310 navigation_state->transferred_request_child_id(), | 3329 navigation_state->transferred_request_child_id(), |
3311 navigation_state->transferred_request_request_id())); | 3330 navigation_state->transferred_request_request_id())); |
3312 | 3331 |
3313 DocumentState* top_document_state = | 3332 DocumentState* top_document_state = |
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5680 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5699 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5681 return !!RenderThreadImpl::current()->compositor_thread(); | 5700 return !!RenderThreadImpl::current()->compositor_thread(); |
5682 } | 5701 } |
5683 | 5702 |
5684 void RenderViewImpl::OnJavaBridgeInit() { | 5703 void RenderViewImpl::OnJavaBridgeInit() { |
5685 DCHECK(!java_bridge_dispatcher_); | 5704 DCHECK(!java_bridge_dispatcher_); |
5686 #if defined(ENABLE_JAVA_BRIDGE) | 5705 #if defined(ENABLE_JAVA_BRIDGE) |
5687 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5706 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
5688 #endif | 5707 #endif |
5689 } | 5708 } |
OLD | NEW |