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/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 #include "content/browser/webui/web_ui_impl.h" | 29 #include "content/browser/webui/web_ui_impl.h" |
30 #include "content/common/frame_messages.h" | 30 #include "content/common/frame_messages.h" |
31 #include "content/common/view_messages.h" | 31 #include "content/common/view_messages.h" |
32 #include "content/public/browser/content_browser_client.h" | 32 #include "content/public/browser/content_browser_client.h" |
33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
35 #include "content/public/browser/render_widget_host_iterator.h" | 35 #include "content/public/browser/render_widget_host_iterator.h" |
36 #include "content/public/browser/render_widget_host_view.h" | 36 #include "content/public/browser/render_widget_host_view.h" |
37 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
38 #include "content/public/browser/web_ui_controller.h" | 38 #include "content/public/browser/web_ui_controller.h" |
39 #include "content/public/common/bindings_policy.h" | |
39 #include "content/public/common/content_switches.h" | 40 #include "content/public/common/content_switches.h" |
40 #include "content/public/common/referrer.h" | 41 #include "content/public/common/referrer.h" |
41 #include "content/public/common/url_constants.h" | 42 #include "content/public/common/url_constants.h" |
42 | 43 |
43 namespace content { | 44 namespace content { |
44 | 45 |
45 // static | 46 // static |
46 bool RenderFrameHostManager::ClearRFHsPendingShutdown(FrameTreeNode* node) { | 47 bool RenderFrameHostManager::ClearRFHsPendingShutdown(FrameTreeNode* node) { |
47 node->render_manager()->pending_delete_hosts_.clear(); | 48 node->render_manager()->pending_delete_hosts_.clear(); |
48 return true; | 49 return true; |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
740 SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation( | 741 SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation( |
741 const GURL& dest_url, | 742 const GURL& dest_url, |
742 SiteInstance* dest_instance, | 743 SiteInstance* dest_instance, |
743 ui::PageTransition dest_transition, | 744 ui::PageTransition dest_transition, |
744 bool dest_is_restore, | 745 bool dest_is_restore, |
745 bool dest_is_view_source_mode) { | 746 bool dest_is_view_source_mode) { |
746 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); | 747 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); |
747 SiteInstance* new_instance = current_instance; | 748 SiteInstance* new_instance = current_instance; |
748 | 749 |
749 // We do not currently swap processes for navigations in webview tag guests. | 750 // We do not currently swap processes for navigations in webview tag guests. |
750 bool is_guest_scheme = current_instance->GetSiteURL().SchemeIs(kGuestScheme); | 751 if(current_instance->GetSiteURL().SchemeIs(kGuestScheme)) |
Charlie Reis
2014/10/20 19:37:53
nit: Space after if.
(git cl format will help catc
Krzysztof Olczyk
2014/10/21 08:27:05
Done.
| |
752 return current_instance; | |
751 | 753 |
752 // Determine if we need a new BrowsingInstance for this entry. If true, this | 754 // Determine if we need a new BrowsingInstance for this entry. If true, this |
753 // implies that it will get a new SiteInstance (and likely process), and that | 755 // implies that it will get a new SiteInstance (and likely process), and that |
754 // other tabs in the current BrowsingInstance will be unable to script it. | 756 // other tabs in the current BrowsingInstance will be unable to script it. |
755 // This is used for cases that require a process swap even in the | 757 // This is used for cases that require a process swap even in the |
756 // process-per-tab model, such as WebUI pages. | 758 // process-per-tab model, such as WebUI pages. |
757 // TODO(clamy): Remove the dependency on the current entry. | 759 // TODO(clamy): Remove the dependency on the current entry. |
758 const NavigationEntry* current_entry = | 760 const NavigationEntry* current_entry = |
759 delegate_->GetLastCommittedNavigationEntryForRenderManager(); | 761 delegate_->GetLastCommittedNavigationEntryForRenderManager(); |
760 BrowserContext* browser_context = | 762 BrowserContext* browser_context = |
761 delegate_->GetControllerForRenderManager().GetBrowserContext(); | 763 delegate_->GetControllerForRenderManager().GetBrowserContext(); |
762 const GURL& current_effective_url = current_entry ? | 764 const GURL& current_effective_url = current_entry ? |
763 SiteInstanceImpl::GetEffectiveURL(browser_context, | 765 SiteInstanceImpl::GetEffectiveURL(browser_context, |
764 current_entry->GetURL()) : | 766 current_entry->GetURL()) : |
765 render_frame_host_->GetSiteInstance()->GetSiteURL(); | 767 render_frame_host_->GetSiteInstance()->GetSiteURL(); |
766 bool current_is_view_source_mode = current_entry ? | 768 bool current_is_view_source_mode = current_entry ? |
767 current_entry->IsViewSourceMode() : dest_is_view_source_mode; | 769 current_entry->IsViewSourceMode() : dest_is_view_source_mode; |
768 bool force_swap = !is_guest_scheme && | 770 int current_enabled_bindings = |
769 ShouldSwapBrowsingInstancesForNavigation( | 771 render_frame_host_->render_view_host()->GetEnabledBindings(); |
770 current_effective_url, | 772 bool navigating_away_from_blank_page_in_webui = |
771 current_is_view_source_mode, | 773 current_effective_url.spec() == url::kAboutBlankURL && |
Charlie Reis
2014/10/20 19:37:53
This seems much too specific to me. The underlyin
Krzysztof Olczyk
2014/10/21 08:27:05
Indeed, it looks like it makes more sense to put s
| |
772 dest_instance, | 774 (current_enabled_bindings & BINDINGS_POLICY_WEB_UI); |
773 SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url), | 775 bool force_swap = ShouldSwapBrowsingInstancesForNavigation( |
774 dest_is_view_source_mode); | 776 current_effective_url, |
775 if (!is_guest_scheme && (ShouldTransitionCrossSite() || force_swap)) { | 777 current_is_view_source_mode, |
778 dest_instance, | |
779 SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url), | |
780 dest_is_view_source_mode); | |
781 if (ShouldTransitionCrossSite() || force_swap || | |
782 navigating_away_from_blank_page_in_webui) { | |
Charlie Reis
2014/10/20 19:37:53
I'd rather not make this more complicated in this
Krzysztof Olczyk
2014/10/21 08:27:05
Done.
| |
776 new_instance = GetSiteInstanceForURL( | 783 new_instance = GetSiteInstanceForURL( |
777 dest_url, | 784 dest_url, |
778 dest_instance, | 785 dest_instance, |
779 dest_transition, | 786 dest_transition, |
780 dest_is_restore, | 787 dest_is_restore, |
781 dest_is_view_source_mode, | 788 dest_is_view_source_mode, |
782 current_instance, | 789 current_instance, |
783 force_swap); | 790 force_swap); |
784 } | 791 } |
785 | 792 |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1594 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1601 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
1595 SiteInstance* instance) { | 1602 SiteInstance* instance) { |
1596 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1603 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
1597 if (iter != proxy_hosts_.end()) { | 1604 if (iter != proxy_hosts_.end()) { |
1598 delete iter->second; | 1605 delete iter->second; |
1599 proxy_hosts_.erase(iter); | 1606 proxy_hosts_.erase(iter); |
1600 } | 1607 } |
1601 } | 1608 } |
1602 | 1609 |
1603 } // namespace content | 1610 } // namespace content |
OLD | NEW |