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 4850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4861 const CommonNavigationParams& common_params, | 4861 const CommonNavigationParams& common_params, |
4862 const RequestNavigationParams& request_params) { | 4862 const RequestNavigationParams& request_params) { |
4863 CHECK(IsBrowserSideNavigationEnabled()); | 4863 CHECK(IsBrowserSideNavigationEnabled()); |
4864 // This will override the url requested by the WebURLLoader, as well as | 4864 // This will override the url requested by the WebURLLoader, as well as |
4865 // provide it with the response to the request. | 4865 // provide it with the response to the request. |
4866 std::unique_ptr<StreamOverrideParameters> stream_override( | 4866 std::unique_ptr<StreamOverrideParameters> stream_override( |
4867 new StreamOverrideParameters()); | 4867 new StreamOverrideParameters()); |
4868 stream_override->stream_url = stream_url; | 4868 stream_override->stream_url = stream_url; |
4869 stream_override->response = response; | 4869 stream_override->response = response; |
4870 | 4870 |
| 4871 // If the request was initiated in the context of a user gesture then make |
| 4872 // sure that the navigation also executes in the context of a user gesture. |
| 4873 std::unique_ptr<blink::WebScopedUserGesture> gesture( |
| 4874 request_params.has_user_gesture ? new blink::WebScopedUserGesture |
| 4875 : nullptr); |
| 4876 |
4871 NavigateInternal(common_params, StartNavigationParams(), request_params, | 4877 NavigateInternal(common_params, StartNavigationParams(), request_params, |
4872 std::move(stream_override)); | 4878 std::move(stream_override)); |
4873 } | 4879 } |
4874 | 4880 |
4875 // PlzNavigate | 4881 // PlzNavigate |
4876 void RenderFrameImpl::OnFailedNavigation( | 4882 void RenderFrameImpl::OnFailedNavigation( |
4877 const CommonNavigationParams& common_params, | 4883 const CommonNavigationParams& common_params, |
4878 const RequestNavigationParams& request_params, | 4884 const RequestNavigationParams& request_params, |
4879 bool has_stale_copy_in_cache, | 4885 bool has_stale_copy_in_cache, |
4880 int error_code) { | 4886 int error_code) { |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5516 : blink::WebURLRequest::FrameTypeNested); | 5522 : blink::WebURLRequest::FrameTypeNested); |
5517 | 5523 |
5518 if (IsBrowserSideNavigationEnabled() && common_params.post_data) | 5524 if (IsBrowserSideNavigationEnabled() && common_params.post_data) |
5519 request.setHTTPBody(GetWebHTTPBodyForRequestBody(common_params.post_data)); | 5525 request.setHTTPBody(GetWebHTTPBodyForRequestBody(common_params.post_data)); |
5520 | 5526 |
5521 // Used to determine whether this frame is actually loading a request as part | 5527 // Used to determine whether this frame is actually loading a request as part |
5522 // of a history navigation. | 5528 // of a history navigation. |
5523 bool has_history_navigation_in_frame = false; | 5529 bool has_history_navigation_in_frame = false; |
5524 | 5530 |
5525 #if defined(OS_ANDROID) | 5531 #if defined(OS_ANDROID) |
5526 request.setHasUserGesture(start_params.has_user_gesture); | 5532 request.setHasUserGesture(request_params.has_user_gesture); |
5527 #endif | 5533 #endif |
5528 | 5534 |
5529 // PlzNavigate: Make sure that Blink's loader will not try to use browser side | 5535 // PlzNavigate: Make sure that Blink's loader will not try to use browser side |
5530 // navigation for this request (since it already went to the browser). | 5536 // navigation for this request (since it already went to the browser). |
5531 if (browser_side_navigation) | 5537 if (browser_side_navigation) |
5532 request.setCheckForBrowserSideNavigation(false); | 5538 request.setCheckForBrowserSideNavigation(false); |
5533 | 5539 |
5534 // If we are reloading, then use the history state of the current frame. | 5540 // If we are reloading, then use the history state of the current frame. |
5535 // Otherwise, if we have history state, then we need to navigate to it, which | 5541 // Otherwise, if we have history state, then we need to navigate to it, which |
5536 // corresponds to a back/forward navigation event. Update the parameters | 5542 // corresponds to a back/forward navigation event. Update the parameters |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6410 // event target. Potentially a Pepper plugin will receive the event. | 6416 // event target. Potentially a Pepper plugin will receive the event. |
6411 // In order to tell whether a plugin gets the last mouse event and which it | 6417 // In order to tell whether a plugin gets the last mouse event and which it |
6412 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6418 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6413 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6419 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6414 // |pepper_last_mouse_event_target_|. | 6420 // |pepper_last_mouse_event_target_|. |
6415 pepper_last_mouse_event_target_ = nullptr; | 6421 pepper_last_mouse_event_target_ = nullptr; |
6416 #endif | 6422 #endif |
6417 } | 6423 } |
6418 | 6424 |
6419 } // namespace content | 6425 } // namespace content |
OLD | NEW |