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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 bool swapped_out, | 504 bool swapped_out, |
505 int32 next_page_id, | 505 int32 next_page_id, |
506 const WebKit::WebScreenInfo& screen_info, | 506 const WebKit::WebScreenInfo& screen_info, |
507 content::GuestToEmbedderChannel* guest_to_embedder_channel, | 507 content::GuestToEmbedderChannel* guest_to_embedder_channel, |
508 AccessibilityMode accessibility_mode) | 508 AccessibilityMode accessibility_mode) |
509 : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out), | 509 : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out), |
510 webkit_preferences_(webkit_prefs), | 510 webkit_preferences_(webkit_prefs), |
511 send_content_state_immediately_(false), | 511 send_content_state_immediately_(false), |
512 enabled_bindings_(0), | 512 enabled_bindings_(0), |
513 send_preferred_size_changes_(false), | 513 send_preferred_size_changes_(false), |
514 is_overriding_user_agent_(false), | |
514 is_loading_(false), | 515 is_loading_(false), |
515 navigation_gesture_(NavigationGestureUnknown), | 516 navigation_gesture_(NavigationGestureUnknown), |
516 opened_by_user_gesture_(true), | 517 opened_by_user_gesture_(true), |
517 opener_suppressed_(false), | 518 opener_suppressed_(false), |
518 page_id_(-1), | 519 page_id_(-1), |
519 last_page_id_sent_to_browser_(-1), | 520 last_page_id_sent_to_browser_(-1), |
520 next_page_id_(next_page_id), | 521 next_page_id_(next_page_id), |
521 history_list_offset_(-1), | 522 history_list_offset_(-1), |
522 history_list_length_(0), | 523 history_list_length_(0), |
523 target_url_status_(TARGET_NONE), | 524 target_url_status_(TARGET_NONE), |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1009 return; | 1010 return; |
1010 | 1011 |
1011 // Swap this renderer back in if necessary. | 1012 // Swap this renderer back in if necessary. |
1012 if (is_swapped_out_) { | 1013 if (is_swapped_out_) { |
1013 // We marked the view as hidden when swapping the view out, so be sure to | 1014 // We marked the view as hidden when swapping the view out, so be sure to |
1014 // reset the visibility state before navigating to the new URL. | 1015 // reset the visibility state before navigating to the new URL. |
1015 webview()->setVisibilityState(visibilityState(), false); | 1016 webview()->setVisibilityState(visibilityState(), false); |
1016 SetSwappedOut(false); | 1017 SetSwappedOut(false); |
1017 } | 1018 } |
1018 | 1019 |
1020 // Track whether we're using the user agent string override. | |
1021 is_overriding_user_agent_ = params.is_overriding_user_agent; | |
1022 | |
1019 history_list_offset_ = params.current_history_list_offset; | 1023 history_list_offset_ = params.current_history_list_offset; |
1020 history_list_length_ = params.current_history_list_length; | 1024 history_list_length_ = params.current_history_list_length; |
1021 if (history_list_length_ >= 0) | 1025 if (history_list_length_ >= 0) |
1022 history_page_ids_.resize(history_list_length_, -1); | 1026 history_page_ids_.resize(history_list_length_, -1); |
1023 if (params.pending_history_list_offset >= 0 && | 1027 if (params.pending_history_list_offset >= 0 && |
1024 params.pending_history_list_offset < history_list_length_) | 1028 params.pending_history_list_offset < history_list_length_) |
1025 history_page_ids_[params.pending_history_list_offset] = params.page_id; | 1029 history_page_ids_[params.pending_history_list_offset] = params.page_id; |
1026 | 1030 |
1027 content::GetContentClient()->SetActiveURL(params.url); | 1031 content::GetContentClient()->SetActiveURL(params.url); |
1028 | 1032 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1441 original_request.httpHeaderField(WebString::fromUTF8("Referer"))), | 1445 original_request.httpHeaderField(WebString::fromUTF8("Referer"))), |
1442 GetReferrerPolicyFromRequest(frame, original_request)); | 1446 GetReferrerPolicyFromRequest(frame, original_request)); |
1443 } | 1447 } |
1444 | 1448 |
1445 string16 method = request.httpMethod(); | 1449 string16 method = request.httpMethod(); |
1446 if (EqualsASCII(method, "POST")) { | 1450 if (EqualsASCII(method, "POST")) { |
1447 params.is_post = true; | 1451 params.is_post = true; |
1448 params.post_id = ExtractPostId(item); | 1452 params.post_id = ExtractPostId(item); |
1449 } | 1453 } |
1450 | 1454 |
1455 // Send the user agent override back. | |
1456 params.is_overriding_user_agent = is_overriding_user_agent_; | |
1457 | |
1451 // Save some histogram data so we can compute the average memory used per | 1458 // Save some histogram data so we can compute the average memory used per |
1452 // page load of the glyphs. | 1459 // page load of the glyphs. |
1453 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", | 1460 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", |
1454 webkit_glue::GetGlyphPageCount()); | 1461 webkit_glue::GetGlyphPageCount()); |
1455 | 1462 |
1456 // This message needs to be sent before any of allowScripts(), | 1463 // This message needs to be sent before any of allowScripts(), |
1457 // allowImages(), allowPlugins() is called for the new page, so that when | 1464 // allowImages(), allowPlugins() is called for the new page, so that when |
1458 // these functions send a ViewHostMsg_ContentBlocked message, it arrives | 1465 // these functions send a ViewHostMsg_ContentBlocked message, it arrives |
1459 // after the ViewHostMsg_FrameNavigate message. | 1466 // after the ViewHostMsg_FrameNavigate message. |
1460 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); | 1467 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); |
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3692 | 3699 |
3693 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); | 3700 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); |
3694 return true; | 3701 return true; |
3695 } | 3702 } |
3696 | 3703 |
3697 void RenderViewImpl::willOpenSocketStream( | 3704 void RenderViewImpl::willOpenSocketStream( |
3698 WebSocketStreamHandle* handle) { | 3705 WebSocketStreamHandle* handle) { |
3699 SocketStreamHandleData::AddToHandle(handle, routing_id_); | 3706 SocketStreamHandleData::AddToHandle(handle, routing_id_); |
3700 } | 3707 } |
3701 | 3708 |
3709 WebKit::WebString RenderViewImpl::userAgentOverride(const WebKit::WebURL& url) { | |
darin (slow to review)
2012/06/15 04:09:22
nit: please list methods in the .cc file in the sa
gone
2012/06/15 21:22:36
Oddly, willCheckAndDispatchMessageEvent() is in th
| |
3710 if (!is_overriding_user_agent_ || | |
3711 renderer_preferences_.user_agent_override.empty()) | |
3712 return WebKit::WebString(); | |
3713 | |
3714 return WebString::fromUTF8(renderer_preferences_.user_agent_override); | |
3715 } | |
3716 | |
3702 // WebKit::WebPageSerializerClient implementation ------------------------------ | 3717 // WebKit::WebPageSerializerClient implementation ------------------------------ |
3703 | 3718 |
3704 void RenderViewImpl::didSerializeDataForFrame( | 3719 void RenderViewImpl::didSerializeDataForFrame( |
3705 const WebURL& frame_url, | 3720 const WebURL& frame_url, |
3706 const WebCString& data, | 3721 const WebCString& data, |
3707 WebPageSerializerClient::PageSerializationStatus status) { | 3722 WebPageSerializerClient::PageSerializationStatus status) { |
3708 Send(new ViewHostMsg_SendSerializedHtmlData( | 3723 Send(new ViewHostMsg_SendSerializedHtmlData( |
3709 routing_id(), | 3724 routing_id(), |
3710 frame_url, | 3725 frame_url, |
3711 data.data(), | 3726 data.data(), |
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5627 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5642 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5628 return !!RenderThreadImpl::current()->compositor_thread(); | 5643 return !!RenderThreadImpl::current()->compositor_thread(); |
5629 } | 5644 } |
5630 | 5645 |
5631 void RenderViewImpl::OnJavaBridgeInit() { | 5646 void RenderViewImpl::OnJavaBridgeInit() { |
5632 DCHECK(!java_bridge_dispatcher_); | 5647 DCHECK(!java_bridge_dispatcher_); |
5633 #if defined(ENABLE_JAVA_BRIDGE) | 5648 #if defined(ENABLE_JAVA_BRIDGE) |
5634 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5649 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
5635 #endif | 5650 #endif |
5636 } | 5651 } |
OLD | NEW |