diff options
| author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 22:52:01 +0000 |
|---|---|---|
| committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 22:52:01 +0000 |
| commit | 4ebab8ee9d11bbb026f08697c0c55a494569e0bf (patch) | |
| tree | 5dbb4aeabe22d31772cc468638e17ca1da535a1c /chrome | |
| parent | ffb687b9ba11d7fca37fa5740b135ff1bc5a650a (diff) | |
| download | chromium_src-4ebab8ee9d11bbb026f08697c0c55a494569e0bf.zip chromium_src-4ebab8ee9d11bbb026f08697c0c55a494569e0bf.tar.gz chromium_src-4ebab8ee9d11bbb026f08697c0c55a494569e0bf.tar.bz2 | |
TabContentsWrapper -> TabContents, part 53.
browser/ui
BUG=131026
TEST=no change
Review URL: https://chromiumcodereview.appspot.com/10546106
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141542 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
33 files changed, 207 insertions, 223 deletions
diff --git a/chrome/browser/ui/auto_login_info_bar_delegate.cc b/chrome/browser/ui/auto_login_info_bar_delegate.cc index 05cb604..a631bef 100644 --- a/chrome/browser/ui/auto_login_info_bar_delegate.cc +++ b/chrome/browser/ui/auto_login_info_bar_delegate.cc @@ -16,7 +16,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/ubertoken_fetcher.h" #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" @@ -189,9 +189,8 @@ bool AutoLoginInfoBarDelegate::Accept() { } bool AutoLoginInfoBarDelegate::Cancel() { - PrefService* pref_service = - TabContentsWrapper::GetCurrentWrapperForContents( - owner()->web_contents())->profile()->GetPrefs(); + PrefService* pref_service = TabContents::FromWebContents( + owner()->web_contents())->profile()->GetPrefs(); pref_service->SetBoolean(prefs::kAutologinEnabled, false); RecordHistogramAction(HISTOGRAM_REJECTED); button_pressed_ = true; diff --git a/chrome/browser/ui/auto_login_prompter.cc b/chrome/browser/ui/auto_login_prompter.cc index be460f8..267154b 100644 --- a/chrome/browser/ui/auto_login_prompter.cc +++ b/chrome/browser/ui/auto_login_prompter.cc @@ -20,7 +20,7 @@ #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/ui/auto_login_info_bar_delegate.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" @@ -153,11 +153,10 @@ void AutoLoginPrompter::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == content::NOTIFICATION_LOAD_STOP) { - TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(web_contents_); - // |wrapper| is NULL for WebContents hosted in WebDialog. - if (wrapper) { - InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); + TabContents* tab_contents = TabContents::FromWebContents(web_contents_); + // |tab_contents| is NULL for WebContents hosted in WebDialog. + if (tab_contents) { + InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); infobar_helper->AddInfoBar(new AutoLoginInfoBarDelegate(infobar_helper, username_, args_)); diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index f2e63e0..bd71a5f 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -35,7 +35,7 @@ #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/browser/ui/startup/startup_browser_creator.h" #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/pinned_tab_codec.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_notification_types.h" @@ -128,7 +128,7 @@ class MockTabStripModelObserver : public TabStripModelObserver { MockTabStripModelObserver() : closing_count_(0) {} virtual void TabClosingAt(TabStripModel* tab_strip_model, - TabContentsWrapper* contents, + TabContents* contents, int index) { closing_count_++; } @@ -315,10 +315,10 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { browser()->Reload(CURRENT_TAB); AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); alert->CloseModalDialog(); - EXPECT_FALSE(browser()->GetSelectedWebContents()->IsLoading()); + EXPECT_FALSE(browser()->GetActiveWebContents()->IsLoading()); // Clear the beforeunload handler so the test can easily exit. - browser()->GetSelectedWebContents()->GetRenderViewHost()-> + browser()->GetActiveWebContents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("onbeforeunload=null;")); } @@ -343,7 +343,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) { // Cancel the dialog. AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); alert->CloseModalDialog(); - EXPECT_FALSE(browser()->GetSelectedWebContents()->IsLoading()); + EXPECT_FALSE(browser()->GetActiveWebContents()->IsLoading()); // Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for // the pending RVH to be destroyed. @@ -351,7 +351,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) { EXPECT_EQ(url.spec(), UTF16ToUTF8(browser()->toolbar_model()->GetText())); // Clear the beforeunload handler so the test can easily exit. - browser()->GetSelectedWebContents()->GetRenderViewHost()-> + browser()->GetActiveWebContents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("onbeforeunload=null;")); } @@ -368,7 +368,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) { // Test for crbug.com/11647. A page closed with window.close() should not have // two beforeunload dialogs shown. IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_SingleBeforeUnloadAfterWindowClose) { - browser()->GetSelectedWebContents()->GetRenderViewHost()-> + browser()->GetActiveWebContents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(kOpenNewBeforeUnloadPage)); @@ -441,7 +441,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); - WebContents* oldtab = browser()->GetSelectedWebContents(); + WebContents* oldtab = browser()->GetActiveWebContents(); content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); // Now open a tab to a blank page, set its opener to null, and redirect it @@ -464,7 +464,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { // Wait for popup window to appear and finish navigating. popup_observer.Wait(); ASSERT_EQ(2, browser()->tab_count()); - WebContents* newtab = browser()->GetSelectedWebContents(); + WebContents* newtab = browser()->GetActiveWebContents(); EXPECT_TRUE(newtab); EXPECT_NE(oldtab, newtab); nav_observer.Wait(); @@ -498,7 +498,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { // Wait for popup window to appear and finish navigating. popup_observer2.Wait(); ASSERT_EQ(3, browser()->tab_count()); - WebContents* newtab2 = browser()->GetSelectedWebContents(); + WebContents* newtab2 = browser()->GetActiveWebContents(); EXPECT_TRUE(newtab2); EXPECT_NE(oldtab, newtab2); nav_observer2.Wait(); @@ -530,7 +530,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); - WebContents* oldtab = browser()->GetSelectedWebContents(); + WebContents* oldtab = browser()->GetActiveWebContents(); content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); // Now open a tab to a blank page, set its opener to null, and redirect it @@ -552,7 +552,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { // Wait for popup window to appear and finish navigating. popup_observer.Wait(); ASSERT_EQ(2, browser()->tab_count()); - WebContents* newtab = browser()->GetSelectedWebContents(); + WebContents* newtab = browser()->GetActiveWebContents(); EXPECT_TRUE(newtab); EXPECT_NE(oldtab, newtab); nav_observer.Wait(); @@ -736,7 +736,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ui_test_utils::NavigateToURL(browser(), url); - NavigationEntry* entry = browser()->GetSelectedWebContents()-> + NavigationEntry* entry = browser()->GetActiveWebContents()-> GetController().GetActiveEntry(); EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec()); } @@ -756,7 +756,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_FaviconChange) { ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); ui_test_utils::NavigateToURL(browser(), file_url); - NavigationEntry* entry = browser()->GetSelectedWebContents()-> + NavigationEntry* entry = browser()->GetActiveWebContents()-> GetController().GetActiveEntry(); static const FilePath::CharType* kIcon = FILE_PATH_LITERAL("test1.png"); @@ -780,7 +780,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, TabClosingWhenRemovingExtension) { ui_test_utils::NavigateToURL(browser(), url); - TabContentsWrapper* app_contents = + TabContents* app_contents = Browser::TabContentsFactory(browser()->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); app_contents->extension_tab_helper()->SetExtensionApp(extension_app); @@ -854,10 +854,10 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), content::PAGE_TRANSITION_TYPED); - WebContents* current_tab = browser()->GetSelectedWebContents(); - TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); - TranslateTabHelper* helper = wrapper->translate_tab_helper(); - content::Source<WebContents> source(current_tab); + WebContents* current_web_contents = browser()->GetActiveWebContents(); + TabContents* current_tab_contents = browser()->GetActiveTabContents(); + TranslateTabHelper* helper = current_tab_contents->translate_tab_helper(); + content::Source<WebContents> source(current_web_contents); ui_test_utils::WindowedNotificationObserverWithDetails<std::string> en_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, @@ -901,7 +901,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) { ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); const Extension* extension_app = GetExtension(); ui_test_utils::NavigateToURL(browser(), url); - TabContentsWrapper* app_contents = + TabContents* app_contents = Browser::TabContentsFactory(browser()->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); app_contents->extension_tab_helper()->SetExtensionApp(extension_app); @@ -1003,9 +1003,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { // Apps launched in a window from the NTP do not have extension_app set in // tab contents. - TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(app_window); - EXPECT_FALSE(wrapper->extension_tab_helper()->extension_app()); + TabContents* tab_contents = TabContents::FromWebContents(app_window); + EXPECT_FALSE(tab_contents->extension_tab_helper()->extension_app()); EXPECT_EQ(extension_app->GetFullLaunchURL(), app_window->GetURL()); // The launch should have created a new browser. @@ -1077,7 +1076,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { ui_test_utils::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedWebContents()->GetController())); + &browser()->GetActiveWebContents()->GetController())); browser()->GoBack(CURRENT_TAB); back_nav_load_observer.Wait(); EXPECT_TRUE(browser()->command_updater()->IsCommandEnabled(IDC_FORWARD)); @@ -1085,7 +1084,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedWebContents()->GetController())); + &browser()->GetActiveWebContents()->GetController())); browser()->GoForward(CURRENT_TAB); // This check will happen before the navigation completes, since the browser // won't process the renderer's response until the Wait() call below. @@ -1213,7 +1212,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, } IN_PROC_BROWSER_TEST_F(BrowserTest, PageZoom) { - WebContents* contents = browser()->GetSelectedWebContents(); + WebContents* contents = browser()->GetActiveWebContents(); bool enable_plus, enable_minus; ui_test_utils::WindowedNotificationObserver zoom_in_observer( @@ -1258,7 +1257,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) { EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU)); - WebContents* contents = browser()->GetSelectedWebContents(); + WebContents* contents = browser()->GetActiveWebContents(); TestInterstitialPage* interstitial = new TestInterstitialPage( contents, false, GURL()); @@ -1316,7 +1315,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, UserGesturesReported) { // Regression test for http://crbug.com/110707. Also tests that a user // gesture is sent when a normal navigation (via e.g. the omnibox) is // performed. - WebContents* web_contents = browser()->GetSelectedWebContents(); + WebContents* web_contents = browser()->GetActiveWebContents(); MockWebContentsObserver mock_observer(web_contents); ASSERT_TRUE(test_server()->Start()); @@ -1423,7 +1422,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, WindowOpenClose) { string16 title = ASCIIToUTF16("Title Of Awesomeness"); ui_test_utils::TitleWatcher title_watcher( - browser()->GetSelectedWebContents(), title); + browser()->GetActiveWebContents(), title); ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2); EXPECT_EQ(title, title_watcher.WaitAndGetTitle()); } @@ -1445,7 +1444,7 @@ IN_PROC_BROWSER_TEST_F(ShowModalDialogTest, BasicTest) { string16 expected_title(ASCIIToUTF16("SUCCESS")); ui_test_utils::TitleWatcher title_watcher( - browser()->GetSelectedWebContents(), expected_title); + browser()->GetActiveWebContents(), expected_title); ui_test_utils::NavigateToURL(browser(), url); // Verify that we set a mark on successful dialog show. @@ -1458,7 +1457,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DisallowFileUrlUniversalAccessTest) { string16 expected_title(ASCIIToUTF16("Disallowed")); ui_test_utils::TitleWatcher title_watcher( - browser()->GetSelectedWebContents(), expected_title); + browser()->GetActiveWebContents(), expected_title); title_watcher.AlsoWaitForTitle(ASCIIToUTF16("Allowed")); ui_test_utils::NavigateToURL(browser(), url); ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); diff --git a/chrome/browser/ui/browser_close_browsertest.cc b/chrome/browser/ui/browser_close_browsertest.cc index cbbf3ce..9a93bcd 100644 --- a/chrome/browser/ui/browser_close_browsertest.cc +++ b/chrome/browser/ui/browser_close_browsertest.cc @@ -173,7 +173,7 @@ class BrowserCloseTest : public InProcessBrowserTest { new_browser->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_START_PAGE); ui_test_utils::WaitForLoadStop( - new_browser->GetSelectedWebContents()); + new_browser->GetActiveWebContents()); new_browser->window()->Show(); return new_browser; } diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h index 9d5094c..2d61db2 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h @@ -13,7 +13,6 @@ class Browser; class Profile; class SkBitmap; class TabContents; -typedef TabContents TabContentsWrapper; class TabModalConfirmDialogDelegate; class TemplateURL; @@ -55,7 +54,7 @@ gfx::NativeWindow ShowWebDialog(gfx::NativeWindow parent, // Shows the collected cookies dialog box. void ShowCollectedCookiesDialog(gfx::NativeWindow parent_window, - TabContentsWrapper* tab_contents); + TabContents* tab_contents); // Creates the ExtensionInstalledBubble and schedules it to be shown once // the extension has loaded. |extension| is the installed extension. |browser| @@ -74,7 +73,7 @@ void HideHungRendererDialog(content::WebContents* contents); // Shows a tab-modal dialog box. void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate, - TabContentsWrapper* wrapper); + TabContents* tab_contents); } // namespace browser diff --git a/chrome/browser/ui/browser_finder.cc b/chrome/browser/ui/browser_finder.cc index 0e70521..daa8a45 100644 --- a/chrome/browser/ui/browser_finder.cc +++ b/chrome/browser/ui/browser_finder.cc @@ -7,8 +7,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "content/public/browser/navigation_controller.h" diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc index a8211e4..e15ca1e 100644 --- a/chrome/browser/ui/browser_list.cc +++ b/chrome/browser/ui/browser_list.cc @@ -16,7 +16,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index c5d93b8..1cdf54b 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -26,7 +26,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/status_bubble.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_notification_types.h" @@ -111,13 +111,13 @@ bool AdjustNavigateParamsForURL(browser::NavigateParams* params) { // |params|. This might just return the same Browser specified in |params|, or // some other if that Browser is deemed incompatible. Browser* GetBrowserForDisposition(browser::NavigateParams* params) { - // If no source TabContentsWrapper was specified, we use the selected one from + // If no source TabContents was specified, we use the selected one from // the target browser. This must happen first, before // GetBrowserForDisposition() has a chance to replace |params->browser| with // another one. if (!params->source_contents && params->browser) params->source_contents = - params->browser->GetSelectedTabContentsWrapper(); + params->browser->GetActiveTabContents(); Profile* profile = params->browser ? params->browser->profile() : params->profile; @@ -297,12 +297,12 @@ class ScopedBrowserDisplayer { DISALLOW_COPY_AND_ASSIGN(ScopedBrowserDisplayer); }; -// This class manages the lifetime of a TabContentsWrapper created by the -// Navigate() function. When Navigate() creates a TabContentsWrapper for a URL, +// This class manages the lifetime of a TabContents created by the +// Navigate() function. When Navigate() creates a TabContents for a URL, // an instance of this class takes ownership of it via TakeOwnership() until the -// TabContentsWrapper is added to a tab strip at which time ownership is +// TabContents is added to a tab strip at which time ownership is // relinquished via ReleaseOwnership(). If this object goes out of scope without -// being added to a tab strip, the created TabContentsWrapper is deleted to +// being added to a tab strip, the created TabContents is deleted to // avoid a leak and the params->target_contents field is set to NULL. class ScopedTargetContentsOwner { public: @@ -321,13 +321,13 @@ class ScopedTargetContentsOwner { } // Relinquishes ownership of |params_|' target_contents. - TabContentsWrapper* ReleaseOwnership() { + TabContents* ReleaseOwnership() { return target_contents_owner_.release(); } private: browser::NavigateParams* params_; - scoped_ptr<TabContentsWrapper> target_contents_owner_; + scoped_ptr<TabContents> target_contents_owner_; DISALLOW_COPY_AND_ASSIGN(ScopedTargetContentsOwner); }; @@ -365,7 +365,7 @@ void InitializeExtraHeaders(browser::NavigateParams* params, // If a prerendered page exists for |url|, replace the page at |target_contents| // with it. -bool SwapInPrerender(TabContentsWrapper* target_contents, const GURL& url) { +bool SwapInPrerender(TabContents* target_contents, const GURL& url) { prerender::PrerenderManager* prerender_manager = prerender::PrerenderManagerFactory::GetForProfile( target_contents->profile()); @@ -399,7 +399,7 @@ NavigateParams::NavigateParams( } NavigateParams::NavigateParams(Browser* a_browser, - TabContentsWrapper* a_target_contents) + TabContents* a_target_contents) : target_contents(a_target_contents), source_contents(NULL), disposition(CURRENT_TAB), @@ -458,7 +458,7 @@ void Navigate(NavigateParams* params) { // Make sure the Browser is shown if params call for it. ScopedBrowserDisplayer displayer(params); - // Makes sure any TabContentsWrapper created by this function is destroyed if + // Makes sure any TabContents created by this function is destroyed if // not properly added to a tab strip. ScopedTargetContentsOwner target_contents_owner(params); @@ -480,7 +480,7 @@ void Navigate(NavigateParams* params) { } // Determine if the navigation was user initiated. If it was, we need to - // inform the target TabContentsWrapper, and we may need to update the UI. + // inform the target TabContents, and we may need to update the UI. content::PageTransition base_transition = content::PageTransitionStripQualifier(params->transition); bool user_initiated = @@ -497,7 +497,7 @@ void Navigate(NavigateParams* params) { // Check if this is a singleton tab that already exists int singleton_index = GetIndexOfSingletonTab(params); - // If no target TabContentsWrapper was specified, we need to construct one if + // If no target TabContents was specified, we need to construct one if // we are supposed to target a new tab; unless it's a singleton that already // exists. if (!params->target_contents && singleton_index < 0) { @@ -642,8 +642,7 @@ int GetIndexOfSingletonTab(browser::NavigateParams* params) { int tab_count = params->browser->tab_count(); for (int i = 0; i < tab_count; ++i) { int tab_index = (start_index + i) % tab_count; - TabContentsWrapper* tab = - params->browser->GetTabContentsWrapperAt(tab_index); + TabContents* tab = params->browser->GetTabContentsAt(tab_index); url_canon::Replacements<char> replacements; if (params->ref_behavior == browser::NavigateParams::IGNORE_REF) diff --git a/chrome/browser/ui/browser_navigator.h b/chrome/browser/ui/browser_navigator.h index 305aa73..035bbf7 100644 --- a/chrome/browser/ui/browser_navigator.h +++ b/chrome/browser/ui/browser_navigator.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. @@ -18,7 +18,6 @@ class Browser; class Profile; class TabContents; -typedef TabContents TabContentsWrapper; namespace browser { @@ -36,7 +35,7 @@ namespace browser { // params.disposition = NEW_BACKGROUND_TAB; // browser::Navigate(¶ms); // -// Opens a popup TabContentsWrapper: +// Opens a popup TabContents: // browser::NavigateParams params(browser, popup_contents); // params.source_contents = source_contents; // browser::Navigate(¶ms); @@ -47,35 +46,35 @@ struct NavigateParams { NavigateParams(Browser* browser, const GURL& a_url, content::PageTransition a_transition); - NavigateParams(Browser* browser, TabContentsWrapper* a_target_contents); + NavigateParams(Browser* browser, TabContents* a_target_contents); ~NavigateParams(); // The URL/referrer to be loaded. Ignored if |target_contents| is non-NULL. GURL url; content::Referrer referrer; - // [in] A TabContentsWrapper to be navigated or inserted into the target + // [in] A TabContents to be navigated or inserted into the target // Browser's tabstrip. If NULL, |url| or the homepage will be used // instead. When non-NULL, Navigate() assumes it has already been // navigated to its intended destination and will not load any URL in it // (i.e. |url| is ignored). // Default is NULL. - // [out] The TabContentsWrapper in which the navigation occurred or that was + // [out] The TabContents in which the navigation occurred or that was // inserted. Guaranteed non-NULL except for note below: // Note: If this field is set to NULL by the caller and Navigate() creates - // a new TabContentsWrapper, this field will remain NULL and the - // TabContentsWrapper deleted if the TabContentsWrapper it created is + // a new TabContents, this field will remain NULL and the + // TabContents deleted if the TabContents it created is // not added to a TabStripModel before Navigate() returns. - TabContentsWrapper* target_contents; + TabContents* target_contents; - // [in] The TabContentsWrapper that initiated the Navigate() request if such + // [in] The TabContents that initiated the Navigate() request if such // context is necessary. Default is NULL, i.e. no context. - // [out] If NULL, this value will be set to the selected TabContentsWrapper in + // [out] If NULL, this value will be set to the selected TabContents in // the originating browser prior to the operation performed by // Navigate(). However, if the originating page is from a different // profile (e.g. an OFF_THE_RECORD page originating from a non-OTR // window), then |source_contents| is reset to NULL. - TabContentsWrapper* source_contents; + TabContents* source_contents; // The disposition requested by the navigation source. Default is // CURRENT_TAB. What follows is a set of coercions that happen to this value diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index c448b84..a4153eb 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc @@ -15,7 +15,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" @@ -78,17 +78,17 @@ Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type, return browser; } -TabContentsWrapper* BrowserNavigatorTest::CreateTabContents() { +TabContents* BrowserNavigatorTest::CreateTabContents() { return Browser::TabContentsFactory( browser()->profile(), NULL, MSG_ROUTING_NONE, - browser()->GetSelectedWebContents(), + browser()->GetActiveWebContents(), NULL); } void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { - GURL old_url = browser()->GetSelectedWebContents()->GetURL(); + GURL old_url = browser()->GetActiveWebContents()->GetURL(); browser::NavigateParams p(MakeNavigateParams()); p.disposition = disposition; browser::Navigate(&p); @@ -96,7 +96,7 @@ void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { // Nothing should have happened as a result of Navigate(); EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(old_url, browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(old_url, browser()->GetActiveWebContents()->GetURL()); } void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) { @@ -117,7 +117,7 @@ void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) { EXPECT_NE(incognito_browser, p.browser); EXPECT_EQ(browser(), p.browser); EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(url, browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(url, browser()->GetActiveWebContents()->GetURL()); } void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest( @@ -143,7 +143,7 @@ void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest( EXPECT_EQ(browser, p.browser); EXPECT_EQ(1, browser->tab_count()); EXPECT_EQ(GURL(chrome::kAboutBlankURL), - browser->GetSelectedWebContents()->GetURL()); + browser->GetActiveWebContents()->GetURL()); } void BrowserNavigatorTest::Observe( @@ -167,7 +167,7 @@ namespace { // of the Browser remains the same and the current tab bears the loaded URL. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) { ui_test_utils::NavigateToURL(browser(), GetGoogleURL()); - EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(GetGoogleURL(), browser()->GetActiveWebContents()->GetURL()); // We should have one window with one tab. EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(1, browser()->tab_count()); @@ -180,7 +180,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { // Register for a notification if an additional tab_contents was instantiated. // Opening a Singleton tab that is already opened should not be opening a new - // tab nor be creating a new TabContentsWrapper object. + // tab nor be creating a new TabContents object. content::NotificationRegistrar registrar; // As the registrar object goes out of scope, this will get unregistered @@ -288,23 +288,23 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // tab count of the Browser increases and the selected tab shifts to the new // foreground tab. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) { - WebContents* old_contents = browser()->GetSelectedWebContents(); + WebContents* old_contents = browser()->GetActiveWebContents(); browser::NavigateParams p(MakeNavigateParams()); p.disposition = NEW_FOREGROUND_TAB; browser::Navigate(&p); - EXPECT_NE(old_contents, browser()->GetSelectedWebContents()); - EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents); + EXPECT_NE(old_contents, browser()->GetActiveWebContents()); + EXPECT_EQ(browser()->GetActiveTabContents(), p.target_contents); EXPECT_EQ(2, browser()->tab_count()); } // This test verifies that when a navigation results in a background tab, the // tab count of the Browser increases but the selected tab remains the same. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewBackgroundTab) { - WebContents* old_contents = browser()->GetSelectedWebContents(); + WebContents* old_contents = browser()->GetActiveWebContents(); browser::NavigateParams p(MakeNavigateParams()); p.disposition = NEW_BACKGROUND_TAB; browser::Navigate(&p); - WebContents* new_contents = browser()->GetSelectedWebContents(); + WebContents* new_contents = browser()->GetActiveWebContents(); // The selected tab should have remained unchanged, since the new tab was // opened in the background. EXPECT_EQ(old_contents, new_contents); @@ -613,7 +613,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IgnoreAction) { RunSuppressTest(IGNORE_ACTION); } -// This tests adding a foreground tab with a predefined TabContentsWrapper. +// This tests adding a foreground tab with a predefined TabContents. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) { browser::NavigateParams p(MakeNavigateParams()); p.disposition = NEW_FOREGROUND_TAB; @@ -623,7 +623,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) { // Navigate() should have opened the contents in a new foreground in the // current Browser. EXPECT_EQ(browser(), p.browser); - EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents); + EXPECT_EQ(browser()->GetActiveTabContents(), p.target_contents); // We should have one window, with two tabs. EXPECT_EQ(1u, BrowserList::size()); @@ -631,7 +631,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) { } #if defined(OS_WIN) -// This tests adding a popup with a predefined TabContentsWrapper. +// This tests adding a popup with a predefined TabContents. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) { browser::NavigateParams p(MakeNavigateParams()); p.disposition = NEW_POPUP; @@ -647,7 +647,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) { // The web platform is weird. The window bounds specified in // |p.window_bounds| are used as follows: // - the origin is used to position the window - // - the size is used to size the TabContentsWrapper of the window. + // - the size is used to size the TabContents of the window. // As such the position of the resulting window will always match // p.window_bounds.origin(), but its size will not. We need to match // the size against the selected tab's view's container size. @@ -684,7 +684,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) { // Navigate() should have inserted a new tab at slot 0 in the tabstrip. EXPECT_EQ(browser(), p.browser); EXPECT_EQ(0, browser()->tab_strip_model()->GetIndexOfTabContents( - static_cast<const TabContentsWrapper*>(p.target_contents))); + static_cast<const TabContents*>(p.target_contents))); // We should have one window - the browser() provided by the framework. EXPECT_EQ(1u, BrowserList::size()); @@ -695,7 +695,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) { // the same result as navigating to a new foreground tab in the (only) // active browser. Tests are the same as for Disposition_NewForegroundTab. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_NewForegroundTab) { - WebContents* old_contents = browser()->GetSelectedWebContents(); + WebContents* old_contents = browser()->GetActiveWebContents(); // Navigate with a NULL browser. browser::NavigateParams p(MakeNavigateParams(NULL)); p.disposition = NEW_FOREGROUND_TAB; @@ -704,8 +704,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_NewForegroundTab) { // Navigate() should have found browser() and create a new tab. EXPECT_EQ(browser(), p.browser); - EXPECT_NE(old_contents, browser()->GetSelectedWebContents()); - EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents); + EXPECT_NE(old_contents, browser()->GetActiveWebContents()); + EXPECT_EQ(browser()->GetActiveTabContents(), p.target_contents); EXPECT_EQ(2, browser()->tab_count()); } @@ -724,7 +724,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_MatchProfile) { // Navigate() should have found incognito, not browser(). EXPECT_EQ(incognito, p.browser); - EXPECT_EQ(incognito->GetSelectedTabContentsWrapper(), p.target_contents); + EXPECT_EQ(incognito->GetActiveTabContents(), p.target_contents); EXPECT_EQ(1, incognito->tab_count()); } @@ -774,7 +774,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(3, browser()->tab_count()); EXPECT_EQ(2, browser()->active_index()); EXPECT_EQ(GetContentSettingsURL(), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -807,7 +807,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(3, browser()->tab_count()); EXPECT_EQ(1, browser()->active_index()); EXPECT_EQ(GetContentSettingsURL(), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -840,7 +840,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(3, browser()->tab_count()); EXPECT_EQ(1, browser()->active_index()); EXPECT_EQ(GetClearBrowsingDataURL(), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -872,7 +872,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(3, browser()->tab_count()); EXPECT_EQ(1, browser()->active_index()); EXPECT_EQ(singleton_url1, - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -903,7 +903,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(1, browser()->active_index()); EXPECT_EQ(singleton_url_target, - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -961,7 +961,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(GetSettingsURL(), browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(GetSettingsURL(), browser()->GetActiveWebContents()->GetURL()); } // Settings page is expected to always open in normal mode regardless @@ -1010,9 +1010,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NavigateToCrashedSingletonTab) { GURL singleton_url(GetContentSettingsURL()); - TabContentsWrapper* wrapper = browser()->AddSelectedTabWithURL( + TabContents* tab_contents = browser()->AddSelectedTabWithURL( singleton_url, content::PAGE_TRANSITION_LINK); - WebContents* web_contents = wrapper->web_contents(); + WebContents* web_contents = tab_contents->web_contents(); // We should have one browser with 2 tabs, the 2nd selected. EXPECT_EQ(1u, BrowserList::size()); @@ -1044,7 +1044,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, observer.Wait(); } EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(GetSettingsURL(), browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(GetSettingsURL(), browser()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1061,7 +1061,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, observer.Wait(); } EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(GetSettingsURL(), browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(GetSettingsURL(), browser()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1071,7 +1071,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, ui_test_utils::NavigateToURL(&p); EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); { ui_test_utils::WindowedNotificationObserver observer( @@ -1081,14 +1081,14 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, observer.Wait(); } EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(GetSettingsURL(), browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(GetSettingsURL(), browser()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NavigateFromPageToOptionsInNewTab) { browser::NavigateParams p(MakeNavigateParams()); ui_test_utils::NavigateToURL(&p); - EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(GetGoogleURL(), browser()->GetActiveWebContents()->GetURL()); EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(1, browser()->tab_count()); @@ -1100,7 +1100,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, observer.Wait(); } EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(GetSettingsURL(), browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(GetSettingsURL(), browser()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1125,7 +1125,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, observer.Wait(); } EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(GetSettingsURL(), browser()->GetSelectedWebContents()->GetURL()); + EXPECT_EQ(GetSettingsURL(), browser()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1139,7 +1139,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GetClearBrowsingDataURL(), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); browser()->NewTab(); EXPECT_EQ(2, browser()->tab_count()); @@ -1153,7 +1153,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(GetClearBrowsingDataURL(), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } // Times out on mac, fails on linux. @@ -1190,7 +1190,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(GetSettingsURL(), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } // Tests that when a new tab is opened from the omnibox, the focus is moved from @@ -1242,7 +1242,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GURL(chrome::kChromeUIHistoryFrameURL), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1256,7 +1256,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1270,7 +1270,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL), - browser()->GetSelectedWebContents()->GetURL()); + browser()->GetActiveWebContents()->GetURL()); } // This test makes sure any link in a crashed panel page navigates to a tabbed @@ -1308,13 +1308,13 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserNavigatorTest, NavigateFromCrashedPanel) { EXPECT_EQ(1, panel_browser->tab_count()); // Kill the panel page. - WebContents* web_contents = panel_browser->GetSelectedWebContents(); + WebContents* web_contents = panel_browser->GetActiveWebContents(); web_contents->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); EXPECT_TRUE(web_contents->IsCrashed()); // Navigate to the page. browser::NavigateParams p2(MakeNavigateParams(panel_browser)); - p2.source_contents = panel_browser->GetSelectedTabContentsWrapper(); + p2.source_contents = panel_browser->GetActiveTabContents(); p2.url = url2; p2.disposition = CURRENT_TAB; browser::Navigate(&p2); diff --git a/chrome/browser/ui/browser_navigator_browsertest.h b/chrome/browser/ui/browser_navigator_browsertest.h index cbce35e..b5d733a 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.h +++ b/chrome/browser/ui/browser_navigator_browsertest.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. @@ -11,7 +11,6 @@ class Profile; class TabContents; -typedef TabContents TabContentsWrapper; namespace browser { struct NavigateParams; @@ -29,7 +28,7 @@ class BrowserNavigatorTest : public InProcessBrowserTest, Browser* CreateEmptyBrowserForType(Browser::Type type, Profile* profile); Browser* CreateEmptyBrowserForApp(Browser::Type type, Profile* profile); - TabContentsWrapper* CreateTabContents(); + TabContents* CreateTabContents(); void RunSuppressTest(WindowOpenDisposition disposition); void RunUseNonIncognitoWindowTest(const GURL& url); diff --git a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc index 478fb4c..37c2b77 100644 --- a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc +++ b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc @@ -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. @@ -54,7 +54,7 @@ IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, EXPECT_EQ(incognito_browser, p.browser); EXPECT_EQ(2, incognito_browser->tab_count()); EXPECT_EQ(GURL("chrome://chrome/settings"), - incognito_browser->GetSelectedWebContents()->GetURL()); + incognito_browser->GetActiveWebContents()->GetURL()); } } // namespace diff --git a/chrome/browser/ui/browser_toolbar_model_delegate.cc b/chrome/browser/ui/browser_toolbar_model_delegate.cc index e93f33b..3c410f0 100644 --- a/chrome/browser/ui/browser_toolbar_model_delegate.cc +++ b/chrome/browser/ui/browser_toolbar_model_delegate.cc @@ -15,5 +15,5 @@ BrowserToolbarModelDelegate::~BrowserToolbarModelDelegate() { content::WebContents* BrowserToolbarModelDelegate::GetActiveWebContents() const { - return browser_->GetSelectedWebContents(); + return browser_->GetActiveWebContents(); } diff --git a/chrome/browser/ui/browser_win.cc b/chrome/browser/ui/browser_win.cc index badf300..eb1e2f6 100644 --- a/chrome/browser/ui/browser_win.cc +++ b/chrome/browser/ui/browser_win.cc @@ -9,7 +9,7 @@ #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_finder.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" namespace { @@ -58,7 +58,7 @@ void Browser::PinCurrentPageToStartScreen() { if (metro_module) { GURL url; string16 title; - TabContentsWrapper* tab = GetSelectedTabContentsWrapper(); + TabContents* tab = GetActiveTabContents(); bookmark_utils::GetURLAndTitleToBookmark(tab->web_contents(), &url, &title); typedef BOOL (*MetroPinUrlToStartScreen)(string16, string16); diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 4d9427d..743a3cc 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h @@ -26,7 +26,6 @@ class LocationBar; class Profile; class StatusBubble; class TabContents; -typedef TabContents TabContentsWrapper; class TemplateURL; #if !defined(OS_MACOSX) class ToolbarView; @@ -163,7 +162,7 @@ class BrowserWindow : public BaseWindow { virtual void UpdateReloadStopState(bool is_loading, bool force) = 0; // Updates the toolbar with the state for the specified |contents|. - virtual void UpdateToolbar(TabContentsWrapper* contents, + virtual void UpdateToolbar(TabContents* contents, bool should_restore_state) = 0; // Focuses the toolbar (for accessibility). @@ -288,7 +287,7 @@ class BrowserWindow : public BaseWindow { // that page/frame. If |show_history| is true, a section showing how many // times that URL has been visited is added to the page info. virtual void ShowWebsiteSettings(Profile* profile, - TabContentsWrapper* tab_contents_wrapper, + TabContents* tab_contents, const GURL& url, const content::SSLStatus& ssl, bool show_history) = 0; @@ -311,8 +310,7 @@ class BrowserWindow : public BaseWindow { const content::NativeWebKeyboardEvent& event) = 0; // Shows the create web app shortcut dialog box. - virtual void ShowCreateWebAppShortcutsDialog( - TabContentsWrapper* tab_contents) = 0; + virtual void ShowCreateWebAppShortcutsDialog(TabContents* tab_contents) = 0; // Shows the create chrome app shortcut dialog box. virtual void ShowCreateChromeAppShortcutsDialog(Profile* profile, @@ -338,7 +336,7 @@ class BrowserWindow : public BaseWindow { #endif // Invoked when instant's tab contents should be shown. - virtual void ShowInstant(TabContentsWrapper* preview) = 0; + virtual void ShowInstant(TabContents* preview) = 0; // Invoked when the instant's tab contents should be hidden. virtual void HideInstant() = 0; diff --git a/chrome/browser/ui/constrained_window_tab_helper.cc b/chrome/browser/ui/constrained_window_tab_helper.cc index a867ed5..a372e31 100644 --- a/chrome/browser/ui/constrained_window_tab_helper.cc +++ b/chrome/browser/ui/constrained_window_tab_helper.cc @@ -6,7 +6,7 @@ #include "chrome/browser/ui/constrained_window.h" #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/render_messages.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" @@ -18,9 +18,9 @@ using content::WebContents; ConstrainedWindowTabHelper::ConstrainedWindowTabHelper( - TabContentsWrapper* wrapper) - : content::WebContentsObserver(wrapper->web_contents()), - wrapper_(wrapper), + TabContents* tab_contents) + : content::WebContentsObserver(tab_contents->web_contents()), + tab_contents_(tab_contents), delegate_(NULL) { } @@ -85,7 +85,7 @@ void ConstrainedWindowTabHelper::BlockTabContent(bool blocked) { host->GetRoutingID(), blocked)); } if (delegate_) - delegate_->SetTabContentBlocked(wrapper_, blocked); + delegate_->SetTabContentBlocked(tab_contents_, blocked); } void ConstrainedWindowTabHelper::DidNavigateMainFrame( diff --git a/chrome/browser/ui/constrained_window_tab_helper.h b/chrome/browser/ui/constrained_window_tab_helper.h index bbc2a30..37deb5c 100644 --- a/chrome/browser/ui/constrained_window_tab_helper.h +++ b/chrome/browser/ui/constrained_window_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. @@ -13,12 +13,11 @@ class ConstrainedWindow; class ConstrainedWindowTabHelperDelegate; class TabContents; -typedef TabContents TabContentsWrapper; // Per-tab class to manage constrained windows. class ConstrainedWindowTabHelper : public content::WebContentsObserver { public: - explicit ConstrainedWindowTabHelper(TabContentsWrapper* tab_contents); + explicit ConstrainedWindowTabHelper(TabContents* tab_contents); virtual ~ConstrainedWindowTabHelper(); ConstrainedWindowTabHelperDelegate* delegate() const { return delegate_; } @@ -60,8 +59,8 @@ class ConstrainedWindowTabHelper : public content::WebContentsObserver { virtual void DidGetIgnoredUIEvent() OVERRIDE; virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; - // Our owning TabContentsWrapper. - TabContentsWrapper* wrapper_; + // Our owning TabContents. + TabContents* tab_contents_; // Delegate for notifying our owner about stuff. Not owned by us. ConstrainedWindowTabHelperDelegate* delegate_; diff --git a/chrome/browser/ui/constrained_window_tab_helper_delegate.cc b/chrome/browser/ui/constrained_window_tab_helper_delegate.cc index 7df8db8..de9ed50 100644 --- a/chrome/browser/ui/constrained_window_tab_helper_delegate.cc +++ b/chrome/browser/ui/constrained_window_tab_helper_delegate.cc @@ -1,11 +1,11 @@ -// 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. #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" void ConstrainedWindowTabHelperDelegate::WillShowConstrainedWindow( - TabContentsWrapper* source) { + TabContents* source) { } bool ConstrainedWindowTabHelperDelegate::ShouldFocusConstrainedWindow() { @@ -13,7 +13,7 @@ bool ConstrainedWindowTabHelperDelegate::ShouldFocusConstrainedWindow() { } void ConstrainedWindowTabHelperDelegate::SetTabContentBlocked( - TabContentsWrapper* wrapper, bool blocked) { + TabContents* tab_contents, bool blocked) { } ConstrainedWindowTabHelperDelegate::~ConstrainedWindowTabHelperDelegate() {} diff --git a/chrome/browser/ui/constrained_window_tab_helper_delegate.h b/chrome/browser/ui/constrained_window_tab_helper_delegate.h index dde376d..8237249 100644 --- a/chrome/browser/ui/constrained_window_tab_helper_delegate.h +++ b/chrome/browser/ui/constrained_window_tab_helper_delegate.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. @@ -7,21 +7,20 @@ #pragma once class TabContents; -typedef TabContents TabContentsWrapper; class ConstrainedWindowTabHelperDelegate { public: - // Invoked prior to the TabContentsWrapper showing a constrained window. - virtual void WillShowConstrainedWindow(TabContentsWrapper* source); + // Invoked prior to the TabContents showing a constrained window. + virtual void WillShowConstrainedWindow(TabContents* source); // Returns true if constrained windows should be focused. Default is true. virtual bool ShouldFocusConstrainedWindow(); - // Changes the blocked state of |wrapper|. TabContentsWrapper are considered + // Changes the blocked state of |tab_contents|. TabContentses are considered // blocked while displaying a tab modal dialog. During that time renderer host - // will ignore any UI interaction within TabContentsWrapper outside of the + // will ignore any UI interaction within TabContents outside of the // currently displaying dialog. - virtual void SetTabContentBlocked(TabContentsWrapper* wrapper, bool blocked); + virtual void SetTabContentBlocked(TabContents* tab_contents, bool blocked); protected: virtual ~ConstrainedWindowTabHelperDelegate(); diff --git a/chrome/browser/ui/constrained_window_tab_helper_unittest.cc b/chrome/browser/ui/constrained_window_tab_helper_unittest.cc index 93365cc..a03797f 100644 --- a/chrome/browser/ui/constrained_window_tab_helper_unittest.cc +++ b/chrome/browser/ui/constrained_window_tab_helper_unittest.cc @@ -1,10 +1,10 @@ -// 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. #include "chrome/browser/ui/constrained_window.h" #include "chrome/browser/ui/constrained_window_tab_helper.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -24,8 +24,8 @@ class ConstrainedWindowTabHelperUnit : public TabContentsTestHarness { class ConstrainedWindowCloseTest : public ConstrainedWindow { public: - explicit ConstrainedWindowCloseTest(TabContentsWrapper* wrapper) - : wrapper_(wrapper) { + explicit ConstrainedWindowCloseTest(TabContents* tab_contents) + : tab_contents_(tab_contents) { } virtual void ShowConstrainedWindow() {} @@ -33,12 +33,12 @@ class ConstrainedWindowCloseTest : public ConstrainedWindow { virtual ~ConstrainedWindowCloseTest() {} virtual void CloseConstrainedWindow() { - wrapper_->constrained_window_tab_helper()->WillClose(this); + tab_contents_->constrained_window_tab_helper()->WillClose(this); close_count++; } int close_count; - TabContentsWrapper* wrapper_; + TabContents* tab_contents_; }; TEST_F(ConstrainedWindowTabHelperUnit, ConstrainedWindows) { diff --git a/chrome/browser/ui/fullscreen_controller.cc b/chrome/browser/ui/fullscreen_controller.cc index 1409fa2..72c3ec2 100644 --- a/chrome/browser/ui/fullscreen_controller.cc +++ b/chrome/browser/ui/fullscreen_controller.cc @@ -12,7 +12,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" @@ -49,12 +49,12 @@ bool FullscreenController::IsFullscreenForTabOrPending() const { } bool FullscreenController::IsFullscreenForTabOrPending( - const WebContents* tab) const { - const TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(tab); - if (!wrapper || (wrapper != fullscreened_tab_)) + const WebContents* web_contents) const { + const TabContents* tab_contents = + TabContents::FromWebContents(web_contents); + if (!tab_contents || (tab_contents != fullscreened_tab_)) return false; - DCHECK(tab == browser_->GetSelectedWebContents()); + DCHECK(web_contents == browser_->GetActiveWebContents()); return true; } @@ -67,7 +67,7 @@ bool FullscreenController::IsMouseLocked() const { mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY; } -void FullscreenController::RequestToLockMouse(WebContents* tab, +void FullscreenController::RequestToLockMouse(WebContents* web_contents, bool user_gesture, bool last_unlocked_by_target) { DCHECK(!IsMouseLocked()); @@ -78,14 +78,14 @@ void FullscreenController::RequestToLockMouse(WebContents* tab, // (i.e. not the user), or if we're in tab fullscreen (user gesture required // for that) if (!last_unlocked_by_target && !user_gesture && - !IsFullscreenForTabOrPending(tab)) { - tab->GotResponseToLockMouseRequest(false); + !IsFullscreenForTabOrPending(web_contents)) { + web_contents->GotResponseToLockMouseRequest(false); return; } - mouse_lock_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); + mouse_lock_tab_ = TabContents::FromWebContents(web_contents); FullscreenExitBubbleType bubble_type = GetFullscreenExitBubbleType(); - switch (GetMouseLockSetting(tab->GetURL())) { + switch (GetMouseLockSetting(web_contents->GetURL())) { case CONTENT_SETTING_ALLOW: // If bubble already displaying buttons we must not lock the mouse yet, // or it would prevent pressing those buttons. Instead, merge the request. @@ -93,7 +93,7 @@ void FullscreenController::RequestToLockMouse(WebContents* tab, mouse_lock_state_ = MOUSELOCK_REQUESTED; } else { // Lock mouse. - if (tab->GotResponseToLockMouseRequest(true)) { + if (web_contents->GotResponseToLockMouseRequest(true)) { if (last_unlocked_by_target) { mouse_lock_state_ = MOUSELOCK_ACCEPTED_SILENTLY; } else { @@ -106,7 +106,7 @@ void FullscreenController::RequestToLockMouse(WebContents* tab, } break; case CONTENT_SETTING_BLOCK: - tab->GotResponseToLockMouseRequest(false); + web_contents->GotResponseToLockMouseRequest(false); mouse_lock_tab_ = NULL; mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; break; @@ -119,9 +119,9 @@ void FullscreenController::RequestToLockMouse(WebContents* tab, UpdateFullscreenExitBubbleContent(); } -void FullscreenController::ToggleFullscreenModeForTab(WebContents* tab, +void FullscreenController::ToggleFullscreenModeForTab(WebContents* web_contents, bool enter_fullscreen) { - if (tab != browser_->GetSelectedWebContents()) + if (web_contents != browser_->GetActiveWebContents()) return; bool in_browser_or_tab_fullscreen_mode; @@ -132,7 +132,7 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* tab, #endif if (enter_fullscreen) { - fullscreened_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); + fullscreened_tab_ = TabContents::FromWebContents(web_contents); if (!in_browser_or_tab_fullscreen_mode) { tab_caused_fullscreen_ = true; #if defined(OS_MACOSX) @@ -143,7 +143,7 @@ void FullscreenController::ToggleFullscreenModeForTab(WebContents* tab, } else { // We need to update the fullscreen exit bubble, e.g., going from browser // fullscreen to tab fullscreen will need to show different content. - const GURL& url = tab->GetURL(); + const GURL& url = web_contents->GetURL(); if (!tab_fullscreen_accepted_) { tab_fullscreen_accepted_ = GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; @@ -208,7 +208,7 @@ void FullscreenController::OnTabClosing(WebContents* web_contents) { } } -void FullscreenController::OnTabDeactivated(TabContentsWrapper* contents) { +void FullscreenController::OnTabDeactivated(TabContents* contents) { if (contents == fullscreened_tab_) ExitTabFullscreenOrMouseLockIfNecessary(); } @@ -463,7 +463,7 @@ void FullscreenController::TogglePresentationModeInternal(bool for_tab) { toggled_into_fullscreen_ = !window_->InPresentationMode(); GURL url; if (for_tab) { - url = browser_->GetSelectedWebContents()->GetURL(); + url = browser_->GetActiveWebContents()->GetURL(); tab_fullscreen_accepted_ = toggled_into_fullscreen_ && GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; } @@ -492,7 +492,7 @@ void FullscreenController::ToggleFullscreenModeInternal(bool for_tab) { GURL url; if (for_tab) { - url = browser_->GetSelectedWebContents()->GetURL(); + url = browser_->GetActiveWebContents()->GetURL(); tab_fullscreen_accepted_ = toggled_into_fullscreen_ && GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; } else { diff --git a/chrome/browser/ui/fullscreen_controller.h b/chrome/browser/ui/fullscreen_controller.h index f5304a32..b47ec5e 100644 --- a/chrome/browser/ui/fullscreen_controller.h +++ b/chrome/browser/ui/fullscreen_controller.h @@ -16,7 +16,6 @@ class BrowserWindow; class GURL; class Profile; class TabContents; -typedef TabContents TabContentsWrapper; namespace content { class WebContents; @@ -49,16 +48,17 @@ class FullscreenController : public base::RefCounted<FullscreenController> { // The window may still be transitioning, and window_->IsFullscreen() // may still return false. bool IsFullscreenForTabOrPending() const; - bool IsFullscreenForTabOrPending(const content::WebContents* tab) const; + bool IsFullscreenForTabOrPending( + const content::WebContents* web_contents) const; bool IsMouseLockRequested() const; bool IsMouseLocked() const; // Requests. - void RequestToLockMouse(content::WebContents* tab, + void RequestToLockMouse(content::WebContents* web_contents, bool user_gesture, bool last_unlocked_by_target); - void ToggleFullscreenModeForTab(content::WebContents* tab, + void ToggleFullscreenModeForTab(content::WebContents* web_contents, bool enter_fullscreen); #if defined(OS_MACOSX) void TogglePresentationMode(); @@ -72,7 +72,7 @@ class FullscreenController : public base::RefCounted<FullscreenController> { // Notifications. void LostMouseLock(); void OnTabClosing(content::WebContents* web_contents); - void OnTabDeactivated(TabContentsWrapper* contents); + void OnTabDeactivated(TabContents* contents); void OnAcceptFullscreenPermission(const GURL& url, FullscreenExitBubbleType bubble_type); void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); @@ -120,8 +120,8 @@ class FullscreenController : public base::RefCounted<FullscreenController> { Browser* browser_; // If there is currently a tab in fullscreen mode (entered via - // webkitRequestFullScreen), this is its wrapper. - TabContentsWrapper* fullscreened_tab_; + // webkitRequestFullScreen), this is its TabContents. + TabContents* fullscreened_tab_; // The URL of the extension which trigerred "browser fullscreen" mode. GURL extension_caused_fullscreen_; @@ -135,8 +135,8 @@ class FullscreenController : public base::RefCounted<FullscreenController> { // True if this controller has toggled into tab OR browser fullscreen. bool toggled_into_fullscreen_; - // Wrapper for current tab requesting or currently in mouse lock. - TabContentsWrapper* mouse_lock_tab_; + // TabContents for current tab requesting or currently in mouse lock. + TabContents* mouse_lock_tab_; MouseLockState mouse_lock_state_; diff --git a/chrome/browser/ui/fullscreen_controller_browsertest.cc b/chrome/browser/ui/fullscreen_controller_browsertest.cc index 6532762..f6f0137 100644 --- a/chrome/browser/ui/fullscreen_controller_browsertest.cc +++ b/chrome/browser/ui/fullscreen_controller_browsertest.cc @@ -41,7 +41,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, AddTabAtIndex( 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); + WebContents* fullscreen_tab = browser()->GetActiveWebContents(); ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(fullscreen_tab, true)); @@ -70,7 +70,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, AddTabAtIndex( 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); + WebContents* fullscreen_tab = browser()->GetActiveWebContents(); ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(fullscreen_tab, true)); ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(fullscreen_tab, false)); } @@ -86,7 +86,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, AddTabAtIndex(1, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); + WebContents* fullscreen_tab = browser()->GetActiveWebContents(); ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(fullscreen_tab, true)); @@ -104,7 +104,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, void FullscreenControllerBrowserTest::TestFullscreenMouseLockContentSettings() { GURL url = test_server()->GetURL("simple.html"); AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); - WebContents* tab = browser()->GetSelectedWebContents(); + WebContents* tab = browser()->GetActiveWebContents(); // Validate that going fullscreen for a URL defaults to asking permision. ASSERT_FALSE(IsFullscreenPermissionRequested()); @@ -185,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, BrowserFullscreenExit) { // Enter tab fullscreen. AddTabAtIndex(0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); + WebContents* fullscreen_tab = browser()->GetActiveWebContents(); ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(fullscreen_tab, true)); // Exit browser fullscreen. @@ -202,7 +202,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, // Enter and then exit tab fullscreen. AddTabAtIndex(0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); + WebContents* fullscreen_tab = browser()->GetActiveWebContents(); ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(fullscreen_tab, true)); ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreen(fullscreen_tab, false)); @@ -215,7 +215,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, FullscreenFileURL) { ui_test_utils::NavigateToURL(browser(), ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), FilePath(kSimpleFile))); - WebContents* tab = browser()->GetSelectedWebContents(); + WebContents* tab = browser()->GetActiveWebContents(); // Validate that going fullscreen for a file does not ask permision. ASSERT_FALSE(IsFullscreenPermissionRequested()); @@ -233,7 +233,7 @@ IN_PROC_BROWSER_TEST_F( AddTabAtIndex( 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); + WebContents* fullscreen_tab = browser()->GetActiveWebContents(); { FullscreenNotificationObserver fullscreen_observer; diff --git a/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc index 43fcec8..e21efb7 100644 --- a/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc +++ b/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc @@ -22,7 +22,7 @@ class FullscreenControllerInteractiveTest // Verify that IsMouseLocked is consistent between the // Fullscreen Controller and the Render View Host View. EXPECT_TRUE(browser()->IsMouseLocked() == - browser()->GetSelectedWebContents()-> + browser()->GetActiveWebContents()-> GetRenderViewHost()->GetView()->IsMouseLocked()); return browser()->IsMouseLocked(); } @@ -144,7 +144,7 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kFullscreenMouseLockHTML)); - WebContents* tab = browser()->GetSelectedWebContents(); + WebContents* tab = browser()->GetActiveWebContents(); ASSERT_FALSE(IsFullscreenBubbleDisplayed()); diff --git a/chrome/browser/ui/fullscreen_controller_test.cc b/chrome/browser/ui/fullscreen_controller_test.cc index d4a67c8..990d415 100644 --- a/chrome/browser/ui/fullscreen_controller_test.cc +++ b/chrome/browser/ui/fullscreen_controller_test.cc @@ -103,7 +103,7 @@ bool FullscreenControllerTest::IsFullscreenBubbleDisplayingButtons() { } void FullscreenControllerTest::AcceptCurrentFullscreenOrMouseLockRequest() { - WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); + WebContents* fullscreen_tab = browser()->GetActiveWebContents(); FullscreenExitBubbleType type = browser()->fullscreen_controller_->GetFullscreenExitBubbleType(); browser()->OnAcceptFullscreenPermission(fullscreen_tab->GetURL(), type); diff --git a/chrome/browser/ui/hung_plugin_tab_helper.cc b/chrome/browser/ui/hung_plugin_tab_helper.cc index ffdf785..dd6d59d 100644 --- a/chrome/browser/ui/hung_plugin_tab_helper.cc +++ b/chrome/browser/ui/hung_plugin_tab_helper.cc @@ -10,7 +10,7 @@ #include "chrome/browser/infobars/infobar.h" #include "chrome/browser/infobars/infobar_tab_helper.h" #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_child_process_host_iterator.h" @@ -283,9 +283,8 @@ void HungPluginTabHelper::CloseBar(PluginState* state) { } InfoBarTabHelper* HungPluginTabHelper::GetInfoBarHelper() { - TabContentsWrapper* tcw = - TabContentsWrapper::GetCurrentWrapperForContents(web_contents()); - if (!tcw) + TabContents* tab_contents = TabContents::FromWebContents(web_contents()); + if (!tab_contents) return NULL; - return tcw->infobar_tab_helper(); + return tab_contents->infobar_tab_helper(); } diff --git a/chrome/browser/ui/media_stream_infobar_delegate.h b/chrome/browser/ui/media_stream_infobar_delegate.h index 586120c..2f5ebbd 100644 --- a/chrome/browser/ui/media_stream_infobar_delegate.h +++ b/chrome/browser/ui/media_stream_infobar_delegate.h @@ -15,7 +15,6 @@ class MessageLoop; class TabContents; -typedef TabContents TabContentsWrapper; // This class configures an infobar shown when a page requests access to a // user's microphone and/or video camera. The user is shown a message asking diff --git a/chrome/browser/ui/select_file_dialog.cc b/chrome/browser/ui/select_file_dialog.cc index 4c8abb1..4722df9c 100644 --- a/chrome/browser/ui/select_file_dialog.cc +++ b/chrome/browser/ui/select_file_dialog.cc @@ -11,7 +11,7 @@ #include "chrome/browser/infobars/infobar_tab_helper.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/pref_names.h" #include "content/public/common/selected_file_info.h" #include "grit/generated_resources.h" @@ -74,9 +74,8 @@ void SelectFileDialog::SelectFile(Type type, if (!CanOpenSelectFileDialog()) { // Show the InfoBar saying that file-selection dialogs are disabled. if (source_contents) { - TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(source_contents); - InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); + TabContents* tab_contents = TabContents::FromWebContents(source_contents); + InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( infobar_helper, NULL, diff --git a/chrome/browser/ui/snapshot_tab_helper.cc b/chrome/browser/ui/snapshot_tab_helper.cc index 6953ad0..d9a49c1 100644 --- a/chrome/browser/ui/snapshot_tab_helper.cc +++ b/chrome/browser/ui/snapshot_tab_helper.cc @@ -1,10 +1,10 @@ -// 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. #include "chrome/browser/ui/snapshot_tab_helper.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/render_messages.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/ui/snapshot_tab_helper.h b/chrome/browser/ui/snapshot_tab_helper.h index 2771621..daee1ee 100644 --- a/chrome/browser/ui/snapshot_tab_helper.h +++ b/chrome/browser/ui/snapshot_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. @@ -10,7 +10,6 @@ class SkBitmap; class TabContents; -typedef TabContents TabContentsWrapper; // Per-tab class to handle snapshot functionality. class SnapshotTabHelper : public content::WebContentsObserver { diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_browsertest.cc b/chrome/browser/ui/tab_modal_confirm_dialog_browsertest.cc index 28b5107..8b1f30e 100644 --- a/chrome/browser/ui/tab_modal_confirm_dialog_browsertest.cc +++ b/chrome/browser/ui/tab_modal_confirm_dialog_browsertest.cc @@ -39,9 +39,9 @@ TabModalConfirmDialogTest::TabModalConfirmDialogTest() void TabModalConfirmDialogTest::SetUpOnMainThread() { delegate_ = new MockTabModalConfirmDialogDelegate( - browser()->GetSelectedWebContents()); + browser()->GetActiveWebContents()); dialog_ = CreateTestDialog(delegate_, - browser()->GetSelectedTabContentsWrapper()); + browser()->GetActiveTabContents()); ui_test_utils::RunAllPendingInMessageLoop(); } @@ -54,8 +54,8 @@ void TabModalConfirmDialogTest::CleanUpOnMainThread() { // a separate file. #if !defined(OS_MACOSX) TabModalConfirmDialog* TabModalConfirmDialogTest::CreateTestDialog( - TabModalConfirmDialogDelegate* delegate, TabContentsWrapper* wrapper) { - return new TabModalConfirmDialog(delegate, wrapper); + TabModalConfirmDialogDelegate* delegate, TabContents* tab_contents) { + return new TabModalConfirmDialog(delegate, tab_contents); } void TabModalConfirmDialogTest::CloseDialog(bool accept) { diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h b/chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h index 804a149..015f3c3 100644 --- a/chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h +++ b/chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h @@ -22,7 +22,6 @@ typedef TabModalConfirmDialogViews TabModalConfirmDialog; class MockTabModalConfirmDialogDelegate; class TabContents; -typedef TabContents TabContentsWrapper; class TabModalConfirmDialogDelegate; class TabModalConfirmDialogTest : public InProcessBrowserTest { @@ -40,7 +39,7 @@ class TabModalConfirmDialogTest : public InProcessBrowserTest { private: TabModalConfirmDialog* CreateTestDialog( - TabModalConfirmDialogDelegate* delegate, TabContentsWrapper* wrapper); + TabModalConfirmDialogDelegate* delegate, TabContents* tab_contents); // Deletes itself. TabModalConfirmDialog* dialog_; diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_browsertest_mac.mm b/chrome/browser/ui/tab_modal_confirm_dialog_browsertest_mac.mm index 20046a0..f96240a 100644 --- a/chrome/browser/ui/tab_modal_confirm_dialog_browsertest_mac.mm +++ b/chrome/browser/ui/tab_modal_confirm_dialog_browsertest_mac.mm @@ -8,8 +8,8 @@ #include "testing/gtest/include/gtest/gtest.h" TabModalConfirmDialog* TabModalConfirmDialogTest::CreateTestDialog( - TabModalConfirmDialogDelegate* delegate, TabContentsWrapper* wrapper) { - return new TabModalConfirmDialogMac(delegate, wrapper); + TabModalConfirmDialogDelegate* delegate, TabContents* tab_contents) { + return new TabModalConfirmDialogMac(delegate, tab_contents); } void TabModalConfirmDialogTest::CloseDialog(bool accept) { |
