| 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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 | 1039 |
| 1040 // RenderFrameImpl ---------------------------------------------------------- | 1040 // RenderFrameImpl ---------------------------------------------------------- |
| 1041 RenderFrameImpl::RenderFrameImpl(const CreateParams& params) | 1041 RenderFrameImpl::RenderFrameImpl(const CreateParams& params) |
| 1042 : frame_(NULL), | 1042 : frame_(NULL), |
| 1043 is_main_frame_(true), | 1043 is_main_frame_(true), |
| 1044 in_browser_initiated_detach_(false), | 1044 in_browser_initiated_detach_(false), |
| 1045 in_frame_tree_(false), | 1045 in_frame_tree_(false), |
| 1046 render_view_(params.render_view->AsWeakPtr()), | 1046 render_view_(params.render_view->AsWeakPtr()), |
| 1047 routing_id_(params.routing_id), | 1047 routing_id_(params.routing_id), |
| 1048 proxy_routing_id_(MSG_ROUTING_NONE), | 1048 proxy_routing_id_(MSG_ROUTING_NONE), |
| 1049 browser_has_subtree_history_items_(false), |
| 1049 #if defined(ENABLE_PLUGINS) | 1050 #if defined(ENABLE_PLUGINS) |
| 1050 plugin_power_saver_helper_(nullptr), | 1051 plugin_power_saver_helper_(nullptr), |
| 1051 plugin_find_handler_(nullptr), | 1052 plugin_find_handler_(nullptr), |
| 1052 #endif | 1053 #endif |
| 1053 cookie_jar_(this), | 1054 cookie_jar_(this), |
| 1054 selection_text_offset_(0), | 1055 selection_text_offset_(0), |
| 1055 selection_range_(gfx::Range::InvalidRange()), | 1056 selection_range_(gfx::Range::InvalidRange()), |
| 1056 handling_select_range_(false), | 1057 handling_select_range_(false), |
| 1057 notification_permission_dispatcher_(NULL), | 1058 notification_permission_dispatcher_(NULL), |
| 1058 web_user_media_client_(NULL), | 1059 web_user_media_client_(NULL), |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 | 1170 |
| 1170 frame_ = web_frame; | 1171 frame_ = web_frame; |
| 1171 } | 1172 } |
| 1172 | 1173 |
| 1173 void RenderFrameImpl::Initialize() { | 1174 void RenderFrameImpl::Initialize() { |
| 1174 is_main_frame_ = !frame_->parent(); | 1175 is_main_frame_ = !frame_->parent(); |
| 1175 | 1176 |
| 1176 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( | 1177 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( |
| 1177 frame_->parent()); | 1178 frame_->parent()); |
| 1178 if (parent_frame) { | 1179 if (parent_frame) { |
| 1180 // Inherit knowledge of whether we need to consult the browser process for |
| 1181 // a history item on the first navigation. This is inherited by further |
| 1182 // subframes and cleared at didStopLoading. |
| 1183 browser_has_subtree_history_items_ = |
| 1184 parent_frame->browser_has_subtree_history_items_; |
| 1179 is_using_lofi_ = parent_frame->IsUsingLoFi(); | 1185 is_using_lofi_ = parent_frame->IsUsingLoFi(); |
| 1180 effective_connection_type_ = parent_frame->getEffectiveConnectionType(); | 1186 effective_connection_type_ = parent_frame->getEffectiveConnectionType(); |
| 1181 } | 1187 } |
| 1182 | 1188 |
| 1183 bool is_tracing_rail = false; | 1189 bool is_tracing_rail = false; |
| 1184 bool is_tracing_navigation = false; | 1190 bool is_tracing_navigation = false; |
| 1185 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing_navigation); | 1191 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing_navigation); |
| 1186 TRACE_EVENT_CATEGORY_GROUP_ENABLED("rail", &is_tracing_rail); | 1192 TRACE_EVENT_CATEGORY_GROUP_ENABLED("rail", &is_tracing_rail); |
| 1187 if (is_tracing_rail || is_tracing_navigation) { | 1193 if (is_tracing_rail || is_tracing_navigation) { |
| 1188 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); | 1194 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); |
| (...skipping 3634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4823 | 4829 |
| 4824 // PlzNavigate: the browser is responsible for knowing the start of all | 4830 // PlzNavigate: the browser is responsible for knowing the start of all |
| 4825 // non-synchronous navigations. | 4831 // non-synchronous navigations. |
| 4826 if (!IsBrowserSideNavigationEnabled() || !to_different_document) | 4832 if (!IsBrowserSideNavigationEnabled() || !to_different_document) |
| 4827 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document)); | 4833 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document)); |
| 4828 } | 4834 } |
| 4829 | 4835 |
| 4830 void RenderFrameImpl::didStopLoading() { | 4836 void RenderFrameImpl::didStopLoading() { |
| 4831 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading", | 4837 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading", |
| 4832 "id", routing_id_); | 4838 "id", routing_id_); |
| 4839 |
| 4840 // Any subframes created after this point won't be considered part of the |
| 4841 // current history navigation (if this was one), so we don't need to track |
| 4842 // this state anymore. |
| 4843 browser_has_subtree_history_items_ = false; |
| 4844 |
| 4833 render_view_->FrameDidStopLoading(frame_); | 4845 render_view_->FrameDidStopLoading(frame_); |
| 4834 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 4846 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
| 4835 } | 4847 } |
| 4836 | 4848 |
| 4837 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 4849 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
| 4838 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 4850 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
| 4839 } | 4851 } |
| 4840 | 4852 |
| 4841 void RenderFrameImpl::HandleWebAccessibilityEvent( | 4853 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 4842 const blink::WebAXObject& obj, blink::WebAXEvent event) { | 4854 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4964 if (is_content_initiated && IsTopLevelNavigation(frame_) && | 4976 if (is_content_initiated && IsTopLevelNavigation(frame_) && |
| 4965 render_view_->renderer_preferences_ | 4977 render_view_->renderer_preferences_ |
| 4966 .browser_handles_all_top_level_requests) { | 4978 .browser_handles_all_top_level_requests) { |
| 4967 OpenURL(url, IsHttpPost(info.urlRequest), | 4979 OpenURL(url, IsHttpPost(info.urlRequest), |
| 4968 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, | 4980 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, |
| 4969 info.defaultPolicy, info.replacesCurrentHistoryItem, false); | 4981 info.defaultPolicy, info.replacesCurrentHistoryItem, false); |
| 4970 return blink::WebNavigationPolicyIgnore; // Suppress the load here. | 4982 return blink::WebNavigationPolicyIgnore; // Suppress the load here. |
| 4971 } | 4983 } |
| 4972 | 4984 |
| 4973 // In OOPIF-enabled modes, back/forward navigations in newly created subframes | 4985 // In OOPIF-enabled modes, back/forward navigations in newly created subframes |
| 4974 // should be sent to the browser in case there is a matching | 4986 // should be sent to the browser if there is a chance there is a matching |
| 4975 // FrameNavigationEntry. If none is found, fall back to the default url. | 4987 // FrameNavigationEntry. If none is found (or if the browser has indicated it |
| 4988 // has no subtree history items), fall back to loading the default url. |
| 4976 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && | 4989 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && |
| 4977 info.isHistoryNavigationInNewChildFrame && is_content_initiated) { | 4990 info.isHistoryNavigationInNewChildFrame && is_content_initiated && |
| 4991 browser_has_subtree_history_items_) { |
| 4978 // Don't do this if |info| also says it is a client redirect, in which case | 4992 // Don't do this if |info| also says it is a client redirect, in which case |
| 4979 // JavaScript on the page is trying to interrupt the history navigation. | 4993 // JavaScript on the page is trying to interrupt the history navigation. |
| 4980 if (!info.isClientRedirect) { | 4994 if (!info.isClientRedirect) { |
| 4981 OpenURL(url, IsHttpPost(info.urlRequest), | 4995 OpenURL(url, IsHttpPost(info.urlRequest), |
| 4982 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, | 4996 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, |
| 4983 info.defaultPolicy, info.replacesCurrentHistoryItem, true); | 4997 info.defaultPolicy, info.replacesCurrentHistoryItem, true); |
| 4984 // Suppress the load in Blink but mark the frame as loading. | 4998 // Suppress the load in Blink but mark the frame as loading. |
| 4985 return blink::WebNavigationPolicyHandledByClient; | 4999 return blink::WebNavigationPolicyHandledByClient; |
| 4986 } else { | 5000 } else { |
| 4987 // Client redirects during an initial history load should attempt to | 5001 // Client redirects during an initial history load should attempt to |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5546 // PageState. | 5560 // PageState. |
| 5547 item_for_history_navigation = entry->root(); | 5561 item_for_history_navigation = entry->root(); |
| 5548 history_load_type = request_params.is_same_document_history_load | 5562 history_load_type = request_params.is_same_document_history_load |
| 5549 ? blink::WebHistorySameDocumentLoad | 5563 ? blink::WebHistorySameDocumentLoad |
| 5550 : blink::WebHistoryDifferentDocumentLoad; | 5564 : blink::WebHistoryDifferentDocumentLoad; |
| 5551 load_type = request_params.is_history_navigation_in_new_child | 5565 load_type = request_params.is_history_navigation_in_new_child |
| 5552 ? blink::WebFrameLoadType::InitialHistoryLoad | 5566 ? blink::WebFrameLoadType::InitialHistoryLoad |
| 5553 : blink::WebFrameLoadType::BackForward; | 5567 : blink::WebFrameLoadType::BackForward; |
| 5554 should_load_request = true; | 5568 should_load_request = true; |
| 5555 | 5569 |
| 5570 // Remember whether we should consult the browser process for any |
| 5571 // subframes created during this history navigation. |
| 5572 browser_has_subtree_history_items_ = |
| 5573 request_params.has_subtree_history_items; |
| 5574 |
| 5556 // If this is marked as a same document load but we haven't committed | 5575 // If this is marked as a same document load but we haven't committed |
| 5557 // anything, treat it as a new load. The browser shouldn't let this | 5576 // anything, treat it as a new load. The browser shouldn't let this |
| 5558 // happen. Also treat it as a new load, if the DSN in | 5577 // happen. Also treat it as a new load, if the DSN in |
| 5559 // |current_history_item_| and the item navigated to mismatch. | 5578 // |current_history_item_| and the item navigated to mismatch. |
| 5560 if (history_load_type == blink::WebHistorySameDocumentLoad) { | 5579 if (history_load_type == blink::WebHistorySameDocumentLoad) { |
| 5561 if (current_history_item_.isNull()) { | 5580 if (current_history_item_.isNull()) { |
| 5562 history_load_type = blink::WebHistoryDifferentDocumentLoad; | 5581 history_load_type = blink::WebHistoryDifferentDocumentLoad; |
| 5563 } else if (current_history_item_.documentSequenceNumber() != | 5582 } else if (current_history_item_.documentSequenceNumber() != |
| 5564 item_for_history_navigation.documentSequenceNumber()) { | 5583 item_for_history_navigation.documentSequenceNumber()) { |
| 5565 history_load_type = blink::WebHistoryDifferentDocumentLoad; | 5584 history_load_type = blink::WebHistoryDifferentDocumentLoad; |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6383 // event target. Potentially a Pepper plugin will receive the event. | 6402 // event target. Potentially a Pepper plugin will receive the event. |
| 6384 // In order to tell whether a plugin gets the last mouse event and which it | 6403 // In order to tell whether a plugin gets the last mouse event and which it |
| 6385 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6404 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6386 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6405 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6387 // |pepper_last_mouse_event_target_|. | 6406 // |pepper_last_mouse_event_target_|. |
| 6388 pepper_last_mouse_event_target_ = nullptr; | 6407 pepper_last_mouse_event_target_ = nullptr; |
| 6389 #endif | 6408 #endif |
| 6390 } | 6409 } |
| 6391 | 6410 |
| 6392 } // namespace content | 6411 } // namespace content |
| OLD | NEW |