diff options
12 files changed, 119 insertions, 126 deletions
diff --git a/chrome/browser/automation/automation_misc_browsertest.cc b/chrome/browser/automation/automation_misc_browsertest.cc index 74c398f..8a27bc2 100644 --- a/chrome/browser/automation/automation_misc_browsertest.cc +++ b/chrome/browser/automation/automation_misc_browsertest.cc @@ -8,7 +8,6 @@ #include "base/callback.h" #include "chrome/browser/automation/automation_provider_observers.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/automation_constants.h" #include "chrome/common/automation_events.h" #include "chrome/test/base/in_process_browser_test.h" @@ -73,7 +72,7 @@ IN_PROC_BROWSER_TEST_F(AutomationMiscBrowserTest, ProcessMouseEvent) { .Times(2); content::RenderViewHost* view = - browser()->GetSelectedWebContents()->GetRenderViewHost(); + browser()->GetActiveWebContents()->GetRenderViewHost(); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( view, L"", diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 0cf1fed..8553aa7 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -55,7 +55,7 @@ #include "chrome/browser/ui/find_bar/find_tab_helper.h" #include "chrome/browser/ui/login/login_prompt.h" #include "chrome/browser/ui/omnibox/location_bar.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/automation_constants.h" #include "chrome/common/automation_messages.h" #include "chrome/common/chrome_constants.h" @@ -519,10 +519,10 @@ void AutomationProvider::SendFindRequest( if (!with_json) { find_in_page_observer_.reset(observer); } - TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(web_contents); - if (wrapper) - wrapper->find_tab_helper()->set_current_find_request_id(request_id); + TabContents* tab_contents = + TabContents::GetOwningTabContentsForWebContents(web_contents); + if (tab_contents) + tab_contents->find_tab_helper()->set_current_find_request_id(request_id); WebFindOptions options; options.forward = forward; diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index c2ade77..e2e790f 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -60,7 +60,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/find_bar/find_notification_details.h" #include "chrome/browser/ui/login/login_prompt.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/ntp/app_launcher_handler.h" #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" @@ -381,7 +381,7 @@ void TabStripNotificationObserver::Observe( const content::NotificationDetails& details) { if (type == notification_) { if (type == chrome::NOTIFICATION_TAB_PARENTED) { - ObserveTab(&(content::Source<TabContentsWrapper>(source).ptr()-> + ObserveTab(&(content::Source<TabContents>(source).ptr()-> web_contents()->GetController())); } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { ObserveTab(&(content::Source<content::WebContents>(source).ptr()-> @@ -471,13 +471,13 @@ TabCountChangeObserver::~TabCountChangeObserver() { tab_strip_model_->RemoveObserver(this); } -void TabCountChangeObserver::TabInsertedAt(TabContentsWrapper* contents, +void TabCountChangeObserver::TabInsertedAt(TabContents* contents, int index, bool foreground) { CheckTabCount(); } -void TabCountChangeObserver::TabDetachedAt(TabContentsWrapper* contents, +void TabCountChangeObserver::TabDetachedAt(TabContents* contents, int index) { CheckTabCount(); } @@ -801,7 +801,7 @@ void BrowserOpenedNotificationObserver::Observe( // Only send the result if the loaded tab is in the new window. NavigationController* controller = content::Source<NavigationController>(source).ptr(); - TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( + TabContents* tab = TabContents::GetOwningTabContentsForWebContents( controller->GetWebContents()); int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; if (window_id == new_window_id_) { @@ -970,7 +970,7 @@ bool ExecuteBrowserCommandObserver::CreateAndRegisterObserver( case IDC_FORWARD: case IDC_RELOAD: { new NavigationNotificationObserver( - &browser->GetSelectedWebContents()->GetController(), + &browser->GetActiveWebContents()->GetController(), automation, reply_message, 1, false, false); break; } @@ -1118,11 +1118,11 @@ void DomOperationObserver::Observe( } else if (type == chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED) { WebContents* web_contents = content::Source<WebContents>(source).ptr(); if (web_contents) { - TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(web_contents); - if (wrapper && - wrapper->content_settings() && - wrapper->content_settings()->IsContentBlocked( + TabContents* tab_contents = + TabContents::GetOwningTabContentsForWebContents(web_contents); + if (tab_contents && + tab_contents->content_settings() && + tab_contents->content_settings()->IsContentBlocked( CONTENT_SETTINGS_TYPE_JAVASCRIPT)) { OnJavascriptBlocked(); } @@ -1259,7 +1259,7 @@ void TabLanguageDeterminedObserver::Observe( return; } - TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( + TranslateTabHelper* helper = TabContents::GetOwningTabContentsForWebContents( web_contents_)->translate_tab_helper(); scoped_ptr<DictionaryValue> return_value(new DictionaryValue); return_value->SetBoolean("page_translated", @@ -1303,7 +1303,7 @@ void TabLanguageDeterminedObserver::Observe( InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation, IPC::Message* reply_message, - TabContentsWrapper* tab_contents, + TabContents* tab_contents, size_t target_count) : automation_(automation->AsWeakPtr()), reply_message_(reply_message), @@ -1808,7 +1808,7 @@ void SavePackageNotificationObserver::Observe( PageSnapshotTaker::PageSnapshotTaker(AutomationProvider* automation, IPC::Message* reply_message, - TabContentsWrapper* tab_contents, + TabContents* tab_contents, const FilePath& path) : automation_(automation->AsWeakPtr()), reply_message_(reply_message), @@ -2150,8 +2150,8 @@ void AppLaunchObserver::Observe(int type, // The app has launched only if the loaded tab is in the new window. NavigationController* controller = content::Source<NavigationController>(source).ptr(); - TabContentsWrapper* tab = - TabContentsWrapper::GetCurrentWrapperForContents( + TabContents* tab = + TabContents::GetOwningTabContentsForWebContents( controller->GetWebContents()); int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; if (window_id == new_window_id_) { @@ -2585,11 +2585,10 @@ AllViewsStoppedLoadingObserver::AllViewsStoppedLoadingObserver( ++iter) { Browser* browser = *iter; for (int i = 0; i < browser->tab_count(); ++i) { - TabContentsWrapper* contents_wrapper = - browser->GetTabContentsWrapperAt(i); - StartObserving(contents_wrapper->automation_tab_helper()); - if (contents_wrapper->automation_tab_helper()->has_pending_loads()) - pending_tabs_.insert(contents_wrapper->web_contents()); + TabContents* tab_contents = browser->GetTabContentsAt(i); + StartObserving(tab_contents->automation_tab_helper()); + if (tab_contents->automation_tab_helper()->has_pending_loads()) + pending_tabs_.insert(tab_contents->web_contents()); } } CheckIfNoMorePendingLoads(); @@ -2666,7 +2665,7 @@ void NewTabObserver::Observe(int type, const content::NotificationDetails& details) { DCHECK_EQ(chrome::NOTIFICATION_TAB_PARENTED, type); NavigationController* controller = - &(content::Source<TabContentsWrapper>(source).ptr()-> + &(content::Source<TabContents>(source).ptr()-> web_contents()->GetController()); if (automation_) { // TODO(phajdan.jr): Clean up this hack. We write the correct return type @@ -2979,7 +2978,7 @@ void BrowserOpenedWithNewProfileNotificationObserver::Observe( // Only send the result if the loaded tab is in the new window. NavigationController* controller = content::Source<NavigationController>(source).ptr(); - TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( + TabContents* tab = TabContents::GetOwningTabContentsForWebContents( controller->GetWebContents()); int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; if (window_id == new_window_id_) { diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index 246f397..1a76612 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -307,10 +307,10 @@ class TabCountChangeObserver : public TabStripModelObserver { IPC::Message* reply_message, int target_tab_count); // Implementation of TabStripModelObserver. - virtual void TabInsertedAt(TabContentsWrapper* contents, + virtual void TabInsertedAt(TabContents* contents, int index, bool foreground); - virtual void TabDetachedAt(TabContentsWrapper* contents, int index); + virtual void TabDetachedAt(TabContents* contents, int index); virtual void TabStripModelDeleted(); private: @@ -671,7 +671,7 @@ class InfoBarCountObserver : public content::NotificationObserver { public: InfoBarCountObserver(AutomationProvider* automation, IPC::Message* reply_message, - TabContentsWrapper* tab_contents, + TabContents* tab_contents, size_t target_count); virtual ~InfoBarCountObserver(); @@ -688,7 +688,7 @@ class InfoBarCountObserver : public content::NotificationObserver { content::NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; - TabContentsWrapper* tab_contents_; + TabContents* tab_contents_; const size_t target_count_; @@ -1318,7 +1318,7 @@ class PageSnapshotTaker : public TabEventObserver, public: PageSnapshotTaker(AutomationProvider* automation, IPC::Message* reply_message, - TabContentsWrapper* tab_contents, + TabContents* tab_contents, const FilePath& path); virtual ~PageSnapshotTaker(); @@ -1341,7 +1341,7 @@ class PageSnapshotTaker : public TabEventObserver, base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; - TabContentsWrapper* tab_contents_; + TabContents* tab_contents_; FilePath image_path_; content::NotificationRegistrar registrar_; diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index 929a97d..3447b06 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -18,7 +18,7 @@ #include "chrome/browser/sessions/restore_tab_helper.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/automation_messages.h" #include "chrome/common/render_messages.h" #include "content/public/browser/navigation_controller.h" @@ -195,7 +195,7 @@ void AutomationProvider::CreateExternalTab( *tab_handle = external_tab_container->tab_handle(); *tab_container_window = external_tab_container->GetNativeView(); *tab_window = web_contents->GetNativeView(); - *session_id = external_tab_container->tab_contents_wrapper()-> + *session_id = external_tab_container->tab_contents()-> restore_tab_helper()->session_id().id(); } else { external_tab_container->Uninitialize(); @@ -241,9 +241,9 @@ void AutomationProvider::PrintAsync(int tab_handle) { if (!web_contents) return; - TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(web_contents); - wrapper->print_view_manager()->PrintNow(); + TabContents* tab_contents = + TabContents::GetOwningTabContentsForWebContents(web_contents); + tab_contents->print_view_manager()->PrintNow(); } ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { @@ -335,7 +335,7 @@ void AutomationProvider::ConnectExternalTab( *tab_handle = external_tab_container->tab_handle(); *tab_container_window = external_tab_container->GetNativeView(); *tab_window = tab_contents->GetNativeView(); - *session_id = external_tab_container->tab_contents_wrapper()-> + *session_id = external_tab_container->tab_contents()-> restore_tab_helper()->session_id().id(); } else { external_tab_container->Uninitialize(); diff --git a/chrome/browser/automation/automation_tab_helper_browsertest.cc b/chrome/browser/automation/automation_tab_helper_browsertest.cc index 59ae8af..8f5ffe9 100644 --- a/chrome/browser/automation/automation_tab_helper_browsertest.cc +++ b/chrome/browser/automation/automation_tab_helper_browsertest.cc @@ -12,7 +12,7 @@ #include "chrome/browser/automation/automation_tab_helper.h" #include "chrome/browser/automation/mock_tab_event_observer.h" #include "chrome/browser/ui/browser.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_paths.h" #include "chrome/common/url_constants.h" @@ -91,7 +91,7 @@ class AutomationTabHelperBrowserTest : public InProcessBrowserTest { std::string script = base::StringPrintf("runTestCase(%d);", test_case_number); content::RenderViewHost* host = - browser()->GetSelectedWebContents()->GetRenderViewHost(); + browser()->GetActiveWebContents()->GetRenderViewHost(); if (wait_for_response) { ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( host, L"", ASCIIToWide(script))); @@ -104,7 +104,7 @@ class AutomationTabHelperBrowserTest : public InProcessBrowserTest { // Returns the |AutomationTabHelper| for the first browser's first tab. AutomationTabHelper* tab_helper() { - return browser()->GetTabContentsWrapperAt(0)->automation_tab_helper(); + return browser()->GetTabContentsAt(0)->automation_tab_helper(); } protected: diff --git a/chrome/browser/automation/automation_tab_helper_unittest.cc b/chrome/browser/automation/automation_tab_helper_unittest.cc index 6585edd..c29b80f 100644 --- a/chrome/browser/automation/automation_tab_helper_unittest.cc +++ b/chrome/browser/automation/automation_tab_helper_unittest.cc @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "chrome/browser/automation/automation_tab_helper.h" #include "chrome/browser/automation/mock_tab_event_observer.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/gmock/include/gmock/gmock.h" diff --git a/chrome/browser/automation/automation_util.cc b/chrome/browser/automation/automation_util.cc index 8754245..d5d570c 100644 --- a/chrome/browser/automation/automation_util.cc +++ b/chrome/browser/automation/automation_util.cc @@ -24,7 +24,7 @@ #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/view_type_utils.h" #include "chrome/common/automation_id.h" #include "chrome/common/extensions/extension.h" @@ -406,7 +406,7 @@ bool SendErrorIfModalDialogActive(AutomationProvider* provider, return active; } -AutomationId GetIdForTab(const TabContentsWrapper* tab) { +AutomationId GetIdForTab(const TabContents* tab) { return AutomationId( AutomationId::kTypeTab, base::IntToString(tab->restore_tab_helper()->session_id().id())); @@ -452,20 +452,21 @@ bool GetTabForId(const AutomationId& id, WebContents** tab) { for (; iter != BrowserList::end(); ++iter) { Browser* browser = *iter; for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { - TabContentsWrapper* wrapper = browser->GetTabContentsWrapperAt(tab_index); - if (base::IntToString(wrapper->restore_tab_helper()->session_id().id()) == - id.id()) { - *tab = wrapper->web_contents(); + TabContents* tab_contents = browser->GetTabContentsAt(tab_index); + if (base::IntToString( + tab_contents->restore_tab_helper()->session_id().id()) == + id.id()) { + *tab = tab_contents->web_contents(); return true; } if (preview_controller) { - TabContentsWrapper* preview_wrapper = - preview_controller->GetPrintPreviewForTab(wrapper); - if (preview_wrapper) { + TabContents* preview_tab_contents = + preview_controller->GetPrintPreviewForTab(tab_contents); + if (preview_tab_contents) { std::string preview_id = base::IntToString( - preview_wrapper->restore_tab_helper()->session_id().id()); + preview_tab_contents->restore_tab_helper()->session_id().id()); if (preview_id == id.id()) { - *tab = preview_wrapper->web_contents(); + *tab = preview_tab_contents->web_contents(); return true; } } diff --git a/chrome/browser/automation/automation_util.h b/chrome/browser/automation/automation_util.h index 8a63c8e..a611288 100644 --- a/chrome/browser/automation/automation_util.h +++ b/chrome/browser/automation/automation_util.h @@ -16,7 +16,6 @@ class Browser; class GURL; class Profile; class TabContents; -typedef TabContents TabContentsWrapper; namespace content { class RenderViewHost; @@ -93,7 +92,7 @@ bool SendErrorIfModalDialogActive(AutomationProvider* provider, IPC::Message* message); // Returns a valid automation ID for the given tab. -AutomationId GetIdForTab(const TabContentsWrapper* tab); +AutomationId GetIdForTab(const TabContents* tab); // Returns a valid automation ID for the extension view. AutomationId GetIdForExtensionView( diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index c258370..b61c0ae 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -113,7 +113,7 @@ #include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/view_type_utils.h" #include "chrome/common/automation_constants.h" #include "chrome/common/automation_events.h" @@ -498,7 +498,7 @@ void TestingAutomationProvider::AppendTab(int handle, Browser* browser = browser_tracker_->GetResource(handle); observer = new TabAppendedNotificationObserver(browser, this, reply_message); - TabContentsWrapper* contents = + TabContents* contents = browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); if (contents) { append_tab_response = GetIndexForNavigationController( @@ -2093,7 +2093,7 @@ ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) { // Each infobar may have different properties depending on the type. ListValue* infobars = new ListValue; InfoBarTabHelper* infobar_helper = - TabContentsWrapper::GetCurrentWrapperForContents(wc)-> + TabContents::GetOwningTabContentsForWebContents(wc)-> infobar_tab_helper(); for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { DictionaryValue* infobar_item = new DictionaryValue; @@ -2178,8 +2178,7 @@ void TestingAutomationProvider::PerformActionOnInfobar( return; } - TabContentsWrapper* tab_contents = - browser->GetTabContentsWrapperAt(tab_index); + TabContents* tab_contents = browser->GetTabContentsAt(tab_index); if (!tab_contents) { reply.SendError(StringPrintf("No such tab at index %d", tab_index)); return; @@ -3148,7 +3147,7 @@ void TestingAutomationProvider::OmniboxAcceptInput( DictionaryValue* args, IPC::Message* reply_message) { NavigationController& controller = - browser->GetSelectedWebContents()->GetController(); + browser->GetActiveWebContents()->GetController(); LocationBar* loc_bar = browser->window()->GetLocationBar(); if (!loc_bar) { AutomationJSONReply(this, reply_message).SendError( @@ -3626,18 +3625,17 @@ void TestingAutomationProvider::ClearBrowsingData( namespace { -// Get the TabContentsWrapper from a dictionary of arguments. -TabContentsWrapper* GetTabContentsWrapperFromDict(const Browser* browser, - const DictionaryValue* args, - std::string* error_message) { +// Get the TabContents from a dictionary of arguments. +TabContents* GetTabContentsFromDict(const Browser* browser, + const DictionaryValue* args, + std::string* error_message) { int tab_index; if (!args->GetInteger("tab_index", &tab_index)) { *error_message = "Must include tab_index."; return NULL; } - TabContentsWrapper* tab_contents = - browser->GetTabContentsWrapperAt(tab_index); + TabContents* tab_contents = browser->GetTabContentsAt(tab_index); if (!tab_contents) { *error_message = StringPrintf("No tab at index %d.", tab_index); return NULL; @@ -3649,7 +3647,7 @@ TabContentsWrapper* GetTabContentsWrapperFromDict(const Browser* browser, TranslateInfoBarDelegate* GetTranslateInfoBarDelegate( WebContents* web_contents) { InfoBarTabHelper* infobar_helper = - TabContentsWrapper::GetCurrentWrapperForContents(web_contents)-> + TabContents::GetOwningTabContentsForWebContents(web_contents)-> infobar_tab_helper(); for (size_t i = 0; i < infobar_helper->infobar_count(); i++) { InfoBarDelegate* infobar = infobar_helper->GetInfoBarDelegateAt(i); @@ -3667,8 +3665,8 @@ void TestingAutomationProvider::FindInPage( DictionaryValue* args, IPC::Message* reply_message) { std::string error_message; - TabContentsWrapper* tab_contents = - GetTabContentsWrapperFromDict(browser, args, &error_message); + TabContents* tab_contents = + GetTabContentsFromDict(browser, args, &error_message); if (!tab_contents) { AutomationJSONReply(this, reply_message).SendError(error_message); return; @@ -3713,14 +3711,14 @@ void TestingAutomationProvider::GetTranslateInfo( DictionaryValue* args, IPC::Message* reply_message) { std::string error_message; - TabContentsWrapper* tab_contents_wrapper = - GetTabContentsWrapperFromDict(browser, args, &error_message); - if (!tab_contents_wrapper) { + TabContents* tab_contents = + GetTabContentsFromDict(browser, args, &error_message); + if (!tab_contents) { AutomationJSONReply(this, reply_message).SendError(error_message); return; } - WebContents* web_contents = tab_contents_wrapper->web_contents(); + WebContents* web_contents = tab_contents->web_contents(); // Get the translate bar if there is one and pass it to the observer. // The observer will check for null and populate the information accordingly. TranslateInfoBarDelegate* translate_bar = @@ -3730,7 +3728,7 @@ void TestingAutomationProvider::GetTranslateInfo( this, reply_message, web_contents, translate_bar); // If the language for the page hasn't been loaded yet, then just make // the observer, otherwise call observe directly. - TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( + TranslateTabHelper* helper = TabContents::GetOwningTabContentsForWebContents( web_contents)->translate_tab_helper(); std::string language = helper->language_state().original_language(); if (!language.empty()) { @@ -3749,14 +3747,14 @@ void TestingAutomationProvider::SelectTranslateOption( IPC::Message* reply_message) { std::string option; std::string error_message; - TabContentsWrapper* tab_contents_wrapper = - GetTabContentsWrapperFromDict(browser, args, &error_message); - if (!tab_contents_wrapper) { + TabContents* tab_contents = + GetTabContentsFromDict(browser, args, &error_message); + if (!tab_contents) { AutomationJSONReply(this, reply_message).SendError(error_message); return; } - WebContents* web_contents = tab_contents_wrapper->web_contents(); + WebContents* web_contents = tab_contents->web_contents(); TranslateInfoBarDelegate* translate_bar = GetTranslateInfoBarDelegate(web_contents); if (!translate_bar) { @@ -3854,7 +3852,7 @@ void TestingAutomationProvider::SelectTranslateOption( // This is the function called when an infobar is dismissed or when the // user clicks the 'Nope' translate button. translate_bar->TranslationDeclined(); - tab_contents_wrapper->infobar_tab_helper()->RemoveInfoBar(translate_bar); + tab_contents->infobar_tab_helper()->RemoveInfoBar(translate_bar); reply.SendSuccess(NULL); } else { reply.SendError("Invalid string found for option."); @@ -3870,7 +3868,7 @@ void TestingAutomationProvider::GetBlockedPopupsInfo( IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); std::string error_message; - TabContentsWrapper* tab_contents = GetTabContentsWrapperFromDict( + TabContents* tab_contents = GetTabContentsFromDict( browser, args, &error_message); if (!tab_contents) { reply.SendError(error_message); @@ -3880,9 +3878,9 @@ void TestingAutomationProvider::GetBlockedPopupsInfo( BlockedContentTabHelper* blocked_content = tab_contents->blocked_content_tab_helper(); ListValue* blocked_popups_list = new ListValue; - std::vector<TabContentsWrapper*> blocked_contents; + std::vector<TabContents*> blocked_contents; blocked_content->GetBlockedContents(&blocked_contents); - for (std::vector<TabContentsWrapper*>::const_iterator it = + for (std::vector<TabContents*>::const_iterator it = blocked_contents.begin(); it != blocked_contents.end(); ++it) { DictionaryValue* item = new DictionaryValue; item->SetString("url", (*it)->web_contents()->GetURL().spec()); @@ -3900,7 +3898,7 @@ void TestingAutomationProvider::UnblockAndLaunchBlockedPopup( IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); std::string error_message; - TabContentsWrapper* tab_contents = GetTabContentsWrapperFromDict( + TabContents* tab_contents = GetTabContentsFromDict( browser, args, &error_message); if (!tab_contents) { reply.SendError(error_message); @@ -3918,7 +3916,7 @@ void TestingAutomationProvider::UnblockAndLaunchBlockedPopup( reply.SendError(StringPrintf("No popup at index %d", popup_index)); return; } - std::vector<TabContentsWrapper*> blocked_contents; + std::vector<TabContents*> blocked_contents; blocked_content->GetBlockedContents(&blocked_contents); blocked_content->LaunchForContents(blocked_contents[popup_index]); reply.SendSuccess(NULL); @@ -4397,8 +4395,8 @@ void TestingAutomationProvider::HeapProfilerDump( return; } - TabContentsWrapper* tab_contents = - TabContentsWrapper::GetCurrentWrapperForContents(web_contents); + TabContents* tab_contents = + TabContents::GetOwningTabContentsForWebContents(web_contents); tab_contents->automation_tab_helper()->HeapProfilerDump(reason_string); reply.SendSuccess(NULL); return; @@ -4475,8 +4473,8 @@ void TestingAutomationProvider::GetAutofillProfile( return; } - TabContentsWrapper* tab_contents = - browser->GetTabContentsWrapperAt(tab_index); + TabContents* tab_contents = + browser->GetTabContentsAt(tab_index); if (tab_contents) { PersonalDataManager* pdm = PersonalDataManagerFactory::GetForProfile( tab_contents->profile()->GetOriginalProfile()); @@ -4541,8 +4539,7 @@ void TestingAutomationProvider::FillAutofillProfile( return; } - TabContentsWrapper* tab_contents = - browser->GetTabContentsWrapperAt(tab_index); + TabContents* tab_contents = browser->GetTabContentsAt(tab_index); if (tab_contents) { PersonalDataManager* pdm = @@ -4586,8 +4583,7 @@ void TestingAutomationProvider::SubmitAutofillForm( .SendError("'tab_index' missing or invalid."); return; } - TabContentsWrapper* tab_contents = - browser->GetTabContentsWrapperAt(tab_index); + TabContents* tab_contents = browser->GetTabContentsAt(tab_index); if (!tab_contents) { AutomationJSONReply(this, reply_message).SendError( StringPrintf("No such tab at index %d", tab_index)); @@ -5665,7 +5661,7 @@ void TestingAutomationProvider::LaunchApp( service->extension_prefs()->GetLaunchContainer( extension, ExtensionPrefs::LAUNCH_REGULAR); - WebContents* old_contents = browser->GetSelectedWebContents(); + WebContents* old_contents = browser->GetActiveWebContents(); if (!old_contents) { AutomationJSONReply(this, reply_message).SendError( "Cannot identify selected tab contents."); @@ -5825,7 +5821,7 @@ void TestingAutomationProvider::IsMouseLocked(Browser* browser, base::DictionaryValue* args, IPC::Message* reply_message) { DictionaryValue dict; - dict.SetBoolean("result", browser->GetSelectedWebContents()-> + dict.SetBoolean("result", browser->GetActiveWebContents()-> GetRenderViewHost()->GetView()->IsMouseLocked()); AutomationJSONReply(this, reply_message).SendSuccess(&dict); } @@ -5882,7 +5878,7 @@ void TestingAutomationProvider::AcceptCurrentFullscreenOrMouseLockRequest( Browser* browser, base::DictionaryValue* args, IPC::Message* reply_message) { - WebContents* fullscreen_tab = browser->GetSelectedWebContents(); + WebContents* fullscreen_tab = browser->GetActiveWebContents(); FullscreenExitBubbleType type = browser->fullscreen_controller_->GetFullscreenExitBubbleType(); browser->OnAcceptFullscreenPermission(fullscreen_tab->GetURL(), type); @@ -6016,7 +6012,7 @@ void TestingAutomationProvider::GetIndicesFromTab( } int id = id_or_handle; if (has_handle) { - TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( + TabContents* tab = TabContents::GetOwningTabContentsForWebContents( tab_tracker_->GetResource(id_or_handle)->GetWebContents()); id = tab->restore_tab_helper()->session_id().id(); } @@ -6025,7 +6021,7 @@ void TestingAutomationProvider::GetIndicesFromTab( for (; iter != BrowserList::end(); ++iter, ++browser_index) { Browser* browser = *iter; for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { - TabContentsWrapper* tab = browser->GetTabContentsWrapperAt(tab_index); + TabContents* tab = browser->GetTabContentsAt(tab_index); if (tab->restore_tab_helper()->session_id().id() == id) { DictionaryValue dict; dict.SetInteger("windex", browser_index); @@ -6343,7 +6339,7 @@ void TestingAutomationProvider::CaptureEntirePageJSON( // This will delete itself when finished. PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( this, reply_message, - TabContentsWrapper::GetCurrentWrapperForContents(web_contents), path); + TabContents::GetOwningTabContentsForWebContents(web_contents), path); snapshot_taker->Start(); } else { AutomationJSONReply(this, reply_message) @@ -6373,7 +6369,7 @@ void TestingAutomationProvider::GetTabIds( for (; iter != BrowserList::end(); ++iter) { Browser* browser = *iter; for (int i = 0; i < browser->tab_count(); ++i) { - int id = browser->GetTabContentsWrapperAt(i)->restore_tab_helper()-> + int id = browser->GetTabContentsAt(i)->restore_tab_helper()-> session_id().id(); id_list->Append(Value::CreateIntegerValue(id)); } @@ -6392,13 +6388,13 @@ void TestingAutomationProvider::GetViews( for (; browser_iter != BrowserList::end(); ++browser_iter) { Browser* browser = *browser_iter; for (int i = 0; i < browser->tab_count(); ++i) { - TabContentsWrapper* tab = browser->GetTabContentsWrapperAt(i); + TabContents* tab = browser->GetTabContentsAt(i); DictionaryValue* dict = new DictionaryValue(); AutomationId id = automation_util::GetIdForTab(tab); dict->Set("auto_id", id.ToValue()); view_list->Append(dict); if (preview_controller) { - TabContentsWrapper* preview_tab = + TabContents* preview_tab = preview_controller->GetPrintPreviewForTab(tab); if (preview_tab) { DictionaryValue* dict = new DictionaryValue(); @@ -6445,7 +6441,7 @@ void TestingAutomationProvider::IsTabIdValid( for (; iter != BrowserList::end(); ++iter) { Browser* browser = *iter; for (int i = 0; i < browser->tab_count(); ++i) { - TabContentsWrapper* tab = browser->GetTabContentsWrapperAt(i); + TabContents* tab = browser->GetTabContentsAt(i); if (tab->restore_tab_helper()->session_id().id() == id) { is_valid = true; break; @@ -6652,7 +6648,7 @@ void TestingAutomationProvider::WaitForInfoBarCount( // The delegate will delete itself. new InfoBarCountObserver(this, reply_message, - TabContentsWrapper::GetCurrentWrapperForContents( + TabContents::GetOwningTabContentsForWebContents( controller->GetWebContents()), target_count); } @@ -6672,7 +6668,7 @@ void TestingAutomationProvider::OnRemoveProvider() { void TestingAutomationProvider::EnsureTabSelected(Browser* browser, WebContents* tab) { - if (browser->GetSelectedWebContents() != tab || + if (browser->GetActiveWebContents() != tab || browser != BrowserList::GetLastActive()) { browser->ActivateTabAt(browser->GetIndexOfController(&tab->GetController()), true /* user_gesture */); diff --git a/chrome/browser/external_tab/external_tab_container_win.cc b/chrome/browser/external_tab/external_tab_container_win.cc index 227c656..3802025 100644 --- a/chrome/browser/external_tab/external_tab_container_win.cc +++ b/chrome/browser/external_tab/external_tab_container_win.cc @@ -33,7 +33,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_dialogs.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/browser/ui/views/infobars/infobar_container_view.h" #include "chrome/common/automation_messages.h" #include "chrome/common/chrome_constants.h" @@ -150,7 +150,7 @@ bool ExternalTabContainer::Init(Profile* profile, DWORD style, bool load_requests_via_automation, bool handle_top_level_requests, - TabContentsWrapper* existing_contents, + TabContents* existing_contents, const GURL& initial_url, const GURL& referrer, bool infobars_enabled, @@ -185,7 +185,7 @@ bool ExternalTabContainer::Init(Profile* profile, } else { WebContents* new_contents = WebContents::Create( profile, NULL, MSG_ROUTING_NONE, NULL, NULL); - tab_contents_.reset(new TabContentsWrapper(new_contents)); + tab_contents_.reset(new TabContents(new_contents)); } if (!infobars_enabled) @@ -450,23 +450,23 @@ void ExternalTabContainer::AddNewContents(WebContents* source, // Make sure that ExternalTabContainer instance is initialized with // an unwrapped Profile. - scoped_ptr<TabContentsWrapper> wrapper(new TabContentsWrapper(new_contents)); + scoped_ptr<TabContents> tab_contents(new TabContents(new_contents)); bool result = new_container->Init( - wrapper->profile()->GetOriginalProfile(), + tab_contents->profile()->GetOriginalProfile(), NULL, initial_pos, WS_CHILD, load_requests_via_automation_, handle_top_level_requests_, - wrapper.get(), + tab_contents.get(), GURL(), GURL(), true, route_all_top_level_navigations_); if (result) { - Profile* profile = wrapper->profile(); - wrapper.release(); // Ownership has been transferred. + Profile* profile = tab_contents->profile(); + tab_contents.release(); // Ownership has been transferred. if (route_all_top_level_navigations_) { return; } @@ -521,8 +521,8 @@ void ExternalTabContainer::MoveContents(WebContents* source, automation_->Send(new AutomationMsg_MoveWindow(tab_handle_, pos)); } -TabContentsWrapper* ExternalTabContainer::GetConstrainingContentsWrapper( - TabContentsWrapper* source) { +TabContents* ExternalTabContainer::GetConstrainingContentsWrapper( + TabContents* source) { return source; } @@ -717,7 +717,7 @@ void ExternalTabContainer::ShowRepostFormWarningDialog( WebContents* source) { browser::ShowTabModalConfirmDialog( new RepostFormWarningController(source), - TabContentsWrapper::GetCurrentWrapperForContents(source)); + TabContents::GetOwningTabContentsForWebContents(source)); } void ExternalTabContainer::RunFileChooser( diff --git a/chrome/browser/external_tab/external_tab_container_win.h b/chrome/browser/external_tab/external_tab_container_win.h index e9a26d2..7610503 100644 --- a/chrome/browser/external_tab/external_tab_container_win.h +++ b/chrome/browser/external_tab/external_tab_container_win.h @@ -32,7 +32,6 @@ class Browser; class Profile; class TabContentsContainer; class TabContents; -typedef TabContents TabContentsWrapper; class RenderViewContextMenuViews; struct NavigationInfo; @@ -67,7 +66,7 @@ class ExternalTabContainer : public content::WebContentsDelegate, AutomationResourceMessageFilter* filter); content::WebContents* web_contents() const; - TabContentsWrapper* tab_contents_wrapper() { return tab_contents_.get(); } + TabContents* tab_contents() { return tab_contents_.get(); } // Temporary hack so we can send notifications back void SetTabHandle(int handle); @@ -82,7 +81,7 @@ class ExternalTabContainer : public content::WebContentsDelegate, DWORD style, bool load_requests_via_automation, bool handle_top_level_requests, - TabContentsWrapper* existing_tab_contents, + TabContents* existing_tab_contents, const GURL& initial_url, const GURL& referrer, bool infobars_enabled, @@ -245,8 +244,8 @@ class ExternalTabContainer : public content::WebContentsDelegate, void RunUnloadHandlers(IPC::Message* reply_message); // Overridden from BlockedContentTabHelperDelegate: - virtual TabContentsWrapper* GetConstrainingContentsWrapper( - TabContentsWrapper* source) OVERRIDE; + virtual TabContents* GetConstrainingContentsWrapper( + TabContents* source) OVERRIDE; protected: ~ExternalTabContainer(); @@ -284,7 +283,7 @@ class ExternalTabContainer : public content::WebContentsDelegate, // Creates and initializes the view hierarchy for this ExternalTabContainer. void SetupExternalTabView(); - scoped_ptr<TabContentsWrapper> tab_contents_; + scoped_ptr<TabContents> tab_contents_; scoped_refptr<AutomationProvider> automation_; content::NotificationRegistrar registrar_; |