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 3898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3909 | 3909 |
3910 void RenderFrameImpl::saveImageFromDataURL(const blink::WebString& data_url) { | 3910 void RenderFrameImpl::saveImageFromDataURL(const blink::WebString& data_url) { |
3911 // Note: We should basically send GURL but we use size-limited string instead | 3911 // Note: We should basically send GURL but we use size-limited string instead |
3912 // in order to send a larger data url to save a image for <canvas> or <img>. | 3912 // in order to send a larger data url to save a image for <canvas> or <img>. |
3913 if (data_url.length() < kMaxLengthOfDataURLString) { | 3913 if (data_url.length() < kMaxLengthOfDataURLString) { |
3914 Send(new FrameHostMsg_SaveImageFromDataURL( | 3914 Send(new FrameHostMsg_SaveImageFromDataURL( |
3915 render_view_->GetRoutingID(), routing_id_, data_url.utf8())); | 3915 render_view_->GetRoutingID(), routing_id_, data_url.utf8())); |
3916 } | 3916 } |
3917 } | 3917 } |
3918 | 3918 |
3919 void RenderFrameImpl::willSendRequest( | 3919 void RenderFrameImpl::willSendRequest(blink::WebLocalFrame* frame, |
3920 blink::WebLocalFrame* frame, | 3920 blink::WebURLRequest& request) { |
3921 unsigned identifier, | |
3922 blink::WebURLRequest& request, | |
3923 const blink::WebURLResponse& redirect_response) { | |
3924 DCHECK_EQ(frame_, frame); | 3921 DCHECK_EQ(frame_, frame); |
3925 // The request my be empty during tests. | 3922 // The request my be empty during tests. |
3926 if (request.url().isEmpty()) | 3923 if (request.url().isEmpty()) |
3927 return; | 3924 return; |
3928 | 3925 |
3929 // Set the first party for cookies url if it has not been set yet (new | 3926 // Set the first party for cookies url if it has not been set yet (new |
3930 // requests). This value will be updated during redirects, consistent with | 3927 // requests). This value will be updated during redirects, consistent with |
3931 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1 | 3928 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1 |
3932 if (request.firstPartyForCookies().isEmpty()) { | 3929 if (request.firstPartyForCookies().isEmpty()) { |
3933 if (request.getFrameType() == blink::WebURLRequest::FrameTypeTopLevel) | 3930 if (request.getFrameType() == blink::WebURLRequest::FrameTypeTopLevel) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4118 WebString::fromUTF8(i.values())); | 4115 WebString::fromUTF8(i.values())); |
4119 } | 4116 } |
4120 } | 4117 } |
4121 } | 4118 } |
4122 | 4119 |
4123 if (!render_view_->renderer_preferences_.enable_referrers) | 4120 if (!render_view_->renderer_preferences_.enable_referrers) |
4124 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); | 4121 request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); |
4125 } | 4122 } |
4126 | 4123 |
4127 void RenderFrameImpl::didReceiveResponse( | 4124 void RenderFrameImpl::didReceiveResponse( |
4128 unsigned identifier, | |
4129 const blink::WebURLResponse& response) { | 4125 const blink::WebURLResponse& response) { |
4130 // Only do this for responses that correspond to a provisional data source | 4126 // Only do this for responses that correspond to a provisional data source |
4131 // of the top-most frame. If we have a provisional data source, then we | 4127 // of the top-most frame. If we have a provisional data source, then we |
4132 // can't have any sub-resources yet, so we know that this response must | 4128 // can't have any sub-resources yet, so we know that this response must |
4133 // correspond to a frame load. | 4129 // correspond to a frame load. |
4134 if (!frame_->provisionalDataSource() || frame_->parent()) | 4130 if (!frame_->provisionalDataSource() || frame_->parent()) |
4135 return; | 4131 return; |
4136 | 4132 |
4137 // If we are in view source mode, then just let the user see the source of | 4133 // If we are in view source mode, then just let the user see the source of |
4138 // the server's error page. | 4134 // the server's error page. |
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5814 // Note: At this stage, the goal is to apply all the modifications the | 5810 // Note: At this stage, the goal is to apply all the modifications the |
5815 // renderer wants to make to the request, and then send it to the browser, so | 5811 // renderer wants to make to the request, and then send it to the browser, so |
5816 // that the actual network request can be started. Ideally, all such | 5812 // that the actual network request can be started. Ideally, all such |
5817 // modifications should take place in willSendRequest, and in the | 5813 // modifications should take place in willSendRequest, and in the |
5818 // implementation of willSendRequest for the various InspectorAgents | 5814 // implementation of willSendRequest for the various InspectorAgents |
5819 // (devtools). | 5815 // (devtools). |
5820 // | 5816 // |
5821 // TODO(clamy): Apply devtools override. | 5817 // TODO(clamy): Apply devtools override. |
5822 // TODO(clamy): Make sure that navigation requests are not modified somewhere | 5818 // TODO(clamy): Make sure that navigation requests are not modified somewhere |
5823 // else in blink. | 5819 // else in blink. |
5824 willSendRequest(frame_, 0, info.urlRequest, blink::WebURLResponse()); | 5820 willSendRequest(frame_, info.urlRequest); |
5825 | 5821 |
5826 // Update the transition type of the request for client side redirects. | 5822 // Update the transition type of the request for client side redirects. |
5827 if (!info.urlRequest.getExtraData()) | 5823 if (!info.urlRequest.getExtraData()) |
5828 info.urlRequest.setExtraData(new RequestExtraData()); | 5824 info.urlRequest.setExtraData(new RequestExtraData()); |
5829 if (info.isClientRedirect) { | 5825 if (info.isClientRedirect) { |
5830 RequestExtraData* extra_data = | 5826 RequestExtraData* extra_data = |
5831 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); | 5827 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); |
5832 extra_data->set_transition_type(ui::PageTransitionFromInt( | 5828 extra_data->set_transition_type(ui::PageTransitionFromInt( |
5833 extra_data->transition_type() | ui::PAGE_TRANSITION_CLIENT_REDIRECT)); | 5829 extra_data->transition_type() | ui::PAGE_TRANSITION_CLIENT_REDIRECT)); |
5834 } | 5830 } |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6353 // event target. Potentially a Pepper plugin will receive the event. | 6349 // event target. Potentially a Pepper plugin will receive the event. |
6354 // In order to tell whether a plugin gets the last mouse event and which it | 6350 // In order to tell whether a plugin gets the last mouse event and which it |
6355 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6351 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6356 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6352 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6357 // |pepper_last_mouse_event_target_|. | 6353 // |pepper_last_mouse_event_target_|. |
6358 pepper_last_mouse_event_target_ = nullptr; | 6354 pepper_last_mouse_event_target_ = nullptr; |
6359 #endif | 6355 #endif |
6360 } | 6356 } |
6361 | 6357 |
6362 } // namespace content | 6358 } // namespace content |
OLD | NEW |