OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 common_params.referrer.policy, | 562 common_params.referrer.policy, |
563 common_params.url, | 563 common_params.url, |
564 WebString::fromUTF8(common_params.referrer.url.spec())); | 564 WebString::fromUTF8(common_params.referrer.url.spec())); |
565 if (!web_referrer.isEmpty()) { | 565 if (!web_referrer.isEmpty()) { |
566 request.setHTTPReferrer(web_referrer, common_params.referrer.policy); | 566 request.setHTTPReferrer(web_referrer, common_params.referrer.policy); |
567 request.addHTTPOriginIfNeeded( | 567 request.addHTTPOriginIfNeeded( |
568 WebSecurityOrigin(url::Origin(common_params.referrer.url))); | 568 WebSecurityOrigin(url::Origin(common_params.referrer.url))); |
569 } | 569 } |
570 } | 570 } |
571 | 571 |
572 request.setLoFiState( | 572 request.setPreviewsState( |
573 static_cast<WebURLRequest::LoFiState>(common_params.lofi_state)); | 573 static_cast<WebURLRequest::PreviewsState>(common_params.previews_state)); |
574 | 574 |
575 RequestExtraData* extra_data = new RequestExtraData(); | 575 RequestExtraData* extra_data = new RequestExtraData(); |
576 extra_data->set_stream_override(std::move(stream_override)); | 576 extra_data->set_stream_override(std::move(stream_override)); |
577 request.setExtraData(extra_data); | 577 request.setExtraData(extra_data); |
578 | 578 |
579 // Set the ui timestamp for this navigation. Currently the timestamp here is | 579 // Set the ui timestamp for this navigation. Currently the timestamp here is |
580 // only non empty when the navigation was triggered by an Android intent. The | 580 // only non empty when the navigation was triggered by an Android intent. The |
581 // timestamp is converted to a double version supported by blink. It will be | 581 // timestamp is converted to a double version supported by blink. It will be |
582 // passed back to the browser in the DidCommitProvisionalLoad and the | 582 // passed back to the browser in the DidCommitProvisionalLoad and the |
583 // DocumentLoadComplete IPCs. | 583 // DocumentLoadComplete IPCs. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 ? FrameMsg_Navigate_Type::RELOAD | 642 ? FrameMsg_Navigate_Type::RELOAD |
643 : FrameMsg_Navigate_Type::NORMAL; | 643 : FrameMsg_Navigate_Type::NORMAL; |
644 | 644 |
645 const RequestExtraData* extra_data = | 645 const RequestExtraData* extra_data = |
646 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); | 646 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); |
647 DCHECK(extra_data); | 647 DCHECK(extra_data); |
648 return CommonNavigationParams( | 648 return CommonNavigationParams( |
649 info.urlRequest.url(), referrer, extra_data->transition_type(), | 649 info.urlRequest.url(), referrer, extra_data->transition_type(), |
650 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp, | 650 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp, |
651 report_type, GURL(), GURL(), | 651 report_type, GURL(), GURL(), |
652 static_cast<LoFiState>(info.urlRequest.getLoFiState()), | 652 static_cast<PreviewsState>(info.urlRequest.getPreviewsState()), |
653 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(), | 653 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(), |
654 GetRequestBodyForWebURLRequest(info.urlRequest)); | 654 GetRequestBodyForWebURLRequest(info.urlRequest)); |
655 } | 655 } |
656 | 656 |
657 media::Context3D GetSharedMainThreadContext3D( | 657 media::Context3D GetSharedMainThreadContext3D( |
658 scoped_refptr<ContextProviderCommandBuffer> provider) { | 658 scoped_refptr<ContextProviderCommandBuffer> provider) { |
659 if (!provider) | 659 if (!provider) |
660 return media::Context3D(); | 660 return media::Context3D(); |
661 return media::Context3D(provider->ContextGL(), provider->GrContext()); | 661 return media::Context3D(provider->ContextGL(), provider->GrContext()); |
662 } | 662 } |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 #endif | 1105 #endif |
1106 media_surface_manager_(nullptr), | 1106 media_surface_manager_(nullptr), |
1107 devtools_agent_(nullptr), | 1107 devtools_agent_(nullptr), |
1108 push_messaging_dispatcher_(NULL), | 1108 push_messaging_dispatcher_(NULL), |
1109 presentation_dispatcher_(NULL), | 1109 presentation_dispatcher_(NULL), |
1110 screen_orientation_dispatcher_(NULL), | 1110 screen_orientation_dispatcher_(NULL), |
1111 manifest_manager_(NULL), | 1111 manifest_manager_(NULL), |
1112 accessibility_mode_(AccessibilityModeOff), | 1112 accessibility_mode_(AccessibilityModeOff), |
1113 render_accessibility_(NULL), | 1113 render_accessibility_(NULL), |
1114 media_player_delegate_(NULL), | 1114 media_player_delegate_(NULL), |
1115 is_using_lofi_(false), | 1115 previews_state_(PREVIEWS_UNSPECIFIED), |
1116 effective_connection_type_( | 1116 effective_connection_type_( |
1117 blink::WebEffectiveConnectionType::TypeUnknown), | 1117 blink::WebEffectiveConnectionType::TypeUnknown), |
1118 is_pasting_(false), | 1118 is_pasting_(false), |
1119 suppress_further_dialogs_(false), | 1119 suppress_further_dialogs_(false), |
1120 blame_context_(nullptr), | 1120 blame_context_(nullptr), |
1121 #if BUILDFLAG(ENABLE_PLUGINS) | 1121 #if BUILDFLAG(ENABLE_PLUGINS) |
1122 focused_pepper_plugin_(nullptr), | 1122 focused_pepper_plugin_(nullptr), |
1123 pepper_last_mouse_event_target_(nullptr), | 1123 pepper_last_mouse_event_target_(nullptr), |
1124 #endif | 1124 #endif |
1125 frame_binding_(this), | 1125 frame_binding_(this), |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 | 1221 |
1222 frame_ = web_frame; | 1222 frame_ = web_frame; |
1223 } | 1223 } |
1224 | 1224 |
1225 void RenderFrameImpl::Initialize() { | 1225 void RenderFrameImpl::Initialize() { |
1226 is_main_frame_ = !frame_->parent(); | 1226 is_main_frame_ = !frame_->parent(); |
1227 | 1227 |
1228 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( | 1228 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( |
1229 frame_->parent()); | 1229 frame_->parent()); |
1230 if (parent_frame) { | 1230 if (parent_frame) { |
1231 is_using_lofi_ = parent_frame->IsUsingLoFi(); | 1231 previews_state_ = parent_frame->GetPreviewsState(); |
1232 effective_connection_type_ = parent_frame->getEffectiveConnectionType(); | 1232 effective_connection_type_ = parent_frame->getEffectiveConnectionType(); |
1233 } | 1233 } |
1234 | 1234 |
1235 bool is_tracing_rail = false; | 1235 bool is_tracing_rail = false; |
1236 bool is_tracing_navigation = false; | 1236 bool is_tracing_navigation = false; |
1237 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing_navigation); | 1237 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing_navigation); |
1238 TRACE_EVENT_CATEGORY_GROUP_ENABLED("rail", &is_tracing_rail); | 1238 TRACE_EVENT_CATEGORY_GROUP_ENABLED("rail", &is_tracing_rail); |
1239 if (is_tracing_rail || is_tracing_navigation) { | 1239 if (is_tracing_rail || is_tracing_navigation) { |
1240 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); | 1240 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); |
1241 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::Initialize", | 1241 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::Initialize", |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 channels); | 2241 channels); |
2242 frame_->dispatchMessageEventWithOriginCheck(target_origin, msg_event); | 2242 frame_->dispatchMessageEventWithOriginCheck(target_origin, msg_event); |
2243 } | 2243 } |
2244 | 2244 |
2245 void RenderFrameImpl::OnReload(bool bypass_cache) { | 2245 void RenderFrameImpl::OnReload(bool bypass_cache) { |
2246 frame_->reload(bypass_cache ? WebFrameLoadType::ReloadBypassingCache | 2246 frame_->reload(bypass_cache ? WebFrameLoadType::ReloadBypassingCache |
2247 : WebFrameLoadType::ReloadMainResource); | 2247 : WebFrameLoadType::ReloadMainResource); |
2248 } | 2248 } |
2249 | 2249 |
2250 void RenderFrameImpl::OnReloadLoFiImages() { | 2250 void RenderFrameImpl::OnReloadLoFiImages() { |
2251 is_using_lofi_ = false; | 2251 previews_state_ = PREVIEWS_OFF; |
2252 GetWebFrame()->reloadLoFiImages(); | 2252 GetWebFrame()->reloadLoFiImages(); |
2253 } | 2253 } |
2254 | 2254 |
2255 void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) { | 2255 void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) { |
2256 blink::WebSurroundingText surroundingText; | 2256 blink::WebSurroundingText surroundingText; |
2257 surroundingText.initializeFromCurrentSelection(frame_, max_length); | 2257 surroundingText.initializeFromCurrentSelection(frame_, max_length); |
2258 | 2258 |
2259 if (surroundingText.isNull()) { | 2259 if (surroundingText.isNull()) { |
2260 // |surroundingText| might not be correctly initialized, for example if | 2260 // |surroundingText| might not be correctly initialized, for example if |
2261 // |frame_->selectionRange().isNull()|, in other words, if there was no | 2261 // |frame_->selectionRange().isNull()|, in other words, if there was no |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2632 break; | 2632 break; |
2633 case CONSOLE_MESSAGE_LEVEL_ERROR: | 2633 case CONSOLE_MESSAGE_LEVEL_ERROR: |
2634 target_level = blink::WebConsoleMessage::LevelError; | 2634 target_level = blink::WebConsoleMessage::LevelError; |
2635 break; | 2635 break; |
2636 } | 2636 } |
2637 | 2637 |
2638 blink::WebConsoleMessage wcm(target_level, WebString::fromUTF8(message)); | 2638 blink::WebConsoleMessage wcm(target_level, WebString::fromUTF8(message)); |
2639 frame_->addMessageToConsole(wcm); | 2639 frame_->addMessageToConsole(wcm); |
2640 } | 2640 } |
2641 | 2641 |
2642 bool RenderFrameImpl::IsUsingLoFi() const { | 2642 PreviewsState RenderFrameImpl::GetPreviewsState() const { |
2643 return is_using_lofi_; | 2643 return previews_state_; |
2644 } | 2644 } |
2645 | 2645 |
2646 bool RenderFrameImpl::IsPasting() const { | 2646 bool RenderFrameImpl::IsPasting() const { |
2647 return is_pasting_; | 2647 return is_pasting_; |
2648 } | 2648 } |
2649 | 2649 |
2650 // mojom::Frame implementation ------------------------------------------------- | 2650 // mojom::Frame implementation ------------------------------------------------- |
2651 | 2651 |
2652 void RenderFrameImpl::GetInterfaceProvider( | 2652 void RenderFrameImpl::GetInterfaceProvider( |
2653 service_manager::mojom::InterfaceProviderRequest request) { | 2653 service_manager::mojom::InterfaceProviderRequest request) { |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3520 } | 3520 } |
3521 committed_first_load_ = true; | 3521 committed_first_load_ = true; |
3522 } | 3522 } |
3523 | 3523 |
3524 DocumentState* document_state = | 3524 DocumentState* document_state = |
3525 DocumentState::FromDataSource(frame->dataSource()); | 3525 DocumentState::FromDataSource(frame->dataSource()); |
3526 NavigationStateImpl* navigation_state = | 3526 NavigationStateImpl* navigation_state = |
3527 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 3527 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
3528 WebURLResponseExtraDataImpl* extra_data = | 3528 WebURLResponseExtraDataImpl* extra_data = |
3529 GetExtraDataFromResponse(frame->dataSource()->response()); | 3529 GetExtraDataFromResponse(frame->dataSource()->response()); |
3530 // Only update the Lo-Fi and effective connection type states for new main | 3530 // Only update the PreviewsState and effective connection type states for new |
3531 // frame documents. Subframes inherit from the main frame and should not | 3531 // main frame documents. Subframes inherit from the main frame and should not |
3532 // change at commit time. | 3532 // change at commit time. |
3533 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { | 3533 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { |
3534 is_using_lofi_ = extra_data && extra_data->is_using_lofi(); | 3534 previews_state_ = |
| 3535 extra_data ? extra_data->previews_state() : PREVIEWS_OFF; |
3535 if (extra_data) { | 3536 if (extra_data) { |
3536 effective_connection_type_ = | 3537 effective_connection_type_ = |
3537 EffectiveConnectionTypeToWebEffectiveConnectionType( | 3538 EffectiveConnectionTypeToWebEffectiveConnectionType( |
3538 extra_data->effective_connection_type()); | 3539 extra_data->effective_connection_type()); |
3539 } | 3540 } |
3540 } | 3541 } |
3541 | 3542 |
3542 if (proxy_routing_id_ != MSG_ROUTING_NONE) { | 3543 if (proxy_routing_id_ != MSG_ROUTING_NONE) { |
3543 RenderFrameProxy* proxy = | 3544 RenderFrameProxy* proxy = |
3544 RenderFrameProxy::FromRoutingID(proxy_routing_id_); | 3545 RenderFrameProxy::FromRoutingID(proxy_routing_id_); |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 request.getFrameType() != WebURLRequest::FrameTypeNone; | 4260 request.getFrameType() != WebURLRequest::FrameTypeNone; |
4260 if (is_navigational_request) { | 4261 if (is_navigational_request) { |
4261 extra_data->set_transferred_request_child_id( | 4262 extra_data->set_transferred_request_child_id( |
4262 navigation_state->start_params().transferred_request_child_id); | 4263 navigation_state->start_params().transferred_request_child_id); |
4263 extra_data->set_transferred_request_request_id( | 4264 extra_data->set_transferred_request_request_id( |
4264 navigation_state->start_params().transferred_request_request_id); | 4265 navigation_state->start_params().transferred_request_request_id); |
4265 } | 4266 } |
4266 | 4267 |
4267 request.setExtraData(extra_data); | 4268 request.setExtraData(extra_data); |
4268 | 4269 |
4269 if (request.getLoFiState() == WebURLRequest::LoFiUnspecified) { | 4270 if (request.getPreviewsState() == WebURLRequest::PreviewsUnspecified) { |
4270 if (is_main_frame_ && !navigation_state->request_committed()) { | 4271 if (is_main_frame_ && !navigation_state->request_committed()) { |
4271 request.setLoFiState(static_cast<WebURLRequest::LoFiState>( | 4272 request.setPreviewsState(static_cast<WebURLRequest::PreviewsState>( |
4272 navigation_state->common_params().lofi_state)); | 4273 navigation_state->common_params().previews_state)); |
4273 } else { | 4274 } else { |
4274 request.setLoFiState( | 4275 request.setPreviewsState( |
4275 is_using_lofi_ ? WebURLRequest::LoFiOn : WebURLRequest::LoFiOff); | 4276 previews_state_ == PREVIEWS_UNSPECIFIED |
| 4277 ? WebURLRequest::PreviewsOff |
| 4278 : static_cast<WebURLRequest::PreviewsState>(previews_state_)); |
4276 } | 4279 } |
4277 } | 4280 } |
4278 | 4281 |
4279 // This is an instance where we embed a copy of the routing id | 4282 // This is an instance where we embed a copy of the routing id |
4280 // into the data portion of the message. This can cause problems if we | 4283 // into the data portion of the message. This can cause problems if we |
4281 // don't register this id on the browser side, since the download manager | 4284 // don't register this id on the browser side, since the download manager |
4282 // expects to find a RenderViewHost based off the id. | 4285 // expects to find a RenderViewHost based off the id. |
4283 request.setRequestorID(render_view_->GetRoutingID()); | 4286 request.setRequestorID(render_view_->GetRoutingID()); |
4284 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); | 4287 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); |
4285 | 4288 |
(...skipping 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6676 // event target. Potentially a Pepper plugin will receive the event. | 6679 // event target. Potentially a Pepper plugin will receive the event. |
6677 // In order to tell whether a plugin gets the last mouse event and which it | 6680 // In order to tell whether a plugin gets the last mouse event and which it |
6678 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6681 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6679 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6682 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6680 // |pepper_last_mouse_event_target_|. | 6683 // |pepper_last_mouse_event_target_|. |
6681 pepper_last_mouse_event_target_ = nullptr; | 6684 pepper_last_mouse_event_target_ = nullptr; |
6682 #endif | 6685 #endif |
6683 } | 6686 } |
6684 | 6687 |
6685 } // namespace content | 6688 } // namespace content |
OLD | NEW |