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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 int64_t ExtractPostId(const WebHistoryItem& item) { | 319 int64_t ExtractPostId(const WebHistoryItem& item) { |
320 if (item.isNull() || item.httpBody().isNull()) | 320 if (item.isNull() || item.httpBody().isNull()) |
321 return -1; | 321 return -1; |
322 | 322 |
323 return item.httpBody().identifier(); | 323 return item.httpBody().identifier(); |
324 } | 324 } |
325 | 325 |
326 WebURLResponseExtraDataImpl* GetExtraDataFromResponse( | 326 WebURLResponseExtraDataImpl* GetExtraDataFromResponse( |
327 const WebURLResponse& response) { | 327 const WebURLResponse& response) { |
328 return static_cast<WebURLResponseExtraDataImpl*>(response.extraData()); | 328 return static_cast<WebURLResponseExtraDataImpl*>(response.getExtraData()); |
329 } | 329 } |
330 | 330 |
331 void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 331 void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
332 // Replace any occurrences of swappedout:// with about:blank. | 332 // Replace any occurrences of swappedout:// with about:blank. |
333 const WebURL& blank_url = GURL(url::kAboutBlankURL); | 333 const WebURL& blank_url = GURL(url::kAboutBlankURL); |
334 WebVector<WebURL> urls; | 334 WebVector<WebURL> urls; |
335 ds->redirectChain(urls); | 335 ds->redirectChain(urls); |
336 result->reserve(urls.size()); | 336 result->reserve(urls.size()); |
337 for (size_t i = 0; i < urls.size(); ++i) { | 337 for (size_t i = 0; i < urls.size(); ++i) { |
338 if (urls[i] != GURL(kSwappedOutURL)) | 338 if (urls[i] != GURL(kSwappedOutURL)) |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 // version supported by blink. It will be passed back to the renderer in the | 592 // version supported by blink. It will be passed back to the renderer in the |
593 // CommitNavigation IPC, and then back to the browser again in the | 593 // CommitNavigation IPC, and then back to the browser again in the |
594 // DidCommitProvisionalLoad and the DocumentLoadComplete IPCs. | 594 // DidCommitProvisionalLoad and the DocumentLoadComplete IPCs. |
595 base::TimeTicks ui_timestamp = | 595 base::TimeTicks ui_timestamp = |
596 base::TimeTicks() + base::TimeDelta::FromSecondsD(request->uiStartTime()); | 596 base::TimeTicks() + base::TimeDelta::FromSecondsD(request->uiStartTime()); |
597 FrameMsg_UILoadMetricsReportType::Value report_type = | 597 FrameMsg_UILoadMetricsReportType::Value report_type = |
598 static_cast<FrameMsg_UILoadMetricsReportType::Value>( | 598 static_cast<FrameMsg_UILoadMetricsReportType::Value>( |
599 request->inputPerfMetricReportPolicy()); | 599 request->inputPerfMetricReportPolicy()); |
600 | 600 |
601 const RequestExtraData* extra_data = | 601 const RequestExtraData* extra_data = |
602 static_cast<RequestExtraData*>(request->extraData()); | 602 static_cast<RequestExtraData*>(request->getExtraData()); |
603 DCHECK(extra_data); | 603 DCHECK(extra_data); |
604 return CommonNavigationParams( | 604 return CommonNavigationParams( |
605 request->url(), referrer, extra_data->transition_type(), | 605 request->url(), referrer, extra_data->transition_type(), |
606 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry, | 606 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry, |
607 ui_timestamp, report_type, GURL(), GURL(), extra_data->lofi_state(), | 607 ui_timestamp, report_type, GURL(), GURL(), extra_data->lofi_state(), |
608 base::TimeTicks::Now(), request->httpMethod().latin1()); | 608 base::TimeTicks::Now(), request->httpMethod().latin1()); |
609 } | 609 } |
610 | 610 |
611 media::Context3D GetSharedMainThreadContext3D() { | 611 media::Context3D GetSharedMainThreadContext3D() { |
612 cc::ContextProvider* provider = | 612 cc::ContextProvider* provider = |
(...skipping 3140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3753 | 3753 |
3754 // The request's extra data may indicate that we should set a custom user | 3754 // The request's extra data may indicate that we should set a custom user |
3755 // agent. This needs to be done here, after WebKit is through with setting the | 3755 // agent. This needs to be done here, after WebKit is through with setting the |
3756 // user agent on its own. Similarly, it may indicate that we should set an | 3756 // user agent on its own. Similarly, it may indicate that we should set an |
3757 // X-Requested-With header. This must be done here to avoid breaking CORS | 3757 // X-Requested-With header. This must be done here to avoid breaking CORS |
3758 // checks. | 3758 // checks. |
3759 // PlzNavigate: there may also be a stream url associated with the request. | 3759 // PlzNavigate: there may also be a stream url associated with the request. |
3760 WebString custom_user_agent; | 3760 WebString custom_user_agent; |
3761 WebString requested_with; | 3761 WebString requested_with; |
3762 scoped_ptr<StreamOverrideParameters> stream_override; | 3762 scoped_ptr<StreamOverrideParameters> stream_override; |
3763 if (request.extraData()) { | 3763 if (request.getExtraData()) { |
3764 RequestExtraData* old_extra_data = | 3764 RequestExtraData* old_extra_data = |
3765 static_cast<RequestExtraData*>(request.extraData()); | 3765 static_cast<RequestExtraData*>(request.getExtraData()); |
3766 | 3766 |
3767 custom_user_agent = old_extra_data->custom_user_agent(); | 3767 custom_user_agent = old_extra_data->custom_user_agent(); |
3768 if (!custom_user_agent.isNull()) { | 3768 if (!custom_user_agent.isNull()) { |
3769 if (custom_user_agent.isEmpty()) | 3769 if (custom_user_agent.isEmpty()) |
3770 request.clearHTTPHeaderField("User-Agent"); | 3770 request.clearHTTPHeaderField("User-Agent"); |
3771 else | 3771 else |
3772 request.setHTTPHeaderField("User-Agent", custom_user_agent); | 3772 request.setHTTPHeaderField("User-Agent", custom_user_agent); |
3773 } | 3773 } |
3774 | 3774 |
3775 requested_with = old_extra_data->requested_with(); | 3775 requested_with = old_extra_data->requested_with(); |
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5728 // modifications should take place in willSendRequest, and in the | 5728 // modifications should take place in willSendRequest, and in the |
5729 // implementation of willSendRequest for the various InspectorAgents | 5729 // implementation of willSendRequest for the various InspectorAgents |
5730 // (devtools). | 5730 // (devtools). |
5731 // | 5731 // |
5732 // TODO(clamy): Apply devtools override. | 5732 // TODO(clamy): Apply devtools override. |
5733 // TODO(clamy): Make sure that navigation requests are not modified somewhere | 5733 // TODO(clamy): Make sure that navigation requests are not modified somewhere |
5734 // else in blink. | 5734 // else in blink. |
5735 willSendRequest(frame_, 0, *request, blink::WebURLResponse()); | 5735 willSendRequest(frame_, 0, *request, blink::WebURLResponse()); |
5736 | 5736 |
5737 // Update the transition type of the request for client side redirects. | 5737 // Update the transition type of the request for client side redirects. |
5738 if (!request->extraData()) | 5738 if (!request->getExtraData()) |
5739 request->setExtraData(new RequestExtraData()); | 5739 request->setExtraData(new RequestExtraData()); |
5740 if (is_client_redirect) { | 5740 if (is_client_redirect) { |
5741 RequestExtraData* extra_data = | 5741 RequestExtraData* extra_data = |
5742 static_cast<RequestExtraData*>(request->extraData()); | 5742 static_cast<RequestExtraData*>(request->getExtraData()); |
5743 extra_data->set_transition_type(ui::PageTransitionFromInt( | 5743 extra_data->set_transition_type(ui::PageTransitionFromInt( |
5744 extra_data->transition_type() | ui::PAGE_TRANSITION_CLIENT_REDIRECT)); | 5744 extra_data->transition_type() | ui::PAGE_TRANSITION_CLIENT_REDIRECT)); |
5745 } | 5745 } |
5746 | 5746 |
5747 // TODO(clamy): Same-document navigations should not be sent back to the | 5747 // TODO(clamy): Same-document navigations should not be sent back to the |
5748 // browser. | 5748 // browser. |
5749 // TODO(clamy): Data urls should not be sent back to the browser either. | 5749 // TODO(clamy): Data urls should not be sent back to the browser either. |
5750 // These values are assumed on the browser side for navigations. These checks | 5750 // These values are assumed on the browser side for navigations. These checks |
5751 // ensure the renderer has the correct values. | 5751 // ensure the renderer has the correct values. |
5752 DCHECK_EQ(FETCH_REQUEST_MODE_NAVIGATE, | 5752 DCHECK_EQ(FETCH_REQUEST_MODE_NAVIGATE, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6132 int match_count, | 6132 int match_count, |
6133 int ordinal, | 6133 int ordinal, |
6134 const WebRect& selection_rect, | 6134 const WebRect& selection_rect, |
6135 bool final_status_update) { | 6135 bool final_status_update) { |
6136 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6136 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6137 selection_rect, ordinal, | 6137 selection_rect, ordinal, |
6138 final_status_update)); | 6138 final_status_update)); |
6139 } | 6139 } |
6140 | 6140 |
6141 } // namespace content | 6141 } // namespace content |
OLD | NEW |