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 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/browser/renderer_host/render_view_host_delegate.h" | 12 #include "content/browser/renderer_host/render_view_host_delegate.h" |
13 #include "content/browser/site_instance_impl.h" | 13 #include "content/browser/site_instance_impl.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/global_request_id.h" | 15 #include "content/public/browser/global_request_id.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/common/referrer.h" | 18 #include "content/public/common/referrer.h" |
19 | 19 |
20 struct FrameHostMsg_BeginNavigation_Params; | 20 struct FrameHostMsg_BeginNavigation_Params; |
21 struct FrameMsg_Navigate_Params; | |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 class BrowserContext; | 24 class BrowserContext; |
24 class CrossProcessFrameConnector; | 25 class CrossProcessFrameConnector; |
25 class CrossSiteTransferringRequest; | 26 class CrossSiteTransferringRequest; |
26 class InterstitialPageImpl; | 27 class InterstitialPageImpl; |
27 class FrameTreeNode; | 28 class FrameTreeNode; |
28 class NavigationControllerImpl; | 29 class NavigationControllerImpl; |
29 class NavigationEntry; | 30 class NavigationEntry; |
30 class NavigationEntryImpl; | 31 class NavigationEntryImpl; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 // Sets the pending Web UI for the pending navigation, ensuring that the | 181 // Sets the pending Web UI for the pending navigation, ensuring that the |
181 // bindings are appropriate for the given NavigationEntry. | 182 // bindings are appropriate for the given NavigationEntry. |
182 void SetPendingWebUI(const NavigationEntryImpl& entry); | 183 void SetPendingWebUI(const NavigationEntryImpl& entry); |
183 | 184 |
184 // Called when we want to instruct the renderer to navigate to the given | 185 // Called when we want to instruct the renderer to navigate to the given |
185 // navigation entry. It may create a new RenderFrameHost or re-use an existing | 186 // navigation entry. It may create a new RenderFrameHost or re-use an existing |
186 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one | 187 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one |
187 // could not be created. | 188 // could not be created. |
188 RenderFrameHostImpl* Navigate(const NavigationEntryImpl& entry); | 189 RenderFrameHostImpl* Navigate(const NavigationEntryImpl& entry); |
189 | 190 |
191 // As part of the PlzNavigate refactoring project, sends a RequestNavigation | |
192 // IPC to the renderer to ask it to navigate. If no live renderer is present, | |
193 // then the navigation request will be sent directly to the | |
194 // ResourceDispatcherHost. | |
195 bool RequestNavigation(const NavigationEntryImpl& entry, | |
196 const FrameMsg_Navigate_Params& navigate_params); | |
197 | |
190 // Instructs the various live views to stop. Called when the user directed the | 198 // Instructs the various live views to stop. Called when the user directed the |
191 // page to stop loading. | 199 // page to stop loading. |
192 void Stop(); | 200 void Stop(); |
193 | 201 |
194 // Notifies the regular and pending RenderViewHosts that a load is or is not | 202 // Notifies the regular and pending RenderViewHosts that a load is or is not |
195 // happening. Even though the message is only for one of them, we don't know | 203 // happening. Even though the message is only for one of them, we don't know |
196 // which one so we tell both. | 204 // which one so we tell both. |
197 void SetIsLoading(bool is_loading); | 205 void SetIsLoading(bool is_loading); |
198 | 206 |
199 // Whether to close the tab or not when there is a hang during an unload | 207 // Whether to close the tab or not when there is a hang during an unload |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 void SwappedOut(RenderFrameHostImpl* render_frame_host); | 247 void SwappedOut(RenderFrameHostImpl* render_frame_host); |
240 | 248 |
241 // Called when a renderer's frame navigates. | 249 // Called when a renderer's frame navigates. |
242 void DidNavigateFrame(RenderFrameHostImpl* render_frame_host); | 250 void DidNavigateFrame(RenderFrameHostImpl* render_frame_host); |
243 | 251 |
244 // Called when a renderer sets its opener to null. | 252 // Called when a renderer sets its opener to null. |
245 void DidDisownOpener(RenderViewHost* render_view_host); | 253 void DidDisownOpener(RenderViewHost* render_view_host); |
246 | 254 |
247 // Helper method to create and initialize a RenderFrameHost. If |swapped_out| | 255 // Helper method to create and initialize a RenderFrameHost. If |swapped_out| |
248 // is true, it will be initially placed on the swapped out hosts list. | 256 // is true, it will be initially placed on the swapped out hosts list. |
257 // Else if |is_speculative| is true, then it will used as a speculatively | |
258 // spawned renderer in the PlzNavigate navigation refactoring project. | |
249 // Otherwise, it will be used for a pending cross-site navigation. | 259 // Otherwise, it will be used for a pending cross-site navigation. |
250 // Returns the routing id of the *view* associated with the frame. | 260 // Returns the routing id of the *view* associated with the frame. |
251 int CreateRenderFrame(SiteInstance* instance, | 261 int CreateRenderFrame(SiteInstance* instance, |
252 int opener_route_id, | 262 int opener_route_id, |
253 bool swapped_out, | 263 bool swapped_out, |
254 bool hidden); | 264 bool hidden, |
265 bool is_speculative); | |
255 | 266 |
256 // Sets the passed passed interstitial as the currently showing interstitial. | 267 // Sets the passed passed interstitial as the currently showing interstitial. |
257 // |interstitial_page| should be non NULL (use the remove_interstitial_page | 268 // |interstitial_page| should be non NULL (use the remove_interstitial_page |
258 // method to unset the interstitial) and no interstitial page should be set | 269 // method to unset the interstitial) and no interstitial page should be set |
259 // when there is already a non NULL interstitial page set. | 270 // when there is already a non NULL interstitial page set. |
260 void set_interstitial_page(InterstitialPageImpl* interstitial_page) { | 271 void set_interstitial_page(InterstitialPageImpl* interstitial_page) { |
261 DCHECK(!interstitial_page_ && interstitial_page); | 272 DCHECK(!interstitial_page_ && interstitial_page); |
262 interstitial_page_ = interstitial_page; | 273 interstitial_page_ = interstitial_page; |
263 } | 274 } |
264 | 275 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 // with the given |proxy_routing_id|, which is used to route IPC messages when | 417 // with the given |proxy_routing_id|, which is used to route IPC messages when |
407 // in swapped out state. Returns early if the RenderViewHost has already been | 418 // in swapped out state. Returns early if the RenderViewHost has already been |
408 // initialized for another RenderFrameHost. | 419 // initialized for another RenderFrameHost. |
409 // TODO(creis): opener_route_id is currently for the RenderViewHost but should | 420 // TODO(creis): opener_route_id is currently for the RenderViewHost but should |
410 // be for the RenderFrame, since frames can have openers. | 421 // be for the RenderFrame, since frames can have openers. |
411 bool InitRenderView(RenderViewHost* render_view_host, | 422 bool InitRenderView(RenderViewHost* render_view_host, |
412 int opener_route_id, | 423 int opener_route_id, |
413 int proxy_routing_id, | 424 int proxy_routing_id, |
414 bool for_main_frame); | 425 bool for_main_frame); |
415 | 426 |
427 // Initializes |dest_render_frame_host| and |render_frame_host_| if necessary | |
428 // before navigating. | |
429 bool InitRenderFrameHostsBeforeNavigation( | |
430 RenderFrameHostImpl* dest_render_frame_host); | |
431 | |
432 // Returns the SiteInstance to use for the navigation. | |
433 SiteInstance* GetSiteInstanceForNavigation(const NavigationEntryImpl& entry); | |
434 | |
416 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this | 435 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this |
417 // doesn't require the pending render_frame_host_ pointer to be non-NULL, | 436 // doesn't require the pending render_frame_host_ pointer to be non-NULL, |
418 // since there could be Web UI switching as well. Call this for every commit. | 437 // since there could be Web UI switching as well. Call this for every commit. |
419 void CommitPending(); | 438 void CommitPending(); |
420 | 439 |
421 // Shutdown all RenderFrameHosts in a SiteInstance. This is called to shutdown | 440 // Shutdown all RenderFrameHosts in a SiteInstance. This is called to shutdown |
422 // frames when all the frames in a SiteInstance are confirmed to be swapped | 441 // frames when all the frames in a SiteInstance are confirmed to be swapped |
423 // out. | 442 // out. |
424 void ShutdownRenderFrameHostsInSiteInstance(int32 site_instance_id); | 443 void ShutdownRenderFrameHostsInSiteInstance(int32 site_instance_id); |
425 | 444 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 // associated with the navigation. | 494 // associated with the navigation. |
476 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; | 495 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; |
477 | 496 |
478 // Tracks information about any current pending cross-process navigation. | 497 // Tracks information about any current pending cross-process navigation. |
479 scoped_ptr<PendingNavigationParams> pending_nav_params_; | 498 scoped_ptr<PendingNavigationParams> pending_nav_params_; |
480 | 499 |
481 // Tracks information about any navigation paused after receiving response | 500 // Tracks information about any navigation paused after receiving response |
482 // headers. | 501 // headers. |
483 scoped_ptr<GlobalRequestID> response_started_id_; | 502 scoped_ptr<GlobalRequestID> response_started_id_; |
484 | 503 |
504 // A RenderFrameHost speculatively created when receiving a navigation | |
505 // request. It should be used or deleted when the current navigation request | |
506 // commits. This is part of the PlzNavigate navigation refactoring project. | |
nasko
2014/07/17 12:05:08
nit: I don't think we should sprinkle PlzNavigate
clamy
2014/07/17 13:07:53
Done. I guess I'm worried that people may not real
Charlie Reis
2014/07/29 17:46:56
I agree with clamy@ here. I'm very concerned abou
| |
507 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; | |
508 | |
485 // If either of these is non-NULL, the pending navigation is to a chrome: | 509 // If either of these is non-NULL, the pending navigation is to a chrome: |
486 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is | 510 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is |
487 // used for when they reference the same object. If either is non-NULL, the | 511 // used for when they reference the same object. If either is non-NULL, the |
488 // other should be NULL. | 512 // other should be NULL. |
489 scoped_ptr<WebUIImpl> pending_web_ui_; | 513 scoped_ptr<WebUIImpl> pending_web_ui_; |
490 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; | 514 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; |
491 | 515 |
492 // A map of site instance ID to RenderFrameProxyHosts. | 516 // A map of site instance ID to RenderFrameProxyHosts. |
493 typedef base::hash_map<int32, RenderFrameProxyHost*> RenderFrameProxyHostMap; | 517 typedef base::hash_map<int32, RenderFrameProxyHost*> RenderFrameProxyHostMap; |
494 RenderFrameProxyHostMap proxy_hosts_; | 518 RenderFrameProxyHostMap proxy_hosts_; |
(...skipping 13 matching lines...) Expand all Loading... | |
508 scoped_ptr<NavigationRequest> navigation_request_; | 532 scoped_ptr<NavigationRequest> navigation_request_; |
509 | 533 |
510 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 534 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
511 | 535 |
512 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 536 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
513 }; | 537 }; |
514 | 538 |
515 } // namespace content | 539 } // namespace content |
516 | 540 |
517 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 541 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |