diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-04 21:32:40 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-04 21:32:40 +0000 |
commit | 965524b257d99bbc4c10e82a1294ed1f91516e2c (patch) | |
tree | e23e34f5a12b995a10b94b726f36a59dc32393f8 /chrome/browser/automation | |
parent | 2b4355c4590724ae676f0ec5a8230e5c8c4cddf9 (diff) | |
download | chromium_src-965524b257d99bbc4c10e82a1294ed1f91516e2c.zip chromium_src-965524b257d99bbc4c10e82a1294ed1f91516e2c.tar.gz chromium_src-965524b257d99bbc4c10e82a1294ed1f91516e2c.tar.bz2 |
Remove some uses of custom tab contents types from some tests.
This required redoing the tests that used it to use the new RenderViewHost
test harness. This is mostly straightforward, but required more work for the
NavigationController tests.
I removed a few random places that were testing for the tab types. I also
made different versions of a few functions that don't take tab contents types
next to the existing ones that do, so my touched code won't have to be changed
again when I remove the tab contents types.
Review URL: http://codereview.chromium.org/62039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index d80401d..24179f39 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -2159,17 +2159,16 @@ void AutomationProvider::ShowInterstitialPage(int tab_handle, if (tab_tracker_->ContainsHandle(tab_handle)) { NavigationController* controller = tab_tracker_->GetResource(tab_handle); TabContents* tab_contents = controller->active_contents(); - if (tab_contents->type() == TAB_CONTENTS_WEB) { - AddNavigationStatusListener<bool>(controller, reply_message, true, - false, false); - WebContents* web_contents = tab_contents->AsWebContents(); - AutomationInterstitialPage* interstitial = - new AutomationInterstitialPage(web_contents, - GURL("about:interstitial"), - html_text); - interstitial->Show(); - return; - } + + AddNavigationStatusListener<bool>(controller, reply_message, true, + false, false); + WebContents* web_contents = tab_contents->AsWebContents(); + AutomationInterstitialPage* interstitial = + new AutomationInterstitialPage(web_contents, + GURL("about:interstitial"), + html_text); + interstitial->Show(); + return; } AutomationMsg_ShowInterstitialPage::WriteReplyParams(reply_message, false); @@ -2345,7 +2344,7 @@ void AutomationProvider::ActionOnSSLBlockingPage(int handle, bool proceed, NavigationController* tab = tab_tracker_->GetResource(handle); NavigationEntry* entry = tab->GetActiveEntry(); if (entry->page_type() == NavigationEntry::INTERSTITIAL_PAGE) { - TabContents* tab_contents = tab->GetTabContents(TAB_CONTENTS_WEB); + TabContents* tab_contents = tab->tab_contents(); InterstitialPage* ssl_blocking_page = InterstitialPage::GetInterstitialPage(tab_contents->AsWebContents()); if (ssl_blocking_page) { @@ -2430,17 +2429,12 @@ void AutomationProvider::SavePage(int tab_handle, return; } - TabContents* tab_contents = nav->active_contents(); - if (tab_contents->type() != TAB_CONTENTS_WEB) { - *success = false; - return; - } - SavePackage::SavePackageType save_type = static_cast<SavePackage::SavePackageType>(type); DCHECK(save_type >= SavePackage::SAVE_AS_ONLY_HTML && save_type <= SavePackage::SAVE_AS_COMPLETE_HTML); - tab_contents->AsWebContents()->SavePage(file_name, dir_path, save_type); + nav->tab_contents()->AsWebContents()->SavePage( + file_name, dir_path, save_type); *success = true; } @@ -2505,7 +2499,7 @@ void AutomationProvider::OnMessageFromExternalHost(int handle, NOTREACHED(); return; } - TabContents* tab_contents = tab->GetTabContents(TAB_CONTENTS_WEB); + TabContents* tab_contents = tab->tab_contents(); if (!tab_contents) { NOTREACHED(); return; @@ -2532,7 +2526,7 @@ WebContents* AutomationProvider::GetWebContentsForHandle( if (tab_tracker_->ContainsHandle(handle)) { NavigationController* nav_controller = tab_tracker_->GetResource(handle); TabContents* tab_contents = nav_controller->active_contents(); - if (tab_contents && tab_contents->type() == TAB_CONTENTS_WEB) { + if (tab_contents) { web_contents = tab_contents->AsWebContents(); if (tab) *tab = nav_controller; @@ -2544,12 +2538,8 @@ WebContents* AutomationProvider::GetWebContentsForHandle( ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); - TabContents* tab_contents = tab->GetTabContents(TAB_CONTENTS_WEB); - DCHECK(tab_contents); - if (tab_contents) { - return ExternalTabContainer::GetContainerForTab( - tab_contents->GetNativeView()); - } + return ExternalTabContainer::GetContainerForTab( + tab->tab_contents()->GetNativeView()); } return NULL; @@ -2734,7 +2724,6 @@ void AutomationProvider::GetPageCurrentEncoding( if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) { TabContents* tab_contents = nav->active_contents(); - DCHECK(tab_contents->type() == TAB_CONTENTS_WEB); *current_encoding = tab_contents->AsWebContents()->encoding(); } } @@ -2753,7 +2742,6 @@ void AutomationProvider::OverrideEncoding(int tab_handle, if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) { TabContents* tab_contents = nav->active_contents(); - DCHECK(tab_contents->type() == TAB_CONTENTS_WEB); int selected_encoding_id = CharacterEncoding::GetCommandIdByCanonicalEncodingName(encoding_name); if (selected_encoding_id) { |