Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2316003002: Notify the renderer if a history navigation has no subframe items. (Closed)
Patch Set: Fix indent. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 1036
1037 // RenderFrameImpl ---------------------------------------------------------- 1037 // RenderFrameImpl ----------------------------------------------------------
1038 RenderFrameImpl::RenderFrameImpl(const CreateParams& params) 1038 RenderFrameImpl::RenderFrameImpl(const CreateParams& params)
1039 : frame_(NULL), 1039 : frame_(NULL),
1040 is_main_frame_(true), 1040 is_main_frame_(true),
1041 in_browser_initiated_detach_(false), 1041 in_browser_initiated_detach_(false),
1042 in_frame_tree_(false), 1042 in_frame_tree_(false),
1043 render_view_(params.render_view->AsWeakPtr()), 1043 render_view_(params.render_view->AsWeakPtr()),
1044 routing_id_(params.routing_id), 1044 routing_id_(params.routing_id),
1045 proxy_routing_id_(MSG_ROUTING_NONE), 1045 proxy_routing_id_(MSG_ROUTING_NONE),
1046 browser_has_subtree_history_items_(false),
1046 #if defined(ENABLE_PLUGINS) 1047 #if defined(ENABLE_PLUGINS)
1047 plugin_power_saver_helper_(nullptr), 1048 plugin_power_saver_helper_(nullptr),
1048 plugin_find_handler_(nullptr), 1049 plugin_find_handler_(nullptr),
1049 #endif 1050 #endif
1050 cookie_jar_(this), 1051 cookie_jar_(this),
1051 selection_text_offset_(0), 1052 selection_text_offset_(0),
1052 selection_range_(gfx::Range::InvalidRange()), 1053 selection_range_(gfx::Range::InvalidRange()),
1053 handling_select_range_(false), 1054 handling_select_range_(false),
1054 web_user_media_client_(NULL), 1055 web_user_media_client_(NULL),
1055 #if defined(OS_ANDROID) 1056 #if defined(OS_ANDROID)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1159
1159 frame_ = web_frame; 1160 frame_ = web_frame;
1160 } 1161 }
1161 1162
1162 void RenderFrameImpl::Initialize() { 1163 void RenderFrameImpl::Initialize() {
1163 is_main_frame_ = !frame_->parent(); 1164 is_main_frame_ = !frame_->parent();
1164 1165
1165 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame( 1166 RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame(
1166 frame_->parent()); 1167 frame_->parent());
1167 if (parent_frame) { 1168 if (parent_frame) {
1169 // Inherit knowledge of whether we need to consult the browser process for
1170 // a history item on the first navigation. This is inherited by further
1171 // subframes and cleared at didStopLoading.
1172 browser_has_subtree_history_items_ =
1173 parent_frame->browser_has_subtree_history_items_;
1168 is_using_lofi_ = parent_frame->IsUsingLoFi(); 1174 is_using_lofi_ = parent_frame->IsUsingLoFi();
1169 effective_connection_type_ = parent_frame->getEffectiveConnectionType(); 1175 effective_connection_type_ = parent_frame->getEffectiveConnectionType();
1170 } 1176 }
1171 1177
1172 bool is_tracing_rail = false; 1178 bool is_tracing_rail = false;
1173 bool is_tracing_navigation = false; 1179 bool is_tracing_navigation = false;
1174 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing_navigation); 1180 TRACE_EVENT_CATEGORY_GROUP_ENABLED("navigation", &is_tracing_navigation);
1175 TRACE_EVENT_CATEGORY_GROUP_ENABLED("rail", &is_tracing_rail); 1181 TRACE_EVENT_CATEGORY_GROUP_ENABLED("rail", &is_tracing_rail);
1176 if (is_tracing_rail || is_tracing_navigation) { 1182 if (is_tracing_rail || is_tracing_navigation) {
1177 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); 1183 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent());
(...skipping 3635 matching lines...) Expand 10 before | Expand all | Expand 10 after
4813 4819
4814 // PlzNavigate: the browser is responsible for knowing the start of all 4820 // PlzNavigate: the browser is responsible for knowing the start of all
4815 // non-synchronous navigations. 4821 // non-synchronous navigations.
4816 if (!IsBrowserSideNavigationEnabled() || !to_different_document) 4822 if (!IsBrowserSideNavigationEnabled() || !to_different_document)
4817 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document)); 4823 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document));
4818 } 4824 }
4819 4825
4820 void RenderFrameImpl::didStopLoading() { 4826 void RenderFrameImpl::didStopLoading() {
4821 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading", 4827 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading",
4822 "id", routing_id_); 4828 "id", routing_id_);
4829
4830 // Any subframes created after this point won't be considered part of the
4831 // current history navigation (if this was one), so we don't need to track
4832 // this state anymore.
4833 browser_has_subtree_history_items_ = false;
4834
4823 render_view_->FrameDidStopLoading(frame_); 4835 render_view_->FrameDidStopLoading(frame_);
4824 Send(new FrameHostMsg_DidStopLoading(routing_id_)); 4836 Send(new FrameHostMsg_DidStopLoading(routing_id_));
4825 } 4837 }
4826 4838
4827 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { 4839 void RenderFrameImpl::didChangeLoadProgress(double load_progress) {
4828 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); 4840 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress));
4829 } 4841 }
4830 4842
4831 void RenderFrameImpl::HandleWebAccessibilityEvent( 4843 void RenderFrameImpl::HandleWebAccessibilityEvent(
4832 const blink::WebAXObject& obj, blink::WebAXEvent event) { 4844 const blink::WebAXObject& obj, blink::WebAXEvent event) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
4957 if (is_content_initiated && IsTopLevelNavigation(frame_) && 4969 if (is_content_initiated && IsTopLevelNavigation(frame_) &&
4958 render_view_->renderer_preferences_ 4970 render_view_->renderer_preferences_
4959 .browser_handles_all_top_level_requests) { 4971 .browser_handles_all_top_level_requests) {
4960 OpenURL(url, IsHttpPost(info.urlRequest), 4972 OpenURL(url, IsHttpPost(info.urlRequest),
4961 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, 4973 GetRequestBodyForWebURLRequest(info.urlRequest), referrer,
4962 info.defaultPolicy, info.replacesCurrentHistoryItem, false); 4974 info.defaultPolicy, info.replacesCurrentHistoryItem, false);
4963 return blink::WebNavigationPolicyIgnore; // Suppress the load here. 4975 return blink::WebNavigationPolicyIgnore; // Suppress the load here.
4964 } 4976 }
4965 4977
4966 // In OOPIF-enabled modes, back/forward navigations in newly created subframes 4978 // In OOPIF-enabled modes, back/forward navigations in newly created subframes
4967 // should be sent to the browser in case there is a matching 4979 // should be sent to the browser if there is a chance there is a matching
4968 // FrameNavigationEntry. If none is found, fall back to the default url. 4980 // FrameNavigationEntry. If none is found (or if the browser has indicated it
4981 // has no subtree history items), fall back to loading the default url.
4969 if (SiteIsolationPolicy::UseSubframeNavigationEntries() && 4982 if (SiteIsolationPolicy::UseSubframeNavigationEntries() &&
4970 info.isHistoryNavigationInNewChildFrame && is_content_initiated) { 4983 info.isHistoryNavigationInNewChildFrame && is_content_initiated &&
4984 browser_has_subtree_history_items_) {
4971 // Don't do this if |info| also says it is a client redirect, in which case 4985 // Don't do this if |info| also says it is a client redirect, in which case
4972 // JavaScript on the page is trying to interrupt the history navigation. 4986 // JavaScript on the page is trying to interrupt the history navigation.
4973 if (!info.isClientRedirect) { 4987 if (!info.isClientRedirect) {
4974 OpenURL(url, IsHttpPost(info.urlRequest), 4988 OpenURL(url, IsHttpPost(info.urlRequest),
4975 GetRequestBodyForWebURLRequest(info.urlRequest), referrer, 4989 GetRequestBodyForWebURLRequest(info.urlRequest), referrer,
4976 info.defaultPolicy, info.replacesCurrentHistoryItem, true); 4990 info.defaultPolicy, info.replacesCurrentHistoryItem, true);
4977 // Suppress the load in Blink but mark the frame as loading. 4991 // Suppress the load in Blink but mark the frame as loading.
4978 return blink::WebNavigationPolicyHandledByClient; 4992 return blink::WebNavigationPolicyHandledByClient;
4979 } else { 4993 } else {
4980 // Client redirects during an initial history load should attempt to 4994 // Client redirects during an initial history load should attempt to
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
5564 // PageState. 5578 // PageState.
5565 item_for_history_navigation = entry->root(); 5579 item_for_history_navigation = entry->root();
5566 history_load_type = request_params.is_same_document_history_load 5580 history_load_type = request_params.is_same_document_history_load
5567 ? blink::WebHistorySameDocumentLoad 5581 ? blink::WebHistorySameDocumentLoad
5568 : blink::WebHistoryDifferentDocumentLoad; 5582 : blink::WebHistoryDifferentDocumentLoad;
5569 load_type = request_params.is_history_navigation_in_new_child 5583 load_type = request_params.is_history_navigation_in_new_child
5570 ? blink::WebFrameLoadType::InitialHistoryLoad 5584 ? blink::WebFrameLoadType::InitialHistoryLoad
5571 : blink::WebFrameLoadType::BackForward; 5585 : blink::WebFrameLoadType::BackForward;
5572 should_load_request = true; 5586 should_load_request = true;
5573 5587
5588 // Remember whether we should consult the browser process for any
5589 // subframes created during this history navigation.
5590 browser_has_subtree_history_items_ =
5591 request_params.has_subtree_history_items;
5592
5574 if (history_load_type == blink::WebHistorySameDocumentLoad) { 5593 if (history_load_type == blink::WebHistorySameDocumentLoad) {
5575 // If this is marked as a same document load but we haven't committed 5594 // If this is marked as a same document load but we haven't committed
5576 // anything, treat it as a new load. The browser shouldn't let this 5595 // anything, treat it as a new load. The browser shouldn't let this
5577 // happen. 5596 // happen.
5578 if (current_history_item_.isNull()) { 5597 if (current_history_item_.isNull()) {
5579 history_load_type = blink::WebHistoryDifferentDocumentLoad; 5598 history_load_type = blink::WebHistoryDifferentDocumentLoad;
5580 NOTREACHED(); 5599 NOTREACHED();
5581 } else { 5600 } else {
5582 // Additionally, if the |current_history_item_|'s document 5601 // Additionally, if the |current_history_item_|'s document
5583 // sequence number doesn't match the one sent from the browser, it 5602 // sequence number doesn't match the one sent from the browser, it
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
6392 // event target. Potentially a Pepper plugin will receive the event. 6411 // event target. Potentially a Pepper plugin will receive the event.
6393 // In order to tell whether a plugin gets the last mouse event and which it 6412 // In order to tell whether a plugin gets the last mouse event and which it
6394 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6413 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6395 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6414 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6396 // |pepper_last_mouse_event_target_|. 6415 // |pepper_last_mouse_event_target_|.
6397 pepper_last_mouse_event_target_ = nullptr; 6416 pepper_last_mouse_event_target_ = nullptr;
6398 #endif 6417 #endif
6399 } 6418 }
6400 6419
6401 } // namespace content 6420 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698