| 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 3912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3923 | 3923 |
| 3924 void RenderFrameImpl::saveImageFromDataURL(const blink::WebString& data_url) { | 3924 void RenderFrameImpl::saveImageFromDataURL(const blink::WebString& data_url) { |
| 3925 // Note: We should basically send GURL but we use size-limited string instead | 3925 // Note: We should basically send GURL but we use size-limited string instead |
| 3926 // in order to send a larger data url to save a image for <canvas> or <img>. | 3926 // in order to send a larger data url to save a image for <canvas> or <img>. |
| 3927 if (data_url.length() < kMaxLengthOfDataURLString) { | 3927 if (data_url.length() < kMaxLengthOfDataURLString) { |
| 3928 Send(new FrameHostMsg_SaveImageFromDataURL( | 3928 Send(new FrameHostMsg_SaveImageFromDataURL( |
| 3929 render_view_->GetRoutingID(), routing_id_, data_url.utf8())); | 3929 render_view_->GetRoutingID(), routing_id_, data_url.utf8())); |
| 3930 } | 3930 } |
| 3931 } | 3931 } |
| 3932 | 3932 |
| 3933 void RenderFrameImpl::willSendRequest( | 3933 void RenderFrameImpl::willSendRequest(blink::WebLocalFrame* frame, |
| 3934 blink::WebLocalFrame* frame, | 3934 blink::WebURLRequest& request) { |
| 3935 unsigned identifier, | |
| 3936 blink::WebURLRequest& request, | |
| 3937 const blink::WebURLResponse& redirect_response) { | |
| 3938 DCHECK_EQ(frame_, frame); | 3935 DCHECK_EQ(frame_, frame); |
| 3939 // The request my be empty during tests. | 3936 // The request my be empty during tests. |
| 3940 if (request.url().isEmpty()) | 3937 if (request.url().isEmpty()) |
| 3941 return; | 3938 return; |
| 3942 | 3939 |
| 3943 // Set the first party for cookies url if it has not been set yet (new | 3940 // Set the first party for cookies url if it has not been set yet (new |
| 3944 // requests). This value will be updated during redirects, consistent with | 3941 // requests). This value will be updated during redirects, consistent with |
| 3945 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1 | 3942 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1 |
| 3946 if (request.firstPartyForCookies().isEmpty()) { | 3943 if (request.firstPartyForCookies().isEmpty()) { |
| 3947 if (request.getFrameType() == blink::WebURLRequest::FrameTypeTopLevel) | 3944 if (request.getFrameType() == blink::WebURLRequest::FrameTypeTopLevel) |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4132 WebString::fromUTF8(i.values())); | 4129 WebString::fromUTF8(i.values())); |
| 4133 } | 4130 } |
| 4134 } | 4131 } |
| 4135 } | 4132 } |
| 4136 | 4133 |
| 4137 if (!render_view_->renderer_preferences_.enable_referrers) | 4134 if (!render_view_->renderer_preferences_.enable_referrers) |
| 4138 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); | 4135 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); |
| 4139 } | 4136 } |
| 4140 | 4137 |
| 4141 void RenderFrameImpl::didReceiveResponse( | 4138 void RenderFrameImpl::didReceiveResponse( |
| 4142 unsigned identifier, | |
| 4143 const blink::WebURLResponse& response) { | 4139 const blink::WebURLResponse& response) { |
| 4144 // Only do this for responses that correspond to a provisional data source | 4140 // Only do this for responses that correspond to a provisional data source |
| 4145 // of the top-most frame. If we have a provisional data source, then we | 4141 // of the top-most frame. If we have a provisional data source, then we |
| 4146 // can't have any sub-resources yet, so we know that this response must | 4142 // can't have any sub-resources yet, so we know that this response must |
| 4147 // correspond to a frame load. | 4143 // correspond to a frame load. |
| 4148 if (!frame_->provisionalDataSource() || frame_->parent()) | 4144 if (!frame_->provisionalDataSource() || frame_->parent()) |
| 4149 return; | 4145 return; |
| 4150 | 4146 |
| 4151 // If we are in view source mode, then just let the user see the source of | 4147 // If we are in view source mode, then just let the user see the source of |
| 4152 // the server's error page. | 4148 // the server's error page. |
| (...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5791 // Note: At this stage, the goal is to apply all the modifications the | 5787 // Note: At this stage, the goal is to apply all the modifications the |
| 5792 // renderer wants to make to the request, and then send it to the browser, so | 5788 // renderer wants to make to the request, and then send it to the browser, so |
| 5793 // that the actual network request can be started. Ideally, all such | 5789 // that the actual network request can be started. Ideally, all such |
| 5794 // modifications should take place in willSendRequest, and in the | 5790 // modifications should take place in willSendRequest, and in the |
| 5795 // implementation of willSendRequest for the various InspectorAgents | 5791 // implementation of willSendRequest for the various InspectorAgents |
| 5796 // (devtools). | 5792 // (devtools). |
| 5797 // | 5793 // |
| 5798 // TODO(clamy): Apply devtools override. | 5794 // TODO(clamy): Apply devtools override. |
| 5799 // TODO(clamy): Make sure that navigation requests are not modified somewhere | 5795 // TODO(clamy): Make sure that navigation requests are not modified somewhere |
| 5800 // else in blink. | 5796 // else in blink. |
| 5801 willSendRequest(frame_, 0, info.urlRequest, blink::WebURLResponse()); | 5797 willSendRequest(frame_, info.urlRequest); |
| 5802 | 5798 |
| 5803 // Update the transition type of the request for client side redirects. | 5799 // Update the transition type of the request for client side redirects. |
| 5804 if (!info.urlRequest.getExtraData()) | 5800 if (!info.urlRequest.getExtraData()) |
| 5805 info.urlRequest.setExtraData(new RequestExtraData()); | 5801 info.urlRequest.setExtraData(new RequestExtraData()); |
| 5806 if (info.isClientRedirect) { | 5802 if (info.isClientRedirect) { |
| 5807 RequestExtraData* extra_data = | 5803 RequestExtraData* extra_data = |
| 5808 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); | 5804 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); |
| 5809 extra_data->set_transition_type(ui::PageTransitionFromInt( | 5805 extra_data->set_transition_type(ui::PageTransitionFromInt( |
| 5810 extra_data->transition_type() | ui::PAGE_TRANSITION_CLIENT_REDIRECT)); | 5806 extra_data->transition_type() | ui::PAGE_TRANSITION_CLIENT_REDIRECT)); |
| 5811 } | 5807 } |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6330 // event target. Potentially a Pepper plugin will receive the event. | 6326 // event target. Potentially a Pepper plugin will receive the event. |
| 6331 // In order to tell whether a plugin gets the last mouse event and which it | 6327 // In order to tell whether a plugin gets the last mouse event and which it |
| 6332 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6328 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6333 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6329 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6334 // |pepper_last_mouse_event_target_|. | 6330 // |pepper_last_mouse_event_target_|. |
| 6335 pepper_last_mouse_event_target_ = nullptr; | 6331 pepper_last_mouse_event_target_ = nullptr; |
| 6336 #endif | 6332 #endif |
| 6337 } | 6333 } |
| 6338 | 6334 |
| 6339 } // namespace content | 6335 } // namespace content |
| OLD | NEW |