| 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" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a | 379 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a |
| 380 // FrameTreeNode's RenderFrameHostManager. | 380 // FrameTreeNode's RenderFrameHostManager. |
| 381 static bool ClearProxiesInSiteInstance(int32 site_instance_id, | 381 static bool ClearProxiesInSiteInstance(int32 site_instance_id, |
| 382 FrameTreeNode* node); | 382 FrameTreeNode* node); |
| 383 | 383 |
| 384 // Returns whether this tab should transition to a new renderer for | 384 // Returns whether this tab should transition to a new renderer for |
| 385 // cross-site URLs. Enabled unless we see the --process-per-tab command line | 385 // cross-site URLs. Enabled unless we see the --process-per-tab command line |
| 386 // switch. Can be overridden in unit tests. | 386 // switch. Can be overridden in unit tests. |
| 387 bool ShouldTransitionCrossSite(); | 387 bool ShouldTransitionCrossSite(); |
| 388 | 388 |
| 389 // Returns true if for the navigation from |current_entry| to |new_entry|, | 389 // Returns true if for the navigation from |current_effective_url| to |
| 390 // a new SiteInstance and BrowsingInstance should be created (even if we are | 390 // |new_effective_url|, a new SiteInstance and BrowsingInstance should be |
| 391 // in a process model that doesn't usually swap). This forces a process swap | 391 // created (even if we are in a process model that doesn't usually swap). |
| 392 // and severs script connections with existing tabs. Cases where this can | 392 // This forces a process swap and severs script connections with existing |
| 393 // happen include transitions between WebUI and regular web pages. | 393 // tabs. Cases where this can happen include transitions between WebUI and |
| 394 // Either of the entries may be NULL. | 394 // regular web pages. |new_site_instance| may be null. |
| 395 // If there is no current NavigationEntry, then |current_is_view_source_mode| |
| 396 // should be the same as |new_is_view_source_mode|. |
| 397 // |
| 398 // We use the effective URL here, since that's what is used in the |
| 399 // SiteInstance's site and when we later call IsSameWebSite. If there is no |
| 400 // current NavigationEntry, check the current SiteInstance's site, which might |
| 401 // already be committed to a Web UI URL (such as the NTP). |
| 395 bool ShouldSwapBrowsingInstancesForNavigation( | 402 bool ShouldSwapBrowsingInstancesForNavigation( |
| 396 const NavigationEntry* current_entry, | 403 const GURL& current_effective_url, |
| 397 const NavigationEntryImpl* new_entry) const; | 404 bool current_is_view_source_mode, |
| 405 SiteInstance* new_site_instance, |
| 406 const GURL& new_effective_url, |
| 407 bool new_is_view_source_mode) const; |
| 398 | 408 |
| 399 // Returns true if it is safe to reuse the current WebUI when navigating from | 409 // Returns true if it is safe to reuse the current WebUI when navigating from |
| 400 // |current_entry| to |new_entry|. | 410 // |current_entry| to |new_entry|. |
| 401 bool ShouldReuseWebUI( | 411 bool ShouldReuseWebUI( |
| 402 const NavigationEntry* current_entry, | 412 const NavigationEntry* current_entry, |
| 403 const NavigationEntryImpl* new_entry) const; | 413 const NavigationEntryImpl* new_entry) const; |
| 404 | 414 |
| 405 // Returns an appropriate SiteInstance object for the given NavigationEntry, | 415 // Returns an appropriate SiteInstance object for the given |dest_url|, |
| 406 // possibly reusing the current SiteInstance. If --process-per-tab is used, | 416 // possibly reusing the current SiteInstance. If --process-per-tab is used, |
| 407 // this is only called when ShouldSwapBrowsingInstancesForNavigation returns | 417 // this is only called when ShouldSwapBrowsingInstancesForNavigation returns |
| 408 // true. | 418 // true. |dest_instance| will be used if it is not null. |
| 409 SiteInstance* GetSiteInstanceForEntry( | 419 SiteInstance* GetSiteInstanceForURL( |
| 410 const NavigationEntryImpl& entry, | 420 const GURL& dest_url, |
| 421 SiteInstance* dest_instance, |
| 422 PageTransition dest_transition, |
| 423 bool dest_is_restore, |
| 424 bool dest_is_view_source_mode, |
| 411 SiteInstance* current_instance, | 425 SiteInstance* current_instance, |
| 412 bool force_browsing_instance_swap); | 426 bool force_browsing_instance_swap); |
| 413 | 427 |
| 414 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. | 428 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. |
| 415 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, | 429 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, |
| 416 int view_routing_id, | 430 int view_routing_id, |
| 417 int frame_routing_id, | 431 int frame_routing_id, |
| 418 bool swapped_out, | 432 bool swapped_out, |
| 419 bool hidden); | 433 bool hidden); |
| 420 | 434 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 scoped_ptr<NavigationRequest> navigation_request_; | 547 scoped_ptr<NavigationRequest> navigation_request_; |
| 534 | 548 |
| 535 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 549 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
| 536 | 550 |
| 537 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 551 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
| 538 }; | 552 }; |
| 539 | 553 |
| 540 } // namespace content | 554 } // namespace content |
| 541 | 555 |
| 542 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 556 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
| OLD | NEW |