Chromium Code Reviews| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); | 713 SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); |
| 714 | 714 |
| 715 scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation( | 715 scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation( |
| 716 request.common_params().url, request.source_site_instance(), | 716 request.common_params().url, request.source_site_instance(), |
| 717 request.dest_site_instance(), request.common_params().transition, | 717 request.dest_site_instance(), request.common_params().transition, |
| 718 request.restore_type() != NavigationEntryImpl::RESTORE_NONE, | 718 request.restore_type() != NavigationEntryImpl::RESTORE_NONE, |
| 719 request.is_view_source()); | 719 request.is_view_source()); |
| 720 // The appropriate RenderFrameHost to commit the navigation. | 720 // The appropriate RenderFrameHost to commit the navigation. |
| 721 RenderFrameHostImpl* navigation_rfh = nullptr; | 721 RenderFrameHostImpl* navigation_rfh = nullptr; |
| 722 | 722 |
| 723 // TODO(carlosk): do not swap processes for renderer initiated navigations | 723 // TODO(carlosk): Renderer-initiated navigations that may require a |
| 724 // SiteInstance swap are sent to the browser via the OpenURL IPC, and are | |
| 725 // afterwards treated as browser-initiated navigations. The only | |
| 726 // NavigationRequests marked as renderer-initiated are created by receiving a | |
| 727 // BeginNavigation IPC, and will then proceed in the same renderer that sent | |
| 728 // the IPC due to the condition below. Once there is support for cross-process | |
|
clamy
2015/03/06 15:57:50
I prefer leaving the former TODO here.
carlosk
2015/03/06 16:34:08
Done.
| |
| 729 // scripting check for non-browser-initiated navigations should be removed | |
| 724 // (see crbug.com/440266). | 730 // (see crbug.com/440266). |
| 725 if (current_site_instance == dest_site_instance.get() || | 731 if (current_site_instance == dest_site_instance.get() || |
| 732 !request.browser_initiated() || | |
| 726 (!frame_tree_node_->IsMainFrame() && | 733 (!frame_tree_node_->IsMainFrame() && |
| 727 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 734 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 728 switches::kSitePerProcess))) { | 735 switches::kSitePerProcess))) { |
| 729 // Reuse the current RFH if its SiteInstance matches the the navigation's | 736 // Reuse the current RFH if its SiteInstance matches the the navigation's |
| 730 // or if this is a subframe navigation. We only swap RFHs for subframes when | 737 // or if this is a subframe navigation. We only swap RFHs for subframes when |
| 731 // --site-per-process is enabled. | 738 // --site-per-process is enabled. |
| 732 CleanUpNavigation(); | 739 CleanUpNavigation(); |
| 733 navigation_rfh = render_frame_host_.get(); | 740 navigation_rfh = render_frame_host_.get(); |
| 734 | 741 |
| 735 // As SiteInstances are the same, check if the WebUI should be reused. | 742 // As SiteInstances are the same, check if the WebUI should be reused. |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1962 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1969 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 1963 SiteInstance* instance) { | 1970 SiteInstance* instance) { |
| 1964 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1971 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 1965 if (iter != proxy_hosts_.end()) { | 1972 if (iter != proxy_hosts_.end()) { |
| 1966 delete iter->second; | 1973 delete iter->second; |
| 1967 proxy_hosts_.erase(iter); | 1974 proxy_hosts_.erase(iter); |
| 1968 } | 1975 } |
| 1969 } | 1976 } |
| 1970 | 1977 |
| 1971 } // namespace content | 1978 } // namespace content |
| OLD | NEW |