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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 if (common_params.referrer.url.is_valid()) { | 529 if (common_params.referrer.url.is_valid()) { |
530 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader( | 530 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader( |
531 common_params.referrer.policy, | 531 common_params.referrer.policy, |
532 common_params.url, | 532 common_params.url, |
533 WebString::fromUTF8(common_params.referrer.url.spec())); | 533 WebString::fromUTF8(common_params.referrer.url.spec())); |
534 if (!web_referrer.isEmpty()) | 534 if (!web_referrer.isEmpty()) |
535 request.setHTTPReferrer(web_referrer, common_params.referrer.policy); | 535 request.setHTTPReferrer(web_referrer, common_params.referrer.policy); |
536 } | 536 } |
537 | 537 |
538 request.setHTTPMethod(WebString::fromUTF8(common_params.method)); | 538 request.setHTTPMethod(WebString::fromUTF8(common_params.method)); |
| 539 request.setLoFiState( |
| 540 static_cast<WebURLRequest::LoFiState>(common_params.lofi_state)); |
539 | 541 |
540 RequestExtraData* extra_data = new RequestExtraData(); | 542 RequestExtraData* extra_data = new RequestExtraData(); |
541 extra_data->set_stream_override(std::move(stream_override)); | 543 extra_data->set_stream_override(std::move(stream_override)); |
542 extra_data->set_lofi_state(common_params.lofi_state); | |
543 request.setExtraData(extra_data); | 544 request.setExtraData(extra_data); |
544 | 545 |
545 // Set the ui timestamp for this navigation. Currently the timestamp here is | 546 // Set the ui timestamp for this navigation. Currently the timestamp here is |
546 // only non empty when the navigation was triggered by an Android intent. The | 547 // only non empty when the navigation was triggered by an Android intent. The |
547 // timestamp is converted to a double version supported by blink. It will be | 548 // timestamp is converted to a double version supported by blink. It will be |
548 // passed back to the browser in the DidCommitProvisionalLoad and the | 549 // passed back to the browser in the DidCommitProvisionalLoad and the |
549 // DocumentLoadComplete IPCs. | 550 // DocumentLoadComplete IPCs. |
550 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks(); | 551 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks(); |
551 request.setUiStartTime(ui_timestamp.InSecondsF()); | 552 request.setUiStartTime(ui_timestamp.InSecondsF()); |
552 request.setInputPerfMetricReportPolicy( | 553 request.setInputPerfMetricReportPolicy( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 FrameMsg_Navigate_Type::Value navigation_type = | 610 FrameMsg_Navigate_Type::Value navigation_type = |
610 info.navigationType == blink::WebNavigationTypeReload | 611 info.navigationType == blink::WebNavigationTypeReload |
611 ? FrameMsg_Navigate_Type::RELOAD | 612 ? FrameMsg_Navigate_Type::RELOAD |
612 : FrameMsg_Navigate_Type::NORMAL; | 613 : FrameMsg_Navigate_Type::NORMAL; |
613 | 614 |
614 const RequestExtraData* extra_data = | 615 const RequestExtraData* extra_data = |
615 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); | 616 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); |
616 DCHECK(extra_data); | 617 DCHECK(extra_data); |
617 return CommonNavigationParams( | 618 return CommonNavigationParams( |
618 info.urlRequest.url(), referrer, extra_data->transition_type(), | 619 info.urlRequest.url(), referrer, extra_data->transition_type(), |
619 navigation_type, true, info.replacesCurrentHistoryItem, | 620 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp, |
620 ui_timestamp, report_type, GURL(), GURL(), extra_data->lofi_state(), | 621 report_type, GURL(), GURL(), |
| 622 static_cast<LoFiState>(info.urlRequest.getLoFiState()), |
621 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(), | 623 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(), |
622 GetRequestBodyForWebURLRequest(info.urlRequest)); | 624 GetRequestBodyForWebURLRequest(info.urlRequest)); |
623 } | 625 } |
624 | 626 |
625 media::Context3D GetSharedMainThreadContext3D( | 627 media::Context3D GetSharedMainThreadContext3D( |
626 scoped_refptr<ContextProviderCommandBuffer> provider) { | 628 scoped_refptr<ContextProviderCommandBuffer> provider) { |
627 if (!provider) | 629 if (!provider) |
628 return media::Context3D(); | 630 return media::Context3D(); |
629 return media::Context3D(provider->ContextGL(), provider->GrContext()); | 631 return media::Context3D(provider->ContextGL(), provider->GrContext()); |
630 } | 632 } |
(...skipping 3426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4057 extra_data->set_allow_download( | 4059 extra_data->set_allow_download( |
4058 navigation_state->common_params().allow_download); | 4060 navigation_state->common_params().allow_download); |
4059 extra_data->set_transition_type(transition_type); | 4061 extra_data->set_transition_type(transition_type); |
4060 extra_data->set_should_replace_current_entry(should_replace_current_entry); | 4062 extra_data->set_should_replace_current_entry(should_replace_current_entry); |
4061 extra_data->set_transferred_request_child_id( | 4063 extra_data->set_transferred_request_child_id( |
4062 navigation_state->start_params().transferred_request_child_id); | 4064 navigation_state->start_params().transferred_request_child_id); |
4063 extra_data->set_transferred_request_request_id( | 4065 extra_data->set_transferred_request_request_id( |
4064 navigation_state->start_params().transferred_request_request_id); | 4066 navigation_state->start_params().transferred_request_request_id); |
4065 extra_data->set_service_worker_provider_id(provider_id); | 4067 extra_data->set_service_worker_provider_id(provider_id); |
4066 extra_data->set_stream_override(std::move(stream_override)); | 4068 extra_data->set_stream_override(std::move(stream_override)); |
4067 if (request.getLoFiState() != WebURLRequest::LoFiUnspecified) | |
4068 extra_data->set_lofi_state(static_cast<LoFiState>(request.getLoFiState())); | |
4069 else if (is_main_frame_ && !navigation_state->request_committed()) | |
4070 extra_data->set_lofi_state(navigation_state->common_params().lofi_state); | |
4071 else | |
4072 extra_data->set_lofi_state(is_using_lofi_ ? LOFI_ON : LOFI_OFF); | |
4073 WebString error; | 4069 WebString error; |
4074 extra_data->set_initiated_in_secure_context( | 4070 extra_data->set_initiated_in_secure_context( |
4075 frame->document().isSecureContext(error)); | 4071 frame->document().isSecureContext(error)); |
4076 request.setExtraData(extra_data); | 4072 request.setExtraData(extra_data); |
4077 | 4073 |
| 4074 if (request.getLoFiState() == WebURLRequest::LoFiUnspecified) { |
| 4075 if (is_main_frame_ && !navigation_state->request_committed()) { |
| 4076 request.setLoFiState(static_cast<WebURLRequest::LoFiState>( |
| 4077 navigation_state->common_params().lofi_state)); |
| 4078 } else { |
| 4079 request.setLoFiState( |
| 4080 is_using_lofi_ ? WebURLRequest::LoFiOn : WebURLRequest::LoFiOff); |
| 4081 } |
| 4082 } |
| 4083 |
4078 // TODO(creis): Update prefetching to work with out-of-process iframes. | 4084 // TODO(creis): Update prefetching to work with out-of-process iframes. |
4079 WebFrame* top_frame = frame->top(); | 4085 WebFrame* top_frame = frame->top(); |
4080 if (top_frame && top_frame->isWebLocalFrame()) { | 4086 if (top_frame && top_frame->isWebLocalFrame()) { |
4081 DocumentState* top_document_state = | 4087 DocumentState* top_document_state = |
4082 DocumentState::FromDataSource(top_frame->dataSource()); | 4088 DocumentState::FromDataSource(top_frame->dataSource()); |
4083 if (top_document_state) { | 4089 if (top_document_state) { |
4084 // TODO(gavinp): separate out prefetching and prerender field trials | 4090 // TODO(gavinp): separate out prefetching and prerender field trials |
4085 // if the rel=prerender rel type is sticking around. | 4091 // if the rel=prerender rel type is sticking around. |
4086 if (request.getRequestContext() == WebURLRequest::RequestContextPrefetch) | 4092 if (request.getRequestContext() == WebURLRequest::RequestContextPrefetch) |
4087 top_document_state->set_was_prefetcher(true); | 4093 top_document_state->set_was_prefetcher(true); |
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6329 // event target. Potentially a Pepper plugin will receive the event. | 6335 // event target. Potentially a Pepper plugin will receive the event. |
6330 // In order to tell whether a plugin gets the last mouse event and which it | 6336 // In order to tell whether a plugin gets the last mouse event and which it |
6331 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6337 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6332 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6338 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6333 // |pepper_last_mouse_event_target_|. | 6339 // |pepper_last_mouse_event_target_|. |
6334 pepper_last_mouse_event_target_ = nullptr; | 6340 pepper_last_mouse_event_target_ = nullptr; |
6335 #endif | 6341 #endif |
6336 } | 6342 } |
6337 | 6343 |
6338 } // namespace content | 6344 } // namespace content |
OLD | NEW |