Commit 76d2a787 authored by Lucas Furukawa Gadani's avatar Lucas Furukawa Gadani Committed by Commit Bot

Remove usages of WebContents::GetRenderViewHost().

This CL was uploaded by git cl split.

R=tapted@chromium.org

Bug: 1142671
Change-Id: I28c30536bc396847389eb4a3ad7b6c3f6d93529d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500560
Auto-Submit: Lucas Gadani <lfg@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821063}
parent f8a1c7e7
...@@ -291,7 +291,8 @@ class RenderViewSizeObserver : public content::WebContentsObserver { ...@@ -291,7 +291,8 @@ class RenderViewSizeObserver : public content::WebContentsObserver {
// WebContentsDelegate::DidNavigateMainFramePostCommit is called. // WebContentsDelegate::DidNavigateMainFramePostCommit is called.
void NavigationEntryCommitted( void NavigationEntryCommitted(
const content::LoadCommittedDetails& details) override { const content::LoadCommittedDetails& details) override {
content::RenderViewHost* rvh = web_contents()->GetRenderViewHost(); content::RenderViewHost* rvh =
web_contents()->GetMainFrame()->GetRenderViewHost();
render_view_sizes_[rvh].rwhv_commit_size = render_view_sizes_[rvh].rwhv_commit_size =
web_contents()->GetRenderWidgetHostView()->GetViewBounds().size(); web_contents()->GetRenderWidgetHostView()->GetViewBounds().size();
render_view_sizes_[rvh].wcv_commit_size = render_view_sizes_[rvh].wcv_commit_size =
...@@ -2483,7 +2484,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) { ...@@ -2483,7 +2484,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) {
ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state());
WebContents* web_contents = WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
content::RenderViewHost* prev_rvh = web_contents->GetRenderViewHost(); content::RenderViewHost* prev_rvh =
web_contents->GetMainFrame()->GetRenderViewHost();
const gfx::Size initial_wcv_size = web_contents->GetContainerBounds().size(); const gfx::Size initial_wcv_size = web_contents->GetContainerBounds().size();
RenderViewSizeObserver observer(web_contents, browser()->window()); RenderViewSizeObserver observer(web_contents, browser()->window());
...@@ -2492,12 +2494,12 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) { ...@@ -2492,12 +2494,12 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) {
embedded_test_server()->GetURL("/title1.html")); embedded_test_server()->GetURL("/title1.html"));
ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state());
// A new RenderViewHost should be created. // A new RenderViewHost should be created.
EXPECT_NE(prev_rvh, web_contents->GetRenderViewHost()); EXPECT_NE(prev_rvh, web_contents->GetMainFrame()->GetRenderViewHost());
prev_rvh = web_contents->GetRenderViewHost(); prev_rvh = web_contents->GetMainFrame()->GetRenderViewHost();
gfx::Size rwhv_create_size0, rwhv_commit_size0, wcv_commit_size0; gfx::Size rwhv_create_size0, rwhv_commit_size0, wcv_commit_size0;
observer.GetSizeForRenderViewHost(web_contents->GetRenderViewHost(), observer.GetSizeForRenderViewHost(
&rwhv_create_size0, &rwhv_commit_size0, web_contents->GetMainFrame()->GetRenderViewHost(), &rwhv_create_size0,
&wcv_commit_size0); &rwhv_commit_size0, &wcv_commit_size0);
EXPECT_EQ(gfx::Size(initial_wcv_size.width(), initial_wcv_size.height()), EXPECT_EQ(gfx::Size(initial_wcv_size.width(), initial_wcv_size.height()),
rwhv_create_size0); rwhv_create_size0);
// When a navigation entry is committed, the size of RenderWidgetHostView // When a navigation entry is committed, the size of RenderWidgetHostView
...@@ -2526,11 +2528,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) { ...@@ -2526,11 +2528,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) {
https_test_server.GetURL("/title2.html")); https_test_server.GetURL("/title2.html"));
ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state());
// A new RenderVieHost should be created. // A new RenderVieHost should be created.
EXPECT_NE(prev_rvh, web_contents->GetRenderViewHost()); EXPECT_NE(prev_rvh, web_contents->GetMainFrame()->GetRenderViewHost());
gfx::Size rwhv_create_size1, rwhv_commit_size1, wcv_commit_size1; gfx::Size rwhv_create_size1, rwhv_commit_size1, wcv_commit_size1;
observer.GetSizeForRenderViewHost(web_contents->GetRenderViewHost(), observer.GetSizeForRenderViewHost(
&rwhv_create_size1, &rwhv_commit_size1, web_contents->GetMainFrame()->GetRenderViewHost(), &rwhv_create_size1,
&wcv_commit_size1); &rwhv_commit_size1, &wcv_commit_size1);
EXPECT_EQ(rwhv_create_size1, rwhv_commit_size1); EXPECT_EQ(rwhv_create_size1, rwhv_commit_size1);
EXPECT_EQ(rwhv_commit_size1, EXPECT_EQ(rwhv_commit_size1,
web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
...@@ -2545,9 +2547,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) { ...@@ -2545,9 +2547,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) {
embedded_test_server()->GetURL("/title2.html")); embedded_test_server()->GetURL("/title2.html"));
ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state());
gfx::Size rwhv_create_size2, rwhv_commit_size2, wcv_commit_size2; gfx::Size rwhv_create_size2, rwhv_commit_size2, wcv_commit_size2;
observer.GetSizeForRenderViewHost(web_contents->GetRenderViewHost(), observer.GetSizeForRenderViewHost(
&rwhv_create_size2, &rwhv_commit_size2, web_contents->GetMainFrame()->GetRenderViewHost(), &rwhv_create_size2,
&wcv_commit_size2); &rwhv_commit_size2, &wcv_commit_size2);
// The behavior on OSX and Views is incorrect in this edge case, but they are // The behavior on OSX and Views is incorrect in this edge case, but they are
// differently incorrect. // differently incorrect.
......
...@@ -401,8 +401,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { ...@@ -401,8 +401,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) {
chrome::FocusLocationBar(browser()); chrome::FocusLocationBar(browser());
WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_NO_FATAL_FAILURE(TestFocusTraversal(tab->GetRenderViewHost(), false)); EXPECT_NO_FATAL_FAILURE(
EXPECT_NO_FATAL_FAILURE(TestFocusTraversal(tab->GetRenderViewHost(), true)); TestFocusTraversal(tab->GetMainFrame()->GetRenderViewHost(), false));
EXPECT_NO_FATAL_FAILURE(
TestFocusTraversal(tab->GetMainFrame()->GetRenderViewHost(), true));
} }
// Test that find-in-page UI can request focus, even when it is already open. // Test that find-in-page UI can request focus, even when it is already open.
......
...@@ -1821,7 +1821,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, MAYBE_ReuseRVHWithWebUI) { ...@@ -1821,7 +1821,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, MAYBE_ReuseRVHWithWebUI) {
WebContents* popup = controller->GetWebContents(); WebContents* popup = controller->GetWebContents();
ASSERT_TRUE(popup); ASSERT_TRUE(popup);
EXPECT_EQ(2, browser()->tab_strip_model()->count()); EXPECT_EQ(2, browser()->tab_strip_model()->count());
content::RenderViewHost* webui_rvh = popup->GetRenderViewHost(); content::RenderViewHost* webui_rvh =
popup->GetMainFrame()->GetRenderViewHost();
content::RenderFrameHost* webui_rfh = popup->GetMainFrame(); content::RenderFrameHost* webui_rfh = popup->GetMainFrame();
EXPECT_TRUE(content::BINDINGS_POLICY_MOJO_WEB_UI & EXPECT_TRUE(content::BINDINGS_POLICY_MOJO_WEB_UI &
webui_rfh->GetEnabledBindings()); webui_rfh->GetEnabledBindings());
...@@ -1829,14 +1830,14 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, MAYBE_ReuseRVHWithWebUI) { ...@@ -1829,14 +1830,14 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, MAYBE_ReuseRVHWithWebUI) {
// Navigate to another page in the popup. // Navigate to another page in the popup.
GURL nonwebui_url(embedded_test_server()->GetURL("a.com", "/title1.html")); GURL nonwebui_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
ui_test_utils::NavigateToURL(browser(), nonwebui_url); ui_test_utils::NavigateToURL(browser(), nonwebui_url);
EXPECT_NE(webui_rvh, popup->GetRenderViewHost()); EXPECT_NE(webui_rvh, popup->GetMainFrame()->GetRenderViewHost());
// Go back in the popup. This should finish without crashing and should // Go back in the popup. This should finish without crashing and should
// reuse the old RenderViewHost. // reuse the old RenderViewHost.
content::TestNavigationObserver back_load_observer(popup); content::TestNavigationObserver back_load_observer(popup);
controller->GoBack(); controller->GoBack();
back_load_observer.Wait(); back_load_observer.Wait();
EXPECT_EQ(webui_rvh, popup->GetRenderViewHost()); EXPECT_EQ(webui_rvh, popup->GetMainFrame()->GetRenderViewHost());
EXPECT_TRUE(webui_rvh->IsRenderViewLive()); EXPECT_TRUE(webui_rvh->IsRenderViewLive());
EXPECT_TRUE(content::BINDINGS_POLICY_MOJO_WEB_UI & EXPECT_TRUE(content::BINDINGS_POLICY_MOJO_WEB_UI &
webui_rvh->GetMainFrame()->GetEnabledBindings()); webui_rvh->GetMainFrame()->GetEnabledBindings());
......
...@@ -62,14 +62,14 @@ class FullscreenControllerInteractiveTest : public ExclusiveAccessTest { ...@@ -62,14 +62,14 @@ class FullscreenControllerInteractiveTest : public ExclusiveAccessTest {
bool IsMouseLocked() { bool IsMouseLocked() {
// Verify that IsMouseLocked is consistent between the // Verify that IsMouseLocked is consistent between the
// Fullscreen Controller and the Render View Host View. // Fullscreen Controller and the Render View Host View.
EXPECT_TRUE(browser()->IsMouseLocked() == EXPECT_TRUE(browser()->IsMouseLocked() == browser()
browser() ->tab_strip_model()
->tab_strip_model() ->GetActiveWebContents()
->GetActiveWebContents() ->GetMainFrame()
->GetRenderViewHost() ->GetRenderViewHost()
->GetWidget() ->GetWidget()
->GetView() ->GetView()
->IsMouseLocked()); ->IsMouseLocked());
return browser()->IsMouseLocked(); return browser()->IsMouseLocked();
} }
......
...@@ -155,7 +155,8 @@ void MouseLockController::UnlockMouse() { ...@@ -155,7 +155,8 @@ void MouseLockController::UnlockMouse() {
return; return;
content::RenderWidgetHostView* mouse_lock_view = nullptr; content::RenderWidgetHostView* mouse_lock_view = nullptr;
RenderViewHost* const rvh = exclusive_access_tab()->GetRenderViewHost(); RenderViewHost* const rvh =
exclusive_access_tab()->GetMainFrame()->GetRenderViewHost();
if (rvh) if (rvh)
mouse_lock_view = rvh->GetWidget()->GetView(); mouse_lock_view = rvh->GetWidget()->GetView();
......
...@@ -323,7 +323,7 @@ void UnloadController::ProcessPendingTabs(bool skip_beforeunload) { ...@@ -323,7 +323,7 @@ void UnloadController::ProcessPendingTabs(bool skip_beforeunload) {
*(tabs_needing_before_unload_fired_.begin()); *(tabs_needing_before_unload_fired_.begin());
// Null check render_view_host here as this gets called on a PostTask and // Null check render_view_host here as this gets called on a PostTask and
// the tab's render_view_host may have been nulled out. // the tab's render_view_host may have been nulled out.
if (web_contents->GetRenderViewHost()) { if (web_contents->GetMainFrame()->GetRenderViewHost()) {
// If there's a devtools window attached to |web_contents|, // If there's a devtools window attached to |web_contents|,
// we would like devtools to call its own beforeunload handlers first, // we would like devtools to call its own beforeunload handlers first,
// and then call beforeunload handlers for |web_contents|. // and then call beforeunload handlers for |web_contents|.
...@@ -354,7 +354,7 @@ void UnloadController::ProcessPendingTabs(bool skip_beforeunload) { ...@@ -354,7 +354,7 @@ void UnloadController::ProcessPendingTabs(bool skip_beforeunload) {
content::WebContents* web_contents = *(tabs_needing_unload_fired_.begin()); content::WebContents* web_contents = *(tabs_needing_unload_fired_.begin());
// Null check render_view_host here as this gets called on a PostTask and // Null check render_view_host here as this gets called on a PostTask and
// the tab's render_view_host may have been nulled out. // the tab's render_view_host may have been nulled out.
if (web_contents->GetRenderViewHost()) { if (web_contents->GetMainFrame()->GetRenderViewHost()) {
web_contents->ClosePage(); web_contents->ClosePage();
} else { } else {
ClearUnloadState(web_contents, true); ClearUnloadState(web_contents, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment