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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1418853003: Remove RFHM::GetNavigatingWebUI() and RFHM::web_ui(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webui-refactor
Patch Set: Addressed nits. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index c3c2aad3378e3ba04a4d01c9abf1e6002e836cad..166da11eefa667499fb61c432713f0b4af81a250 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -846,13 +846,24 @@ WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url,
}
WebUI* WebContentsImpl::GetWebUI() const {
- return GetRenderManager()->web_ui()
- ? GetRenderManager()->web_ui()
- : GetRenderManager()->GetNavigatingWebUI();
+ if (GetCommittedWebUI())
+ return GetCommittedWebUI();
+
+ RenderFrameHostImpl* upcoming_frame_host = nullptr;
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation)) {
+ upcoming_frame_host = GetRenderManager()->speculative_frame_host();
+ } else {
+ upcoming_frame_host = GetRenderManager()->pending_frame_host();
+ }
+ if (upcoming_frame_host)
+ return upcoming_frame_host->web_ui();
+
+ return nullptr;
}
WebUI* WebContentsImpl::GetCommittedWebUI() const {
- return GetRenderManager()->web_ui();
+ return frame_tree_.root()->current_frame_host()->web_ui();
}
void WebContentsImpl::SetUserAgentOverride(const std::string& override) {
@@ -919,9 +930,18 @@ const base::string16& WebContentsImpl::GetTitle() const {
if (entry) {
return entry->GetTitleForDisplay(accept_languages);
}
- WebUI* our_web_ui = GetRenderManager()->GetNavigatingWebUI()
- ? GetRenderManager()->GetNavigatingWebUI()
- : GetRenderManager()->web_ui();
+
+ RenderFrameHostImpl* upcoming_frame_host = nullptr;
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation)) {
+ upcoming_frame_host = GetRenderManager()->speculative_frame_host();
+ } else {
+ upcoming_frame_host = GetRenderManager()->pending_frame_host();
+ }
+ WebUI* our_web_ui = upcoming_frame_host
+ ? upcoming_frame_host->web_ui()
+ : GetRenderManager()->current_frame_host()->web_ui();
+
if (our_web_ui) {
// Don't override the title in view source mode.
entry = controller_.GetVisibleEntry();
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698