diff options
author | scshunt@google.com <scshunt@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-25 18:26:33 +0000 |
---|---|---|
committer | scshunt@google.com <scshunt@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-25 18:26:33 +0000 |
commit | 3e324142a9d9a10f3c4b7ceceed97c1b5006f61a (patch) | |
tree | cbc81c16de44fa5f9b2ba2ce432f421953b2772d /chrome | |
parent | 1df8df8f6b7c8b28fd564644362b8a45fd625cb0 (diff) | |
download | chromium_src-3e324142a9d9a10f3c4b7ceceed97c1b5006f61a.zip chromium_src-3e324142a9d9a10f3c4b7ceceed97c1b5006f61a.tar.gz chromium_src-3e324142a9d9a10f3c4b7ceceed97c1b5006f61a.tar.bz2 |
All visibility change functions (WasRestored/ShowContents/DidBecomeSelected and WasHidden/HideConents) are renamed to WasRestored and WasHidden for consistency. In particular, WebContents had all three of the first variety; this change merges them together.
BUG=133878
TEST=manual
Review URL: https://chromiumcodereview.appspot.com/10634011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/instant/instant_loader.cc | 6 | ||||
-rw-r--r-- | chrome/browser/prerender/prerender_contents.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/browser.cc | 12 | ||||
-rw-r--r-- | chrome/browser/ui/browser_navigator.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/browser_window_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/tab_contents_container_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/tab_contents/core_tab_helper.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/tab_contents/core_tab_helper.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/tabs/tab_strip_model.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/tabs/tab_strip_model_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_view.cc | 5 |
12 files changed, 21 insertions, 23 deletions
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 402e8d2..4c6f1ee 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -1140,7 +1140,9 @@ void InstantLoader::CreatePreviewContents(TabContents* tab_contents) { preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); SetupPreviewContents(tab_contents); - preview_contents_->web_contents()->ShowContents(); + // TODO(beng): investigate if we can avoid this and instead rely on the + // visibility of the WebContentsView + preview_contents_->web_contents()->WasRestored(); } void InstantLoader::LoadInstantURL(const TemplateURL* template_url, @@ -1169,7 +1171,7 @@ void InstantLoader::LoadInstantURL(const TemplateURL* template_url, transition_type, false, std::string(), override_user_agent); RenderViewHost* host = preview_contents_->web_contents()->GetRenderViewHost(); - preview_contents_->web_contents()->HideContents(); + preview_contents_->web_contents()->WasHidden(); // If user_text is empty, this must be a preload of the search homepage. In // that case, send down a SearchBoxResize message, which will switch the page diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index 2a53f62..2e4763c 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -463,7 +463,7 @@ void PrerenderContents::Observe(int type, // size, is also sets itself to be visible, which would then break the // visibility API. new_render_view_host->WasResized(); - prerender_contents_->web_contents()->HideContents(); + prerender_contents_->web_contents()->WasHidden(); } break; } diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 97c4de8..0992beb 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -953,7 +953,7 @@ WebContents* Browser::AddRestoredTab( // layout with proper view dimensions. TabStripModel::AddTabContents() // contains similar logic. new_tab->GetView()->SizeContents(window_->GetRestoredBounds().size()); - new_tab->HideContents(); + new_tab->WasHidden(); } SessionService* session_service = SessionServiceFactory::GetForProfileIfExisting(profile_); @@ -3572,16 +3572,18 @@ void Browser::OnStateChanged() { void Browser::ShowInstant(TabContents* preview_contents) { window_->ShowInstant(preview_contents); - GetActiveWebContents()->HideContents(); - preview_contents->web_contents()->ShowContents(); + // TODO(beng): investigate if we can avoid this and instead rely on the + // visibility of the WebContentsView + GetActiveWebContents()->WasHidden(); + preview_contents->web_contents()->WasRestored(); } void Browser::HideInstant() { window_->HideInstant(); if (GetActiveWebContents()) - GetActiveWebContents()->ShowContents(); + GetActiveWebContents()->WasRestored(); if (instant_->GetPreviewContents()) - instant_->GetPreviewContents()->web_contents()->HideContents(); + instant_->GetPreviewContents()->web_contents()->WasHidden(); } void Browser::CommitInstant(TabContents* preview_contents) { diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 4fc681f..acfd111 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -519,7 +519,7 @@ void Navigate(NavigateParams* params) { // By default, content believes it is not hidden. When adding contents // in the background, tell it that it's hidden. if ((params->tabstrip_add_types & TabStripModel::ADD_ACTIVE) == 0) { - // TabStripModel::AddTabContents invokes HideContents if not foreground. + // TabStripModel::AddTabContents invokes WasHidden if not foreground. params->target_contents->web_contents()->WasHidden(); } } else { diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index d19bbdf..2cf2138 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -1262,7 +1262,7 @@ private: [self swapInTabAtIndex:modelIndex]; if (newContents) { - newContents->web_contents()->DidBecomeSelected(); + newContents->web_contents()->WasRestored(); newContents->web_contents()->GetView()->RestoreFocus(); if (newContents->find_tab_helper()->find_ui_active()) diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 335c52e..677da9e2 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1345,7 +1345,6 @@ void BrowserWindowGtk::ActiveTabChanged(TabContents* old_contents, infobar_container_->ChangeTabContents(new_contents->infobar_tab_helper()); contents_container_->SetTab(new_contents); - new_contents->web_contents()->DidBecomeSelected(); // TODO(estade): after we manage browser activation, add a check to make sure // we are the active browser before calling RestoreFocus(). if (!browser_->tab_strip_model()->closing_all()) { @@ -1445,7 +1444,7 @@ void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) { // anything other than user selecting a Tab. // See TabContentsViewViews::OnWindowPosChanged for reference on how it // should be implemented. - devtools_contents->web_contents()->ShowContents(); + devtools_contents->web_contents()->WasRestored(); } bool should_show = old_devtools == NULL && devtools_contents != NULL; diff --git a/chrome/browser/ui/gtk/tab_contents_container_gtk.cc b/chrome/browser/ui/gtk/tab_contents_container_gtk.cc index 8e6c1b7..58b4872 100644 --- a/chrome/browser/ui/gtk/tab_contents_container_gtk.cc +++ b/chrome/browser/ui/gtk/tab_contents_container_gtk.cc @@ -146,7 +146,7 @@ void TabContentsContainerGtk::PackTab(TabContents* tab) { gdk_window_lower(content_gdk_window); } - tab->web_contents()->ShowContents(); + tab->web_contents()->WasRestored(); } void TabContentsContainerGtk::HideTab(TabContents* tab) { diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc index 6f8c9e14..531f36c 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper.cc +++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc @@ -79,7 +79,7 @@ string16 CoreTabHelper::GetStatusText() const { //////////////////////////////////////////////////////////////////////////////// // WebContentsObserver overrides -void CoreTabHelper::DidBecomeSelected() { +void CoreTabHelper::WasRestored() { WebCacheManager::GetInstance()->ObserveActivity( web_contents()->GetRenderProcessHost()->GetID()); } diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.h b/chrome/browser/ui/tab_contents/core_tab_helper.h index b6d6366..5b205a7 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper.h +++ b/chrome/browser/ui/tab_contents/core_tab_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,7 +27,7 @@ class CoreTabHelper : public content::WebContentsObserver { private: // content::WebContentsObserver overrides: - virtual void DidBecomeSelected() OVERRIDE; + virtual void WasRestored() OVERRIDE; // Delegate for notifying our owner about stuff. Not owned by us. CoreTabHelperDelegate* delegate_; diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc index a4c434a..4db7864 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.cc +++ b/chrome/browser/ui/tabs/tab_strip_model.cc @@ -728,7 +728,7 @@ void TabStripModel::AddTabContents(TabContents* contents, // We need to hide the contents or else we get and execute paints for // background tabs. With enough background tabs they will steal the // backing store of the visible tab causing flashing. See bug 20831. - contents->web_contents()->HideContents(); + contents->web_contents()->WasHidden(); } } } diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index 4ab5b5e..df9d116 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc @@ -152,7 +152,7 @@ class TabStripModelTest : public ChromeRenderViewHostTestHarness { } void SwitchTabTo(WebContents* contents) { - // contents()->DidBecomeSelected(); + // contents()->WasRestored(); } // Sets the id of the specified contents. diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 313d9cc..3ad865d 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -2409,11 +2409,6 @@ void BrowserView::ProcessTabSelected(TabContents* new_contents) { } UpdateDevToolsForContents(new_contents); - // TODO(beng): This should be called automatically by ChangeWebContents, but I - // am striving for parity now rather than cleanliness. This is - // required to make features like Duplicate Tab, Undo Close Tab, - // etc not result in sad tab. - new_contents->web_contents()->DidBecomeSelected(); if (!browser_->tab_strip_model()->closing_all() && GetWidget()->IsActive() && GetWidget()->IsVisible()) { // We only restore focus if our window is visible, to avoid invoking blur |