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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1374053002: Remove AboutToNavigateRenderFrame, issue custom notification for DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased, win test fix Created 5 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
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/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/process/kill.h" 12 #include "base/process/kill.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/browser/accessibility/accessibility_mode_helper.h" 14 #include "content/browser/accessibility/accessibility_mode_helper.h"
15 #include "content/browser/accessibility/ax_tree_id_registry.h" 15 #include "content/browser/accessibility/ax_tree_id_registry.h"
16 #include "content/browser/accessibility/browser_accessibility_manager.h" 16 #include "content/browser/accessibility/browser_accessibility_manager.h"
17 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 17 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
18 #include "content/browser/bad_message.h" 18 #include "content/browser/bad_message.h"
19 #include "content/browser/child_process_security_policy_impl.h" 19 #include "content/browser/child_process_security_policy_impl.h"
20 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
20 #include "content/browser/frame_host/cross_process_frame_connector.h" 21 #include "content/browser/frame_host/cross_process_frame_connector.h"
21 #include "content/browser/frame_host/cross_site_transferring_request.h" 22 #include "content/browser/frame_host/cross_site_transferring_request.h"
22 #include "content/browser/frame_host/frame_mojo_shell.h" 23 #include "content/browser/frame_host/frame_mojo_shell.h"
23 #include "content/browser/frame_host/frame_tree.h" 24 #include "content/browser/frame_host/frame_tree.h"
24 #include "content/browser/frame_host/frame_tree_node.h" 25 #include "content/browser/frame_host/frame_tree_node.h"
25 #include "content/browser/frame_host/navigation_handle_impl.h" 26 #include "content/browser/frame_host/navigation_handle_impl.h"
26 #include "content/browser/frame_host/navigation_request.h" 27 #include "content/browser/frame_host/navigation_request.h"
27 #include "content/browser/frame_host/navigator.h" 28 #include "content/browser/frame_host/navigator.h"
28 #include "content/browser/frame_host/navigator_impl.h" 29 #include "content/browser/frame_host/navigator_impl.h"
29 #include "content/browser/frame_host/render_frame_host_delegate.h" 30 #include "content/browser/frame_host/render_frame_host_delegate.h"
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 // navigations will only be suspended during a cross-site request. If a 1699 // navigations will only be suspended during a cross-site request. If a
1699 // second navigation occurs, RenderFrameHostManager will cancel this pending 1700 // second navigation occurs, RenderFrameHostManager will cancel this pending
1700 // RFH and create a new pending RFH. 1701 // RFH and create a new pending RFH.
1701 DCHECK(!suspended_nav_params_.get()); 1702 DCHECK(!suspended_nav_params_.get());
1702 suspended_nav_params_.reset( 1703 suspended_nav_params_.reset(
1703 new NavigationParams(common_params, start_params, request_params)); 1704 new NavigationParams(common_params, start_params, request_params));
1704 } else { 1705 } else {
1705 // Get back to a clean state, in case we start a new navigation without 1706 // Get back to a clean state, in case we start a new navigation without
1706 // completing a RFH swap or unload handler. 1707 // completing a RFH swap or unload handler.
1707 SetState(RenderFrameHostImpl::STATE_DEFAULT); 1708 SetState(RenderFrameHostImpl::STATE_DEFAULT);
1708 1709 SendNavigateMessage(common_params, start_params, request_params);
1709 Send(new FrameMsg_Navigate(routing_id_, common_params, start_params,
1710 request_params));
1711 } 1710 }
1712 1711
1713 // Force the throbber to start. This is done because Blink's "started loading" 1712 // Force the throbber to start. This is done because Blink's "started loading"
1714 // message will be received asynchronously from the UI of the browser. But the 1713 // message will be received asynchronously from the UI of the browser. But the
1715 // throbber needs to be kept in sync with what's happening in the UI. For 1714 // throbber needs to be kept in sync with what's happening in the UI. For
1716 // example, the throbber will start immediately when the user navigates even 1715 // example, the throbber will start immediately when the user navigates even
1717 // if the renderer is delayed. There is also an issue with the throbber 1716 // if the renderer is delayed. There is also an issue with the throbber
1718 // starting because the WebUI (which controls whether the favicon is 1717 // starting because the WebUI (which controls whether the favicon is
1719 // displayed) happens synchronously. If the start loading messages was 1718 // displayed) happens synchronously. If the start loading messages was
1720 // asynchronous, then the default favicon would flash in. 1719 // asynchronous, then the default favicon would flash in.
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 2102
2104 if (!suspend && suspended_nav_params_) { 2103 if (!suspend && suspended_nav_params_) {
2105 // There's navigation message params waiting to be sent. Now that we're not 2104 // There's navigation message params waiting to be sent. Now that we're not
2106 // suspended anymore, resume navigation by sending them. If we were swapped 2105 // suspended anymore, resume navigation by sending them. If we were swapped
2107 // out, we should also stop filtering out the IPC messages now. 2106 // out, we should also stop filtering out the IPC messages now.
2108 SetState(RenderFrameHostImpl::STATE_DEFAULT); 2107 SetState(RenderFrameHostImpl::STATE_DEFAULT);
2109 2108
2110 DCHECK(!proceed_time.is_null()); 2109 DCHECK(!proceed_time.is_null());
2111 suspended_nav_params_->request_params.browser_navigation_start = 2110 suspended_nav_params_->request_params.browser_navigation_start =
2112 proceed_time; 2111 proceed_time;
2113 Send(new FrameMsg_Navigate(routing_id_, 2112 SendNavigateMessage(suspended_nav_params_->common_params,
2114 suspended_nav_params_->common_params, 2113 suspended_nav_params_->start_params,
2115 suspended_nav_params_->start_params, 2114 suspended_nav_params_->request_params);
2116 suspended_nav_params_->request_params));
2117 suspended_nav_params_.reset(); 2115 suspended_nav_params_.reset();
2118 } 2116 }
2119 } 2117 }
2120 2118
2121 void RenderFrameHostImpl::CancelSuspendedNavigations() { 2119 void RenderFrameHostImpl::CancelSuspendedNavigations() {
2122 // Clear any state if a pending navigation is canceled or preempted. 2120 // Clear any state if a pending navigation is canceled or preempted.
2123 if (suspended_nav_params_) 2121 if (suspended_nav_params_)
2124 suspended_nav_params_.reset(); 2122 suspended_nav_params_.reset();
2125 2123
2126 TRACE_EVENT_ASYNC_END0("navigation", 2124 TRACE_EVENT_ASYNC_END0("navigation",
2127 "RenderFrameHostImpl navigation suspended", this); 2125 "RenderFrameHostImpl navigation suspended", this);
2128 navigations_suspended_ = false; 2126 navigations_suspended_ = false;
2129 } 2127 }
2130 2128
2129 void RenderFrameHostImpl::SendNavigateMessage(
2130 const CommonNavigationParams& common_params,
2131 const StartNavigationParams& start_params,
2132 const RequestNavigationParams& request_params) {
2133 RenderFrameDevToolsAgentHost::OnBeforeNavigation(
2134 frame_tree_node_->current_frame_host(), this);
2135 Send(new FrameMsg_Navigate(
2136 routing_id_, common_params, start_params, request_params));
2137 }
2138
2131 void RenderFrameHostImpl::DidUseGeolocationPermission() { 2139 void RenderFrameHostImpl::DidUseGeolocationPermission() {
2132 PermissionManager* permission_manager = 2140 PermissionManager* permission_manager =
2133 GetSiteInstance()->GetBrowserContext()->GetPermissionManager(); 2141 GetSiteInstance()->GetBrowserContext()->GetPermissionManager();
2134 if (!permission_manager) 2142 if (!permission_manager)
2135 return; 2143 return;
2136 2144
2137 permission_manager->RegisterPermissionUsage( 2145 permission_manager->RegisterPermissionUsage(
2138 PermissionType::GEOLOCATION, 2146 PermissionType::GEOLOCATION,
2139 GetLastCommittedURL().GetOrigin(), 2147 GetLastCommittedURL().GetOrigin(),
2140 frame_tree_node()->frame_tree()->GetMainFrame() 2148 frame_tree_node()->frame_tree()->GetMainFrame()
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 BrowserPluginInstanceIDToAXTreeID(value))); 2256 BrowserPluginInstanceIDToAXTreeID(value)));
2249 break; 2257 break;
2250 case AX_CONTENT_INT_ATTRIBUTE_LAST: 2258 case AX_CONTENT_INT_ATTRIBUTE_LAST:
2251 NOTREACHED(); 2259 NOTREACHED();
2252 break; 2260 break;
2253 } 2261 }
2254 } 2262 }
2255 } 2263 }
2256 2264
2257 } // namespace content 2265 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698