| 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 3914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3925 return; | 3925 return; |
| 3926 | 3926 |
| 3927 // Set the first party for cookies url if it has not been set yet (new | 3927 // Set the first party for cookies url if it has not been set yet (new |
| 3928 // requests). This value will be updated during redirects, consistent with | 3928 // requests). This value will be updated during redirects, consistent with |
| 3929 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1 | 3929 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1 |
| 3930 if (request.firstPartyForCookies().isEmpty()) { | 3930 if (request.firstPartyForCookies().isEmpty()) { |
| 3931 if (request.getFrameType() == blink::WebURLRequest::FrameTypeTopLevel) | 3931 if (request.getFrameType() == blink::WebURLRequest::FrameTypeTopLevel) |
| 3932 request.setFirstPartyForCookies(request.url()); | 3932 request.setFirstPartyForCookies(request.url()); |
| 3933 else | 3933 else |
| 3934 request.setFirstPartyForCookies(frame->document().firstPartyForCookies()); | 3934 request.setFirstPartyForCookies(frame->document().firstPartyForCookies()); |
| 3935 } |
| 3935 | 3936 |
| 3936 // If we need to set the first party, then we need to set the request's | 3937 // Set the requestor origin to the same origin as the frame's document if it |
| 3937 // initiator as well; it will not be updated during redirects. | 3938 // hasn't yet been set. |
| 3939 // |
| 3940 // TODO(mkwst): It would be cleaner to adjust blink::ResourceRequest to |
| 3941 // initialize itself with a `nullptr` initiator so that this can be a simple |
| 3942 // `isNull()` check. |
| 3943 if (request.requestorOrigin().isUnique() && |
| 3944 !frame->document().getSecurityOrigin().isUnique()) { |
| 3938 request.setRequestorOrigin(frame->document().getSecurityOrigin()); | 3945 request.setRequestorOrigin(frame->document().getSecurityOrigin()); |
| 3939 } | 3946 } |
| 3940 | 3947 |
| 3941 WebDataSource* provisional_data_source = frame->provisionalDataSource(); | 3948 WebDataSource* provisional_data_source = frame->provisionalDataSource(); |
| 3942 WebDataSource* data_source = | 3949 WebDataSource* data_source = |
| 3943 provisional_data_source ? provisional_data_source : frame->dataSource(); | 3950 provisional_data_source ? provisional_data_source : frame->dataSource(); |
| 3944 | 3951 |
| 3945 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 3952 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
| 3946 DCHECK(document_state); | 3953 DCHECK(document_state); |
| 3947 InternalDocumentStateData* internal_data = | 3954 InternalDocumentStateData* internal_data = |
| (...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5467 common_params.should_replace_current_entry | 5474 common_params.should_replace_current_entry |
| 5468 ? blink::WebFrameLoadType::ReplaceCurrentItem | 5475 ? blink::WebFrameLoadType::ReplaceCurrentItem |
| 5469 : blink::WebFrameLoadType::Standard; | 5476 : blink::WebFrameLoadType::Standard; |
| 5470 blink::WebHistoryLoadType history_load_type = | 5477 blink::WebHistoryLoadType history_load_type = |
| 5471 blink::WebHistoryDifferentDocumentLoad; | 5478 blink::WebHistoryDifferentDocumentLoad; |
| 5472 bool should_load_request = false; | 5479 bool should_load_request = false; |
| 5473 WebHistoryItem item_for_history_navigation; | 5480 WebHistoryItem item_for_history_navigation; |
| 5474 WebURLRequest request = | 5481 WebURLRequest request = |
| 5475 CreateURLRequestForNavigation(common_params, std::move(stream_params), | 5482 CreateURLRequestForNavigation(common_params, std::move(stream_params), |
| 5476 frame_->isViewSourceModeEnabled()); | 5483 frame_->isViewSourceModeEnabled()); |
| 5484 request.setFrameType(IsTopLevelNavigation(frame_) |
| 5485 ? blink::WebURLRequest::FrameTypeTopLevel |
| 5486 : blink::WebURLRequest::FrameTypeNested); |
| 5477 | 5487 |
| 5478 if (IsBrowserSideNavigationEnabled() && common_params.post_data) | 5488 if (IsBrowserSideNavigationEnabled() && common_params.post_data) |
| 5479 request.setHTTPBody(GetWebHTTPBodyForRequestBody(common_params.post_data)); | 5489 request.setHTTPBody(GetWebHTTPBodyForRequestBody(common_params.post_data)); |
| 5480 | 5490 |
| 5481 // Used to determine whether this frame is actually loading a request as part | 5491 // Used to determine whether this frame is actually loading a request as part |
| 5482 // of a history navigation. | 5492 // of a history navigation. |
| 5483 bool has_history_navigation_in_frame = false; | 5493 bool has_history_navigation_in_frame = false; |
| 5484 | 5494 |
| 5485 #if defined(OS_ANDROID) | 5495 #if defined(OS_ANDROID) |
| 5486 request.setHasUserGesture(start_params.has_user_gesture); | 5496 request.setHasUserGesture(start_params.has_user_gesture); |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6276 // event target. Potentially a Pepper plugin will receive the event. | 6286 // event target. Potentially a Pepper plugin will receive the event. |
| 6277 // In order to tell whether a plugin gets the last mouse event and which it | 6287 // In order to tell whether a plugin gets the last mouse event and which it |
| 6278 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6288 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6279 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6289 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6280 // |pepper_last_mouse_event_target_|. | 6290 // |pepper_last_mouse_event_target_|. |
| 6281 pepper_last_mouse_event_target_ = nullptr; | 6291 pepper_last_mouse_event_target_ = nullptr; |
| 6282 #endif | 6292 #endif |
| 6283 } | 6293 } |
| 6284 | 6294 |
| 6285 } // namespace content | 6295 } // namespace content |
| OLD | NEW |