diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 16:52:20 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 16:52:20 +0000 |
commit | 6acde635328db851483aa3f5a13eba8a687fe29d (patch) | |
tree | 966a1df295acd70d9e77209a538aa5201ebb330a | |
parent | 908da49b07a50a4062c770be8e7fdf8dfe34517b (diff) | |
download | chromium_src-6acde635328db851483aa3f5a13eba8a687fe29d.zip chromium_src-6acde635328db851483aa3f5a13eba8a687fe29d.tar.gz chromium_src-6acde635328db851483aa3f5a13eba8a687fe29d.tar.bz2 |
Replace Browser::GetTabContentsAt with GetWebContentsAt and update all callers.
BUG=98716
TBR=joi
Review URL: http://codereview.chromium.org/9085006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116322 0039d316-1c4b-4281-b951-d872f2087c98
75 files changed, 564 insertions, 524 deletions
diff --git a/chrome/browser/automation/automation_provider_json.cc b/chrome/browser/automation/automation_provider_json.cc index dfac829..1c1e3bd 100644 --- a/chrome/browser/automation/automation_provider_json.cc +++ b/chrome/browser/automation/automation_provider_json.cc @@ -14,10 +14,11 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/automation_id.h" #include "chrome/common/automation_messages.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" using automation::Error; using automation::ErrorCode; +using content::WebContents; AutomationJSONReply::AutomationJSONReply(AutomationProvider* provider, IPC::Message* reply_message) @@ -70,7 +71,7 @@ bool GetBrowserFromJSONArgs( AutomationId id; if (!GetAutomationIdFromJSONArgs(args, "auto_id", &id, error)) return false; - TabContents* tab; + WebContents* tab; if (!automation_util::GetTabForId(id, &tab)) { *error = "'auto_id' does not refer to an open tab"; return false; @@ -98,7 +99,7 @@ bool GetBrowserFromJSONArgs( bool GetTabFromJSONArgs( DictionaryValue* args, - TabContents** tab, + WebContents** tab, std::string* error) { if (args->HasKey("auto_id")) { AutomationId id; @@ -118,7 +119,7 @@ bool GetTabFromJSONArgs( *error = "'tab_index' missing or invalid"; return false; } - *tab = automation_util::GetTabContentsAt(browser_index, tab_index); + *tab = automation_util::GetWebContentsAt(browser_index, tab_index); if (!*tab) { *error = "Cannot locate tab from given indices"; return false; @@ -130,7 +131,7 @@ bool GetTabFromJSONArgs( bool GetBrowserAndTabFromJSONArgs( DictionaryValue* args, Browser** browser, - TabContents** tab, + WebContents** tab, std::string* error) { return GetBrowserFromJSONArgs(args, browser, error) && GetTabFromJSONArgs(args, tab, error); @@ -165,7 +166,7 @@ bool GetRenderViewFromJSONArgs( } } else { // If the render view id is not specified, check for browser/tab indices. - TabContents* tab = NULL; + WebContents* tab = NULL; if (!GetTabFromJSONArgs(args, &tab, error)) return false; *rvh = tab->GetRenderViewHost(); diff --git a/chrome/browser/automation/automation_provider_json.h b/chrome/browser/automation/automation_provider_json.h index 7b46879..9ca6e906 100644 --- a/chrome/browser/automation/automation_provider_json.h +++ b/chrome/browser/automation/automation_provider_json.h @@ -19,13 +19,16 @@ class Browser; class Extension; class Profile; class RenderViewHost; -class TabContents; namespace base { class DictionaryValue; class Value; } +namespace content { +class WebContents; +} + namespace IPC { class Message; } @@ -71,7 +74,7 @@ bool GetBrowserFromJSONArgs(base::DictionaryValue* args, // and a key 'tab_index' which refers to the index of the tab in that browser. // Returns true on success and sets |tab|. Otherwise, |error| will be set. bool GetTabFromJSONArgs(base::DictionaryValue* args, - TabContents** tab, + content::WebContents** tab, std::string* error) WARN_UNUSED_RESULT; // Gets the browser and tab specified by the given dictionary |args|. |args| @@ -81,7 +84,7 @@ bool GetTabFromJSONArgs(base::DictionaryValue* args, // will be set. bool GetBrowserAndTabFromJSONArgs(base::DictionaryValue* args, Browser** browser, - TabContents** tab, + content::WebContents** tab, std::string* error) WARN_UNUSED_RESULT; // Gets an automation ID from the given value in the given dicitionary |args|. diff --git a/chrome/browser/automation/automation_util.cc b/chrome/browser/automation/automation_util.cc index d077088..45fc0bb 100644 --- a/chrome/browser/automation/automation_util.cc +++ b/chrome/browser/automation/automation_util.cc @@ -29,8 +29,8 @@ #include "chrome/common/chrome_view_type.h" #include "chrome/common/extensions/extension.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/web_contents.h" #include "net/base/cookie_monster.h" #include "net/base/cookie_store.h" #include "net/url_request/url_request_context.h" @@ -137,21 +137,21 @@ Browser* GetBrowserAt(int index) { return *(BrowserList::begin() + index); } -TabContents* GetTabContentsAt(int browser_index, int tab_index) { +WebContents* GetWebContentsAt(int browser_index, int tab_index) { if (tab_index < 0) return NULL; Browser* browser = GetBrowserAt(browser_index); if (!browser || tab_index >= browser->tab_count()) return NULL; - return browser->GetTabContentsAt(tab_index); + return browser->GetWebContentsAt(tab_index); } -Browser* GetBrowserForTab(TabContents* tab) { +Browser* GetBrowserForTab(WebContents* tab) { BrowserList::const_iterator browser_iter = BrowserList::begin(); for (; browser_iter != BrowserList::end(); ++browser_iter) { Browser* browser = *browser_iter; for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { - if (browser->GetTabContentsAt(tab_index) == tab) + if (browser->GetWebContentsAt(tab_index) == tab) return browser; } } @@ -160,7 +160,7 @@ Browser* GetBrowserForTab(TabContents* tab) { net::URLRequestContextGetter* GetRequestContext(WebContents* contents) { // Since we may be on the UI thread don't call GetURLRequestContext(). - // Get the request context specific to the current TabContents and app. + // Get the request context specific to the current WebContents and app. return contents->GetBrowserContext()->GetRequestContextForRenderProcess( contents->GetRenderProcessHost()->GetID()); } @@ -438,7 +438,7 @@ AutomationId GetIdForExtension(const Extension* extension) { return AutomationId(AutomationId::kTypeExtension, extension->id()); } -bool GetTabForId(const AutomationId& id, TabContents** tab) { +bool GetTabForId(const AutomationId& id, WebContents** tab) { if (id.type() != AutomationId::kTypeTab) return false; @@ -449,7 +449,7 @@ bool GetTabForId(const AutomationId& id, TabContents** tab) { TabContentsWrapper* wrapper = browser->GetTabContentsWrapperAt(tab_index); if (base::IntToString(wrapper->restore_tab_helper()->session_id().id()) == id.id()) { - *tab = wrapper->tab_contents(); + *tab = wrapper->web_contents(); return true; } } @@ -486,7 +486,7 @@ bool GetRenderViewForId( RenderViewHost** rvh) { switch (id.type()) { case AutomationId::kTypeTab: { - TabContents* tab; + WebContents* tab; if (!GetTabForId(id, &tab)) return false; *rvh = tab->GetRenderViewHost(); @@ -521,7 +521,7 @@ bool GetExtensionForId( bool DoesObjectWithIdExist(const AutomationId& id, Profile* profile) { switch (id.type()) { case AutomationId::kTypeTab: { - TabContents* tab; + WebContents* tab; return GetTabForId(id, &tab); } case AutomationId::kTypeExtensionPopup: diff --git a/chrome/browser/automation/automation_util.h b/chrome/browser/automation/automation_util.h index 5143201..164bb2f 100644 --- a/chrome/browser/automation/automation_util.h +++ b/chrome/browser/automation/automation_util.h @@ -18,7 +18,6 @@ class ExtensionHost; class GURL; class Profile; class RenderViewHost; -class TabContents; class TabContentsWrapper; namespace content { @@ -43,10 +42,10 @@ Browser* GetBrowserAt(int index); // Returns the tab at |tab_index| within the browser at |browser_index| in the // |BrowserList|. If any of these indices are invalid, NULL will be returned. -TabContents* GetTabContentsAt(int browser_index, int tab_index); +content::WebContents* GetWebContentsAt(int browser_index, int tab_index); // Returns the browser that contains the given tab, or NULL if none exists. -Browser* GetBrowserForTab(TabContents* tab); +Browser* GetBrowserForTab(content::WebContents* tab); // Gets the size and value of the cookie string for |url| in the given tab. // Can be called from any thread. @@ -100,7 +99,7 @@ AutomationId GetIdForExtensionView(const ExtensionHost* ext_host); AutomationId GetIdForExtension(const Extension* extension); // Gets the tab for the given ID. Returns true on success. -bool GetTabForId(const AutomationId& id, TabContents** tab); +bool GetTabForId(const AutomationId& id, content::WebContents** tab); // Gets the render view for the given ID. Returns true on success. bool GetRenderViewForId(const AutomationId& id, diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 7473ec4..ad9fa67 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -117,13 +117,13 @@ #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/interstitial_page.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/plugin_service.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/ssl_status.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/child_process_host.h" #include "content/public/common/common_param_traits.h" #include "net/base/cookie_store.h" @@ -184,7 +184,7 @@ void SendMouseClick(int flags) { class AutomationInterstitialPage : public InterstitialPage { public: - AutomationInterstitialPage(TabContents* tab, + AutomationInterstitialPage(WebContents* tab, const GURL& url, const std::string& contents) : InterstitialPage(tab, true, url), @@ -1262,8 +1262,8 @@ void TestingAutomationProvider::GetTab(int win_handle, if (browser_tracker_->ContainsHandle(win_handle) && (tab_index >= 0)) { Browser* browser = browser_tracker_->GetResource(win_handle); if (tab_index < browser->tab_count()) { - TabContents* tab_contents = browser->GetTabContentsAt(tab_index); - *tab_handle = tab_tracker_->Add(&tab_contents->GetController()); + WebContents* web_contents = browser->GetWebContentsAt(tab_index); + *tab_handle = tab_tracker_->Add(&web_contents->GetController()); } } } @@ -1533,7 +1533,7 @@ void TestingAutomationProvider::ShowInterstitialPage( false, false); AutomationInterstitialPage* interstitial = - new AutomationInterstitialPage(static_cast<TabContents*>(web_contents), + new AutomationInterstitialPage(web_contents, GURL("about:interstitial"), html_text); interstitial->Show(); @@ -1627,8 +1627,7 @@ void TestingAutomationProvider::ActionOnSSLBlockingPage( if (entry->GetPageType() == content::PAGE_TYPE_INTERSTITIAL) { WebContents* web_contents = tab->GetWebContents(); InterstitialPage* ssl_blocking_page = - InterstitialPage::GetInterstitialPage( - static_cast<TabContents*>(web_contents)); + InterstitialPage::GetInterstitialPage(web_contents); if (ssl_blocking_page) { if (proceed) { new NavigationNotificationObserver(tab, this, reply_message, 1, @@ -2624,11 +2623,11 @@ void TestingAutomationProvider::SetWindowDimensions( AutomationJSONReply(this, reply_message).SendSuccess(NULL); } -ListValue* TestingAutomationProvider::GetInfobarsInfo(TabContents* tc) { +ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) { // Each infobar may have different properties depending on the type. ListValue* infobars = new ListValue; InfoBarTabHelper* infobar_helper = - TabContentsWrapper::GetCurrentWrapperForContents(tc)-> + TabContentsWrapper::GetCurrentWrapperForContents(wc)-> infobar_tab_helper(); for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { DictionaryValue* infobar_item = new DictionaryValue; @@ -2859,13 +2858,13 @@ void TestingAutomationProvider::GetBrowserInfo( // one dictionary item per tab. ListValue* tabs = new ListValue; for (int i = 0; i < browser->tab_count(); ++i) { - TabContents* tc = browser->GetTabContentsAt(i); + WebContents* wc = browser->GetWebContentsAt(i); DictionaryValue* tab = new DictionaryValue; tab->SetInteger("index", i); - tab->SetString("url", tc->GetURL().spec()); + tab->SetString("url", wc->GetURL().spec()); tab->SetInteger("renderer_pid", - base::GetProcId(tc->GetRenderProcessHost()->GetHandle())); - tab->Set("infobars", GetInfobarsInfo(tc)); + base::GetProcId(wc->GetRenderProcessHost()->GetHandle())); + tab->Set("infobars", GetInfobarsInfo(wc)); tab->SetBoolean("pinned", browser->IsTabPinned(i)); tabs->Append(tab); } @@ -2972,15 +2971,15 @@ void TestingAutomationProvider::GetNavigationInfo( IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); int tab_index; - TabContents* tab_contents = NULL; + WebContents* web_contents = NULL; if (!args->GetInteger("tab_index", &tab_index) || - !(tab_contents = browser->GetTabContentsAt(tab_index))) { + !(web_contents = browser->GetWebContentsAt(tab_index))) { reply.SendError("tab_index missing or invalid."); return; } scoped_ptr<DictionaryValue> return_value(new DictionaryValue); const content::NavigationController& controller = - tab_contents->GetController(); + web_contents->GetController(); NavigationEntry* nav_entry = controller.GetActiveEntry(); DCHECK(nav_entry); @@ -3561,8 +3560,8 @@ void TestingAutomationProvider::GetInstantInfo(Browser* browser, info->SetBoolean("active", (instant->GetPreviewContents() != NULL)); info->SetBoolean("current", instant->IsCurrent()); if (instant->GetPreviewContents() && - instant->GetPreviewContents()->tab_contents()) { - TabContents* contents = instant->GetPreviewContents()->tab_contents(); + instant->GetPreviewContents()->web_contents()) { + WebContents* contents = instant->GetPreviewContents()->web_contents(); info->SetBoolean("loading", contents->IsLoading()); info->SetString("location", contents->GetURL().spec()); info->SetString("title", contents->GetTitle()); @@ -3700,7 +3699,7 @@ void TestingAutomationProvider::SaveTabContents( int tab_index = 0; FilePath::StringType filename; FilePath::StringType parent_directory; - TabContents* tab_contents = NULL; + WebContents* web_contents = NULL; if (!args->GetInteger("tab_index", &tab_index) || !args->GetString("filename", &filename)) { @@ -3708,8 +3707,8 @@ void TestingAutomationProvider::SaveTabContents( .SendError("tab_index or filename param missing"); return; } else { - tab_contents = browser->GetTabContentsAt(tab_index); - if (!tab_contents) { + web_contents = browser->GetWebContentsAt(tab_index); + if (!web_contents) { AutomationJSONReply(this, reply_message).SendError("no tab at tab_index"); return; } @@ -3717,7 +3716,7 @@ void TestingAutomationProvider::SaveTabContents( // We're doing a SAVE_AS_ONLY_HTML so the the directory path isn't // used. Nevertheless, SavePackage requires it be valid. Sigh. parent_directory = FilePath(filename).DirName().value(); - if (!tab_contents->SavePage( + if (!web_contents->SavePage( FilePath(filename), FilePath(parent_directory), SavePackage::SAVE_AS_ONLY_HTML)) { @@ -4033,9 +4032,9 @@ TabContentsWrapper* GetTabContentsWrapperFromDict(const Browser* browser, // Get the TranslateInfoBarDelegate from TabContents. TranslateInfoBarDelegate* GetTranslateInfoBarDelegate( - TabContents* tab_contents) { + WebContents* web_contents) { InfoBarTabHelper* infobar_helper = - TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> + TabContentsWrapper::GetCurrentWrapperForContents(web_contents)-> infobar_tab_helper(); for (size_t i = 0; i < infobar_helper->infobar_count(); i++) { InfoBarDelegate* infobar = infobar_helper->GetInfoBarDelegateAt(i); @@ -4083,7 +4082,7 @@ void TestingAutomationProvider::FindInPage( SendError("Must include find_next boolean."); return; } - SendFindRequest(tab_contents->tab_contents(), + SendFindRequest(tab_contents->web_contents(), true, search_string, forward, @@ -4106,22 +4105,22 @@ void TestingAutomationProvider::GetTranslateInfo( return; } - TabContents* tab_contents = tab_contents_wrapper->tab_contents(); + WebContents* web_contents = tab_contents_wrapper->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 = - GetTranslateInfoBarDelegate(tab_contents); + GetTranslateInfoBarDelegate(web_contents); TabLanguageDeterminedObserver* observer = new TabLanguageDeterminedObserver( - this, reply_message, tab_contents, translate_bar); + 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( - tab_contents)->translate_tab_helper(); + web_contents)->translate_tab_helper(); std::string language = helper->language_state().original_language(); if (!language.empty()) { observer->Observe(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, - content::Source<WebContents>(tab_contents), + content::Source<WebContents>(web_contents), content::Details<std::string>(&language)); } } @@ -4142,9 +4141,9 @@ void TestingAutomationProvider::SelectTranslateOption( return; } - TabContents* tab_contents = tab_contents_wrapper->tab_contents(); + WebContents* web_contents = tab_contents_wrapper->web_contents(); TranslateInfoBarDelegate* translate_bar = - GetTranslateInfoBarDelegate(tab_contents); + GetTranslateInfoBarDelegate(web_contents); if (!translate_bar) { AutomationJSONReply(this, reply_message) .SendError("There is no translate bar open."); @@ -4158,7 +4157,7 @@ void TestingAutomationProvider::SelectTranslateOption( if (option == "translate_page") { // Make a new notification observer which will send the reply. - new PageTranslatedObserver(this, reply_message, tab_contents); + new PageTranslatedObserver(this, reply_message, web_contents); translate_bar->Translate(); return; } else if (option == "set_target_language") { @@ -4185,7 +4184,7 @@ void TestingAutomationProvider::SelectTranslateOption( // the new language. The observer will wait until the page has been // translated to reply. if (translate_bar->type() == TranslateInfoBarDelegate::AFTER_TRANSLATE) { - new PageTranslatedObserver(this, reply_message, tab_contents); + new PageTranslatedObserver(this, reply_message, web_contents); translate_bar->SetTargetLanguage(target_language_index); return; } @@ -4203,7 +4202,7 @@ void TestingAutomationProvider::SelectTranslateOption( } // Clicking 'Always Translate' triggers a translation. The observer will // wait until the translation is complete before sending the reply. - new PageTranslatedObserver(this, reply_message, tab_contents); + new PageTranslatedObserver(this, reply_message, web_contents); translate_bar->AlwaysTranslatePageLanguage(); return; } @@ -4271,8 +4270,8 @@ void TestingAutomationProvider::GetBlockedPopupsInfo( for (std::vector<TabContentsWrapper*>::const_iterator it = blocked_contents.begin(); it != blocked_contents.end(); ++it) { DictionaryValue* item = new DictionaryValue; - item->SetString("url", (*it)->tab_contents()->GetURL().spec()); - item->SetString("title", (*it)->tab_contents()->GetTitle()); + item->SetString("url", (*it)->web_contents()->GetURL().spec()); + item->SetString("title", (*it)->web_contents()->GetTitle()); blocked_popups_list->Append(item); } return_value->Set("blocked_popups", blocked_popups_list); @@ -4553,10 +4552,10 @@ void TestingAutomationProvider::SetExtensionStateById( namespace { // Selects the given |browser| and |tab| if not selected already. -void EnsureTabSelected(Browser* browser, TabContents* tab) { +void EnsureTabSelected(Browser* browser, WebContents* tab) { TabContentsWrapper* active = browser->tabstrip_model()->GetActiveTabContents(); - if (!active || active->tab_contents() != tab || + if (!active || active->web_contents() != tab || browser != BrowserList::GetLastActive()) { browser->ActivateTabAt( browser->tabstrip_model()->GetIndexOfController(&tab->GetController()), @@ -4573,7 +4572,7 @@ void TestingAutomationProvider::TriggerPageActionById( IPC::Message* reply_message) { std::string error; Browser* browser; - TabContents* tab; + WebContents* tab; if (!GetBrowserAndTabFromJSONArgs(args, &browser, &tab, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; @@ -4626,7 +4625,7 @@ void TestingAutomationProvider::TriggerBrowserActionById( IPC::Message* reply_message) { std::string error; Browser* browser; - TabContents* tab; + WebContents* tab; if (!GetBrowserAndTabFromJSONArgs(args, &browser, &tab, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; @@ -4850,9 +4849,9 @@ void TestingAutomationProvider::SubmitAutofillForm( base::SStringPrintf(&set_automation_id, "window.domAutomationController.setAutomationId(%d);", reply_message->routing_id()); - tab_contents->tab_contents()->GetRenderViewHost()-> + tab_contents->web_contents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(frame_xpath, UTF8ToUTF16(set_automation_id)); - tab_contents->tab_contents()->GetRenderViewHost()-> + tab_contents->web_contents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(frame_xpath, javascript); } @@ -4867,8 +4866,8 @@ void TestingAutomationProvider::AutofillTriggerSuggestions( return; } - TabContents* tab_contents = browser->GetTabContentsAt(tab_index); - if (!tab_contents) { + WebContents* web_contents = browser->GetWebContentsAt(tab_index); + if (!web_contents) { AutomationJSONReply(this, reply_message).SendError( StringPrintf("No such tab at index %d", tab_index)); return; @@ -4876,8 +4875,8 @@ void TestingAutomationProvider::AutofillTriggerSuggestions( new AutofillDisplayedObserver( chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, - tab_contents->GetRenderViewHost(), this, reply_message); - SendWebKeyPressEventAsync(ui::VKEY_DOWN, tab_contents); + web_contents->GetRenderViewHost(), this, reply_message); + SendWebKeyPressEventAsync(ui::VKEY_DOWN, web_contents); } void TestingAutomationProvider::AutofillHighlightSuggestion( @@ -4891,8 +4890,8 @@ void TestingAutomationProvider::AutofillHighlightSuggestion( return; } - TabContents* tab_contents = browser->GetTabContentsAt(tab_index); - if (!tab_contents) { + WebContents* web_contents = browser->GetWebContentsAt(tab_index); + if (!web_contents) { AutomationJSONReply(this, reply_message).SendError( StringPrintf("No such tab at index %d", tab_index)); return; @@ -4909,8 +4908,8 @@ void TestingAutomationProvider::AutofillHighlightSuggestion( new AutofillDisplayedObserver( chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, - tab_contents->GetRenderViewHost(), this, reply_message); - SendWebKeyPressEventAsync(key_code, tab_contents); + web_contents->GetRenderViewHost(), this, reply_message); + SendWebKeyPressEventAsync(key_code, web_contents); } void TestingAutomationProvider::AutofillAcceptSelection( @@ -4924,8 +4923,8 @@ void TestingAutomationProvider::AutofillAcceptSelection( return; } - TabContents* tab_contents = browser->GetTabContentsAt(tab_index); - if (!tab_contents) { + WebContents* web_contents = browser->GetWebContentsAt(tab_index); + if (!web_contents) { AutomationJSONReply(this, reply_message).SendError( StringPrintf("No such tab at index %d", tab_index)); return; @@ -4933,8 +4932,8 @@ void TestingAutomationProvider::AutofillAcceptSelection( new AutofillDisplayedObserver( chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, - tab_contents->GetRenderViewHost(), this, reply_message); - SendWebKeyPressEventAsync(ui::VKEY_RETURN, tab_contents); + web_contents->GetRenderViewHost(), this, reply_message); + SendWebKeyPressEventAsync(ui::VKEY_RETURN, web_contents); } // Sample json output: { "success": true } @@ -5662,17 +5661,17 @@ void TestingAutomationProvider::BuildSimpleWebKeyEvent( void TestingAutomationProvider::SendWebKeyPressEventAsync( int key_code, - TabContents* tab_contents) { + WebContents* web_contents) { // Create and send a "key down" event for the specified key code. NativeWebKeyboardEvent event_down; BuildSimpleWebKeyEvent(WebKit::WebInputEvent::RawKeyDown, key_code, &event_down); - tab_contents->GetRenderViewHost()->ForwardKeyboardEvent(event_down); + web_contents->GetRenderViewHost()->ForwardKeyboardEvent(event_down); // Create and send a corresponding "key up" event. NativeWebKeyboardEvent event_up; BuildSimpleWebKeyEvent(WebKit::WebInputEvent::KeyUp, key_code, &event_up); - tab_contents->GetRenderViewHost()->ForwardKeyboardEvent(event_up); + web_contents->GetRenderViewHost()->ForwardKeyboardEvent(event_up); } void TestingAutomationProvider::SendWebkitKeyEvent( @@ -5720,15 +5719,15 @@ void TestingAutomationProvider::SendOSLevelKeyEventToTab( std::string error; Browser* browser; - TabContents* tab_contents; - if (!GetBrowserAndTabFromJSONArgs(args, &browser, &tab_contents, &error)) { + WebContents* web_contents; + if (!GetBrowserAndTabFromJSONArgs(args, &browser, &web_contents, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } // The key events will be sent to the browser window, we need the current tab // containing the element we send the text in to be shown. browser->ActivateTabAt( - browser->GetIndexOfController(&tab_contents->GetController()), true); + browser->GetIndexOfController(&web_contents->GetController()), true); BrowserWindow* browser_window = browser->window(); if (!browser_window) { @@ -6090,8 +6089,8 @@ void TestingAutomationProvider::NavigateToURL( int navigation_count; std::string url, error; Browser* browser; - TabContents* tab_contents; - if (!GetBrowserAndTabFromJSONArgs(args, &browser, &tab_contents, &error)) { + WebContents* web_contents; + if (!GetBrowserAndTabFromJSONArgs(args, &browser, &web_contents, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } @@ -6106,9 +6105,9 @@ void TestingAutomationProvider::NavigateToURL( return; } new NavigationNotificationObserver( - &tab_contents->GetController(), this, reply_message, + &web_contents->GetController(), this, reply_message, navigation_count, false, true); - browser->OpenURLFromTab(tab_contents, OpenURLParams( + browser->OpenURLFromTab(web_contents, OpenURLParams( GURL(url), content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); } @@ -6188,13 +6187,13 @@ void TestingAutomationProvider::GoForward( if (SendErrorIfModalDialogActive(this, reply_message)) return; - TabContents* tab_contents; + WebContents* web_contents; std::string error; - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { + if (!GetTabFromJSONArgs(args, &web_contents, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } - content::NavigationController& controller = tab_contents->GetController(); + content::NavigationController& controller = web_contents->GetController(); if (!controller.CanGoForward()) { DictionaryValue dict; dict.SetBoolean("did_go_forward", false); @@ -6212,13 +6211,13 @@ void TestingAutomationProvider::GoBack( if (SendErrorIfModalDialogActive(this, reply_message)) return; - TabContents* tab_contents; + WebContents* web_contents; std::string error; - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { + if (!GetTabFromJSONArgs(args, &web_contents, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } - content::NavigationController& controller = tab_contents->GetController(); + content::NavigationController& controller = web_contents->GetController(); if (!controller.CanGoBack()) { DictionaryValue dict; dict.SetBoolean("did_go_back", false); @@ -6236,13 +6235,13 @@ void TestingAutomationProvider::ReloadJSON( if (SendErrorIfModalDialogActive(this, reply_message)) return; - TabContents* tab_contents; + WebContents* web_contents; std::string error; - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { + if (!GetTabFromJSONArgs(args, &web_contents, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } - content::NavigationController& controller = tab_contents->GetController(); + content::NavigationController& controller = web_contents->GetController(); new NavigationNotificationObserver(&controller, this, reply_message, 1, false, true); controller.Reload(false); @@ -6254,10 +6253,10 @@ void TestingAutomationProvider::CaptureEntirePageJSON( if (SendErrorIfModalDialogActive(this, reply_message)) return; - TabContents* tab_contents; + WebContents* web_contents; std::string error; - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { + if (!GetTabFromJSONArgs(args, &web_contents, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } @@ -6269,13 +6268,13 @@ void TestingAutomationProvider::CaptureEntirePageJSON( return; } - RenderViewHost* render_view = tab_contents->GetRenderViewHost(); + RenderViewHost* render_view = web_contents->GetRenderViewHost(); if (render_view) { FilePath path(path_str); // This will delete itself when finished. PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( this, reply_message, - TabContentsWrapper::GetCurrentWrapperForContents(tab_contents), path); + TabContentsWrapper::GetCurrentWrapperForContents(web_contents), path); snapshot_taker->Start(); } else { AutomationJSONReply(this, reply_message) @@ -6394,7 +6393,7 @@ void TestingAutomationProvider::CloseTabJSON( DictionaryValue* args, IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); Browser* browser; - TabContents* tab; + WebContents* tab; std::string error; // Close tabs synchronously. if (GetBrowserAndTabFromJSONArgs(args, &browser, &tab, &error)) { @@ -6421,14 +6420,14 @@ void TestingAutomationProvider::ActivateTabJSON( AutomationJSONReply reply(this, reply_message); Browser* browser; - TabContents* tab_contents; + WebContents* web_contents; std::string error; - if (!GetBrowserAndTabFromJSONArgs(args, &browser, &tab_contents, &error)) { + if (!GetBrowserAndTabFromJSONArgs(args, &browser, &web_contents, &error)) { reply.SendError(error); return; } browser->ActivateTabAt( - browser->GetIndexOfController(&tab_contents->GetController()), true); + browser->GetIndexOfController(&web_contents->GetController()), true); reply.SendSuccess(NULL); } @@ -6470,7 +6469,7 @@ void TestingAutomationProvider::IsPageActionVisible( IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); - TabContents* tab; + WebContents* tab; std::string error; if (!GetTabFromJSONArgs(args, &tab, &error)) { reply.SendError(error); diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index c9c4b0c..5ae029f 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -388,11 +388,11 @@ class TestingAutomationProvider : public AutomationProvider, base::DictionaryValue* args, IPC::Message* reply_message); - // Get info about infobars in the given TabContents object. + // Get info about infobars in the given WebContents object. // This includes info about the type of infobars, the message text, // buttons, etc. // Caller owns the returned object. - ListValue* GetInfobarsInfo(TabContents* tc); + ListValue* GetInfobarsInfo(content::WebContents* tc); // Perform actions on an infobar like dismiss, accept, cancel. // Uses the JSON interface for input/output. @@ -855,7 +855,7 @@ class TestingAutomationProvider : public AutomationProvider, // A key press is a combination of a "key down" event and a "key up" event. // This function does not wait before returning. void SendWebKeyPressEventAsync(int key_code, - TabContents* tab_contents); + content::WebContents* web_contents); // Launches the specified app from the currently-selected tab. void LaunchApp(Browser* browser, diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index dae8644..86cb8f59 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -25,8 +25,8 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/common/pref_names.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/page_navigator.h" +#include "content/public/browser/web_contents.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/ui_strings.h" @@ -674,7 +674,7 @@ void GetURLsForOpenTabs( std::vector<std::pair<GURL, string16> >* urls) { for (int i = 0; i < browser->tab_count(); ++i) { std::pair<GURL, string16> entry; - GetURLAndTitleToBookmark(browser->GetTabContentsAt(i), &(entry.first), + GetURLAndTitleToBookmark(browser->GetWebContentsAt(i), &(entry.first), &(entry.second)); urls->push_back(entry); } diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc index da0b2a0..9558dd9 100644 --- a/chrome/browser/browser_commands_unittest.cc +++ b/chrome/browser/browser_commands_unittest.cc @@ -8,15 +8,16 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/testing_profile.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/web_contents.h" #include "content/test/test_browser_thread.h" typedef BrowserWithTestWindowTest BrowserCommandsTest; using content::OpenURLParams; using content::Referrer; +using content::WebContents; // Tests IDC_SELECT_TAB_0, IDC_SELECT_NEXT_TAB, IDC_SELECT_PREVIOUS_TAB and // IDC_SELECT_LAST_TAB. @@ -73,7 +74,7 @@ TEST_F(BrowserCommandsTest, DuplicateTab) { // Verify the stack of urls. content::NavigationController& controller = - browser()->GetTabContentsAt(1)->GetController(); + browser()->GetWebContentsAt(1)->GetController(); ASSERT_EQ(3, controller.GetEntryCount()); ASSERT_EQ(2, controller.GetCurrentEntryIndex()); ASSERT_TRUE(url1 == controller.GetEntryAtIndex(0)->GetURL()); @@ -120,14 +121,14 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) { ASSERT_EQ(2, browser()->tab_count()); // The original tab should be unchanged. - TabContents* zeroth = browser()->GetTabContentsAt(0); + WebContents* zeroth = browser()->GetWebContentsAt(0); EXPECT_EQ(url2, zeroth->GetURL()); EXPECT_TRUE(zeroth->GetController().CanGoBack()); EXPECT_FALSE(zeroth->GetController().CanGoForward()); // The new tab should be like the first one but navigated back. - TabContents* first = browser()->GetTabContentsAt(1); - EXPECT_EQ(url1, browser()->GetTabContentsAt(1)->GetURL()); + WebContents* first = browser()->GetWebContentsAt(1); + EXPECT_EQ(url1, browser()->GetWebContentsAt(1)->GetURL()); EXPECT_FALSE(first->GetController().CanGoBack()); EXPECT_TRUE(first->GetController().CanGoForward()); @@ -149,7 +150,7 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) { // There should be a new tab navigated forward. ASSERT_EQ(3, browser()->tab_count()); - TabContents* second = browser()->GetTabContentsAt(2); + WebContents* second = browser()->GetWebContentsAt(2); EXPECT_EQ(url2, second->GetURL()); EXPECT_TRUE(second->GetController().CanGoBack()); EXPECT_FALSE(second->GetController().CanGoForward()); diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index fc59670..799548a 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -24,9 +24,9 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/interstitial_page.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "net/test/test_server.h" #if defined(TOOLKIT_VIEWS) || defined(OS_WIN) @@ -298,7 +298,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { // Activate the location bar or the page. if (kFocusPage[i][j]) { - browser()->GetTabContentsAt(j)->GetView()->Focus(); + browser()->GetWebContentsAt(j)->GetView()->Focus(); } else { browser()->FocusLocationBar(); } diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index a3064b4..c94ff75 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc @@ -18,10 +18,10 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "net/test/test_server.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -143,7 +143,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { ASSERT_LT(tab_index, browser()->tab_count()); bool actual; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetTabContentsAt(tab_index)->GetRenderViewHost(), + browser()->GetWebContentsAt(tab_index)->GetRenderViewHost(), L"", base::StringPrintf(kSuppressEventJS, type, GetBoolString(!suppress)), &actual)); @@ -169,7 +169,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { void GetResultLength(int tab_index, int* length) { ASSERT_LT(tab_index, browser()->tab_count()); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( - browser()->GetTabContentsAt(tab_index)->GetRenderViewHost(), + browser()->GetWebContentsAt(tab_index)->GetRenderViewHost(), L"", kGetResultLengthJS, length)); } @@ -181,7 +181,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { for (int i = 0; i < actual_length; ++i) { std::string actual; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetTabContentsAt(tab_index)->GetRenderViewHost(), + browser()->GetWebContentsAt(tab_index)->GetRenderViewHost(), L"", base::StringPrintf(kGetResultJS, i), &actual)); // If more events were received than expected, then the additional events @@ -197,7 +197,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { ASSERT_LT(tab_index, browser()->tab_count()); std::string actual; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetTabContentsAt(tab_index)->GetRenderViewHost(), + browser()->GetWebContentsAt(tab_index)->GetRenderViewHost(), L"", kGetFocusedElementJS, &actual)); ASSERT_EQ(WideToUTF8(focused), actual); } @@ -206,7 +206,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { ASSERT_LT(tab_index, browser()->tab_count()); bool actual; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetTabContentsAt(tab_index)->GetRenderViewHost(), + browser()->GetWebContentsAt(tab_index)->GetRenderViewHost(), L"", base::StringPrintf(kSetFocusedElementJS, focused), &actual)); @@ -218,7 +218,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { ASSERT_LT(tab_index, browser()->tab_count()); std::string actual; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetTabContentsAt(tab_index)->GetRenderViewHost(), + browser()->GetWebContentsAt(tab_index)->GetRenderViewHost(), L"", base::StringPrintf(kGetTextBoxValueJS, id), &actual)); @@ -230,7 +230,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { ASSERT_LT(tab_index, browser()->tab_count()); std::string actual; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetTabContentsAt(tab_index)->GetRenderViewHost(), + browser()->GetWebContentsAt(tab_index)->GetRenderViewHost(), L"", base::StringPrintf(kSetTextBoxValueJS, id, value), &actual)); @@ -241,7 +241,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { ASSERT_LT(tab_index, browser()->tab_count()); bool actual; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetTabContentsAt(tab_index)->GetRenderViewHost(), + browser()->GetWebContentsAt(tab_index)->GetRenderViewHost(), L"", base::StringPrintf(kStartTestJS, result_length), &actual)); ASSERT_TRUE(actual); } @@ -261,7 +261,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { // because the test finished message might be arrived before returning // from the SendKeyPressSync() method. TestFinishObserver finish_observer( - browser()->GetTabContentsAt(tab_index)->GetRenderViewHost()); + browser()->GetWebContentsAt(tab_index)->GetRenderViewHost()); ASSERT_TRUE(ui_test_utils::SendKeyPressSync( browser(), test.key, test.ctrl, test.shift, test.alt, test.command)); @@ -713,7 +713,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) { ui_test_utils::WindowedNotificationObserver wait_for_tab_closed( content::NOTIFICATION_TAB_CLOSED, content::Source<content::NavigationController>( - &browser()->GetTabContentsAt(1)->GetController())); + &browser()->GetWebContentsAt(1)->GetController())); // Press Ctrl/Cmd+W, which will close the tab. #if defined(OS_MACOSX) diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index 37f7e54..32aeaaf 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -27,10 +27,10 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "content/browser/renderer_host/render_widget_host_view.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" using content::BrowserThread; using content::WebContents; @@ -55,7 +55,7 @@ const std::string GetTabUrl(RenderWidgetHost* rwh) { ++it) { Browser* browser = *it; for (int i = 0, tab_count = browser->tab_count(); i < tab_count; ++i) { - TabContents* tab = browser->GetTabContentsAt(i); + WebContents* tab = browser->GetWebContentsAt(i); if (tab->GetRenderWidgetHostView() == rwhv) { return tab->GetURL().spec(); } diff --git a/chrome/browser/chromeos/tab_closeable_state_watcher.cc b/chrome/browser/chromeos/tab_closeable_state_watcher.cc index 9b71e130..9d4c3d8 100644 --- a/chrome/browser/chromeos/tab_closeable_state_watcher.cc +++ b/chrome/browser/chromeos/tab_closeable_state_watcher.cc @@ -12,9 +12,9 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" namespace chromeos { @@ -117,7 +117,7 @@ bool TabCloseableStateWatcher::CanCloseTabs(const Browser* browser, // This is the main purpose of this method CanCloseTabs. for (size_t i = 0; i < indices->size(); ++i) { if ((*indices)[i] == 0) { - if (tabstrip_model->GetTabContentsAt(0)->tab_contents()->GetURL() == + if (tabstrip_model->GetTabContentsAt(0)->web_contents()->GetURL() == GURL(chrome::kChromeUINewTabURL)) { // First tab is NewTabPage. indices->erase(indices->begin() + i); // Don't close it. return false; @@ -243,7 +243,7 @@ void TabCloseableStateWatcher::CheckAndUpdateState( TabStripModel* tabstrip_model = browser_to_check->tabstrip_model(); if (tabstrip_model->count() == 1) { new_can_close = - tabstrip_model->GetTabContentsAt(0)->tab_contents()->GetURL() != + tabstrip_model->GetTabContentsAt(0)->web_contents()->GetURL() != GURL(chrome::kChromeUINewTabURL); // Tab is not NewTabPage. } else { new_can_close = true; diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc index e1e2ab7..d57c3e7 100644 --- a/chrome/browser/custom_home_pages_table_model.cc +++ b/chrome/browser/custom_home_pages_table_model.cc @@ -14,7 +14,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "grit/ui_resources.h" @@ -171,7 +171,7 @@ void CustomHomePagesTableModel::SetToCurrentlyOpenPages() { continue; // Skip incognito browsers. for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { - const GURL url = browser->GetTabContentsAt(tab_index)->GetURL(); + const GURL url = browser->GetWebContentsAt(tab_index)->GetURL(); if (!url.is_empty() && !(url.SchemeIs(chrome::kChromeUIScheme) && url.host() == chrome::kChromeUISettingsHost)) diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc index bfafa5e..0a65355 100644 --- a/chrome/browser/debugger/devtools_sanity_unittest.cc +++ b/chrome/browser/debugger/devtools_sanity_unittest.cc @@ -24,7 +24,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/worker_host/worker_process_host.h" #include "content/public/browser/devtools_agent_host_registry.h" #include "content/public/browser/devtools_client_host.h" @@ -32,6 +32,7 @@ #include "content/public/browser/content_browser_client.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "content/public/browser/worker_service.h" #include "content/public/browser/worker_service_observer.h" #include "net/test/test_server.h" @@ -40,6 +41,7 @@ using content::BrowserThread; using content::DevToolsManager; using content::DevToolsAgentHost; using content::DevToolsAgentHostRegistry; +using content::WebContents; using content::WorkerService; using content::WorkerServiceObserver; @@ -143,8 +145,8 @@ class DevToolsSanityTest : public InProcessBrowserTest { observer.Wait(); } - TabContents* GetInspectedTab() { - return browser()->GetTabContentsAt(0); + WebContents* GetInspectedTab() { + return browser()->GetWebContentsAt(0); } void CloseDevToolsWindow() { @@ -408,7 +410,7 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { agent_host, window_->devtools_client_host()); RenderViewHost* client_rvh = window_->GetRenderViewHost(); - TabContents* client_contents = client_rvh->delegate()->GetAsTabContents(); + WebContents* client_contents = client_rvh->delegate()->GetAsWebContents(); if (client_contents->IsLoading()) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index a16e9d1..45fe001 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -18,9 +18,9 @@ #include "chrome/common/string_ordinal.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "content/test/test_navigation_observer.h" #include "net/base/mock_host_resolver.h" @@ -68,7 +68,7 @@ static void WindowOpenHelper(Browser* browser, } // Simulates a page navigating itself to an URL, and waits for the navigation. -static void NavigateTabHelper(TabContents* contents, const GURL& url) { +static void NavigateTabHelper(WebContents* contents, const GURL& url) { bool result = false; ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, @@ -111,16 +111,16 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { browser(), base_url.Resolve("path1/empty.html"), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(1)->GetRenderProcessHost()->GetID())); - EXPECT_FALSE(browser()->GetTabContentsAt(1)->GetWebUI()); + browser()->GetWebContentsAt(1)->GetRenderProcessHost()->GetID())); + EXPECT_FALSE(browser()->GetWebContentsAt(1)->GetWebUI()); LOG(INFO) << "Nav 1."; ui_test_utils::NavigateToURLWithDisposition( browser(), base_url.Resolve("path2/empty.html"), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(2)->GetRenderProcessHost()->GetID())); - EXPECT_FALSE(browser()->GetTabContentsAt(2)->GetWebUI()); + browser()->GetWebContentsAt(2)->GetRenderProcessHost()->GetID())); + EXPECT_FALSE(browser()->GetWebContentsAt(2)->GetWebUI()); LOG(INFO) << "Nav 2."; ui_test_utils::WindowedNotificationObserver tab_added_observer( @@ -132,20 +132,20 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path3/empty.html")); LOG(INFO) << "Nav 3."; EXPECT_FALSE(process_map->Contains( - browser()->GetTabContentsAt(3)->GetRenderProcessHost()->GetID())); - EXPECT_FALSE(browser()->GetTabContentsAt(3)->GetWebUI()); + browser()->GetWebContentsAt(3)->GetRenderProcessHost()->GetID())); + EXPECT_FALSE(browser()->GetWebContentsAt(3)->GetWebUI()); // We should have opened 3 new extension tabs. Including the original blank // tab, we now have 4 tabs. Because the app_process app has the background // permission, all of its instances are in the same process. Thus two tabs // should be part of the extension app and grouped in the same process. ASSERT_EQ(4, browser()->tab_count()); - RenderViewHost* host = browser()->GetTabContentsAt(1)->GetRenderViewHost(); + RenderViewHost* host = browser()->GetWebContentsAt(1)->GetRenderViewHost(); EXPECT_EQ(host->process(), - browser()->GetTabContentsAt(2)->GetRenderProcessHost()); + browser()->GetWebContentsAt(2)->GetRenderProcessHost()); EXPECT_NE(host->process(), - browser()->GetTabContentsAt(3)->GetRenderProcessHost()); + browser()->GetWebContentsAt(3)->GetRenderProcessHost()); // Now let's do the same using window.open. The same should happen. ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); @@ -167,27 +167,27 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { // extent. They should switch processes. const GURL& app_url(base_url.Resolve("path1/empty.html")); const GURL& non_app_url(base_url.Resolve("path3/empty.html")); - NavigateTabHelper(browser()->GetTabContentsAt(2), non_app_url); + NavigateTabHelper(browser()->GetWebContentsAt(2), non_app_url); LOG(INFO) << "NavigateTabHelper 1."; - NavigateTabHelper(browser()->GetTabContentsAt(3), app_url); + NavigateTabHelper(browser()->GetWebContentsAt(3), app_url); LOG(INFO) << "NavigateTabHelper 2."; // TODO(creis): This should swap out of the app's process (i.e., EXPECT_NE), // but we temporarily avoid swapping away from an app in case the window // tries to send a postMessage to the app. See crbug.com/59285. EXPECT_EQ(host->process(), - browser()->GetTabContentsAt(2)->GetRenderProcessHost()); + browser()->GetWebContentsAt(2)->GetRenderProcessHost()); EXPECT_EQ(host->process(), - browser()->GetTabContentsAt(3)->GetRenderProcessHost()); + browser()->GetWebContentsAt(3)->GetRenderProcessHost()); // If one of the popup tabs navigates back to the app, window.opener should // be valid. - NavigateTabHelper(browser()->GetTabContentsAt(6), app_url); + NavigateTabHelper(browser()->GetWebContentsAt(6), app_url); LOG(INFO) << "NavigateTabHelper 3."; EXPECT_EQ(host->process(), - browser()->GetTabContentsAt(6)->GetRenderProcessHost()); + browser()->GetWebContentsAt(6)->GetRenderProcessHost()); bool windowOpenerValid = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetTabContentsAt(6)->GetRenderViewHost(), L"", + browser()->GetWebContentsAt(6)->GetRenderViewHost(), L"", L"window.domAutomationController.send(window.opener != null)", &windowOpenerValid)); ASSERT_TRUE(windowOpenerValid); @@ -223,8 +223,8 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessInstances) { ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); LOG(INFO) << "Nav 1."; EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(1)->GetRenderProcessHost()->GetID())); - EXPECT_FALSE(browser()->GetTabContentsAt(1)->GetWebUI()); + browser()->GetWebContentsAt(1)->GetRenderProcessHost()->GetID())); + EXPECT_FALSE(browser()->GetWebContentsAt(1)->GetWebUI()); ui_test_utils::WindowedNotificationObserver tab_added_observer( content::NOTIFICATION_TAB_ADDED, @@ -235,16 +235,16 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessInstances) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path2/empty.html")); LOG(INFO) << "Nav 2."; EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(2)->GetRenderProcessHost()->GetID())); - EXPECT_FALSE(browser()->GetTabContentsAt(2)->GetWebUI()); + browser()->GetWebContentsAt(2)->GetRenderProcessHost()->GetID())); + EXPECT_FALSE(browser()->GetWebContentsAt(2)->GetWebUI()); // We should have opened 2 new extension tabs. Including the original blank // tab, we now have 3 tabs. The two app tabs should not be in the same // process, since they do not have the background permission. (Thus, we want // to separate them to improve responsiveness.) ASSERT_EQ(3, browser()->tab_count()); - RenderViewHost* host1 = browser()->GetTabContentsAt(1)->GetRenderViewHost(); - RenderViewHost* host2 = browser()->GetTabContentsAt(2)->GetRenderViewHost(); + RenderViewHost* host1 = browser()->GetWebContentsAt(1)->GetRenderViewHost(); + RenderViewHost* host2 = browser()->GetWebContentsAt(2)->GetRenderViewHost(); EXPECT_NE(host1->process(), host2->process()); // Opening tabs with window.open should keep the page in the opener's process. @@ -289,8 +289,8 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, BookmarkAppGetsNormalProcess) { browser(), base_url.Resolve("path1/empty.html"), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); EXPECT_FALSE(process_map->Contains( - browser()->GetTabContentsAt(1)->GetRenderProcessHost()->GetID())); - EXPECT_FALSE(browser()->GetTabContentsAt(1)->GetWebUI()); + browser()->GetWebContentsAt(1)->GetRenderProcessHost()->GetID())); + EXPECT_FALSE(browser()->GetWebContentsAt(1)->GetWebUI()); ui_test_utils::WindowedNotificationObserver tab_added_observer( content::NOTIFICATION_TAB_ADDED, @@ -299,16 +299,16 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, BookmarkAppGetsNormalProcess) { tab_added_observer.Wait(); ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path2/empty.html")); EXPECT_FALSE(process_map->Contains( - browser()->GetTabContentsAt(2)->GetRenderProcessHost()->GetID())); - EXPECT_FALSE(browser()->GetTabContentsAt(2)->GetWebUI()); + browser()->GetWebContentsAt(2)->GetRenderProcessHost()->GetID())); + EXPECT_FALSE(browser()->GetWebContentsAt(2)->GetWebUI()); // We should have opened 2 new bookmark app tabs. Including the original blank // tab, we now have 3 tabs. Because normal pages use the // process-per-site-instance model, each should be in its own process. ASSERT_EQ(3, browser()->tab_count()); - RenderViewHost* host = browser()->GetTabContentsAt(1)->GetRenderViewHost(); + RenderViewHost* host = browser()->GetWebContentsAt(1)->GetRenderViewHost(); EXPECT_NE(host->process(), - browser()->GetTabContentsAt(2)->GetRenderProcessHost()); + browser()->GetWebContentsAt(2)->GetRenderProcessHost()); // Now let's do the same using window.open. The same should happen. ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); @@ -321,13 +321,13 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, BookmarkAppGetsNormalProcess) { // extent. Neither navigation should switch processes. const GURL& app_url(base_url.Resolve("path1/empty.html")); const GURL& non_app_url(base_url.Resolve("path3/empty.html")); - RenderViewHost* host2 = browser()->GetTabContentsAt(2)->GetRenderViewHost(); - NavigateTabHelper(browser()->GetTabContentsAt(2), non_app_url); + RenderViewHost* host2 = browser()->GetWebContentsAt(2)->GetRenderViewHost(); + NavigateTabHelper(browser()->GetWebContentsAt(2), non_app_url); EXPECT_EQ(host2->process(), - browser()->GetTabContentsAt(2)->GetRenderProcessHost()); - NavigateTabHelper(browser()->GetTabContentsAt(2), app_url); + browser()->GetWebContentsAt(2)->GetRenderProcessHost()); + NavigateTabHelper(browser()->GetWebContentsAt(2), app_url); EXPECT_EQ(host2->process(), - browser()->GetTabContentsAt(2)->GetRenderProcessHost()); + browser()->GetWebContentsAt(2)->GetRenderProcessHost()); } // Tests that app process switching works properly in the following scenario: @@ -378,10 +378,10 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcessRedirectBack) { // process. ASSERT_EQ(3, browser()->tab_count()); EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", - browser()->GetTabContentsAt(2)->GetController(). + browser()->GetWebContentsAt(2)->GetController(). GetLastCommittedEntry()->GetURL().path()); - EXPECT_EQ(browser()->GetTabContentsAt(1)->GetRenderProcessHost(), - browser()->GetTabContentsAt(2)->GetRenderProcessHost()); + EXPECT_EQ(browser()->GetWebContentsAt(1)->GetRenderProcessHost(), + browser()->GetWebContentsAt(2)->GetRenderProcessHost()); } // Ensure that reloading a URL after installing or uninstalling it as an app @@ -403,7 +403,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { // Load an app URL before loading the app. ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); - TabContents* contents = browser()->GetTabContentsAt(0); + WebContents* contents = browser()->GetWebContentsAt(0); EXPECT_FALSE(process_map->Contains( contents->GetRenderProcessHost()->GetID())); @@ -426,7 +426,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::WindowedNotificationObserver reload_observer( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController())); browser()->Reload(CURRENT_TAB); reload_observer.Wait(); @@ -438,7 +438,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::WindowedNotificationObserver reload_observer2( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController())); browser()->Reload(CURRENT_TAB); reload_observer2.Wait(); @@ -450,7 +450,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::WindowedNotificationObserver js_reload_observer( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController())); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->GetRenderViewHost(), L"", L"location.reload();")); @@ -463,7 +463,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::WindowedNotificationObserver js_reload_observer2( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController())); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->GetRenderViewHost(), L"", L"location.reload();")); @@ -500,7 +500,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION | ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); EXPECT_FALSE(process_map->Contains( - browser()->GetTabContentsAt(0)->GetRenderProcessHost()->GetID())); + browser()->GetWebContentsAt(0)->GetRenderProcessHost()->GetID())); // Wait for popup window to appear. GURL app_url = base_url.Resolve("path1/empty.html"); @@ -523,7 +523,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { // Popup window should be in the app's process. EXPECT_TRUE(process_map->Contains( - last_active_browser->GetTabContentsAt(0)->GetRenderProcessHost()-> + last_active_browser->GetWebContentsAt(0)->GetRenderProcessHost()-> GetID())); } @@ -602,7 +602,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION | ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); content::RenderProcessHost* process = - browser()->GetTabContentsAt(0)->GetRenderProcessHost(); + browser()->GetWebContentsAt(0)->GetRenderProcessHost(); EXPECT_TRUE(process_map->Contains(process->GetID())); // Wait for popup window to appear. The new Browser may not have been @@ -624,7 +624,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { // Popup window should be in the app's process. content::RenderProcessHost* popup_process = - last_active_browser->GetTabContentsAt(0)->GetRenderProcessHost(); + last_active_browser->GetWebContentsAt(0)->GetRenderProcessHost(); EXPECT_EQ(process, popup_process); } @@ -641,7 +641,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadAppAfterCrash) { // Load the app, chrome.app.isInstalled should be true. ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); - TabContents* contents = browser()->GetTabContentsAt(0); + WebContents* contents = browser()->GetWebContentsAt(0); EXPECT_TRUE(process_map->Contains( contents->GetRenderProcessHost()->GetID())); bool is_installed = false; @@ -656,7 +656,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadAppAfterCrash) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController())); browser()->Reload(CURRENT_TAB); observer.Wait(); diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc index 862ead2..c0bc014 100644 --- a/chrome/browser/extensions/extension_browsertests_misc.cc +++ b/chrome/browser/extensions/extension_browsertests_misc.cc @@ -25,10 +25,11 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "net/base/net_util.h" #include "net/test/test_server.h" #include "webkit/glue/webpreferences.h" @@ -126,9 +127,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WebKitPrefsBackgroundPage) { ExtensionProcessManager* manager = browser()->profile()->GetExtensionProcessManager(); ExtensionHost* host = FindHostWithPath(manager, "/backgroundpage.html", 1); - WebPreferences prefs = - static_cast<RenderViewHostDelegate*>(host->host_contents())-> - GetWebkitPrefs(); + WebPreferences prefs = host->render_view_host()->delegate()->GetWebkitPrefs(); ASSERT_FALSE(prefs.experimental_webgl_enabled); ASSERT_FALSE(prefs.accelerated_compositing_enabled); ASSERT_FALSE(prefs.accelerated_2d_canvas_enabled); @@ -813,7 +812,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController())); browser()->Reload(CURRENT_TAB); observer.Wait(); @@ -840,7 +839,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController())); browser()->Reload(CURRENT_TAB); observer.Wait(); @@ -929,7 +928,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_OptionsPage) { ASSERT_EQ(2, tab_strip->count()); EXPECT_EQ(extension->GetResourceURL("options.html"), - tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL()); + tab_strip->GetTabContentsAt(1)->web_contents()->GetURL()); } //============================================================================== diff --git a/chrome/browser/extensions/extension_cookies_helpers.cc b/chrome/browser/extensions/extension_cookies_helpers.cc index 296ddbd..b925a3b 100644 --- a/chrome/browser/extensions/extension_cookies_helpers.cc +++ b/chrome/browser/extensions/extension_cookies_helpers.cc @@ -18,7 +18,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "net/base/cookie_util.h" @@ -138,7 +138,7 @@ void AppendToTabIdList(Browser* browser, ListValue* tab_ids) { for (int i = 0; i < tab_strip->count(); ++i) { tab_ids->Append(Value::CreateIntegerValue( ExtensionTabUtil::GetTabId( - tab_strip->GetTabContentsAt(i)->tab_contents()))); + tab_strip->GetTabContentsAt(i)->web_contents()))); } } diff --git a/chrome/browser/extensions/extension_devtools_browsertests.cc b/chrome/browser/extensions/extension_devtools_browsertests.cc index f98fc89..5c5688d6 100644 --- a/chrome/browser/extensions/extension_devtools_browsertests.cc +++ b/chrome/browser/extensions/extension_devtools_browsertests.cc @@ -18,16 +18,17 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/devtools_agent_host_registry.h" #include "content/public/browser/devtools_client_host.h" #include "content/public/browser/devtools_manager.h" +#include "content/public/browser/web_contents.h" #include "net/base/net_util.h" using content::DevToolsAgentHost; using content::DevToolsAgentHostRegistry; using content::DevToolsClientHost; using content::DevToolsManager; +using content::WebContents; // Looks for an ExtensionHost whose URL has the given path component (including // leading slash). Also verifies that the expected number of hosts are loaded. @@ -64,9 +65,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, FLAKY_TimelineApi) { DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); // Grab the tab_id of whatever tab happens to be first. - TabContents* tab_contents = browser()->GetTabContentsAt(0); - ASSERT_TRUE(tab_contents); - int tab_id = ExtensionTabUtil::GetTabId(tab_contents); + WebContents* web_contents = browser()->GetWebContentsAt(0); + ASSERT_TRUE(web_contents); + int tab_id = ExtensionTabUtil::GetTabId(web_contents); // Test setup. bool result = false; @@ -79,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, FLAKY_TimelineApi) { // Setting the events should have caused an ExtensionDevToolsBridge to be // registered for the tab's RenderViewHost. DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( - tab_contents->GetRenderViewHost()); + web_contents->GetRenderViewHost()); DevToolsClientHost* devtools_client_host = devtools_manager->GetDevToolsClientHostFor(agent); ASSERT_TRUE(devtools_client_host); @@ -96,7 +97,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, FLAKY_TimelineApi) { result = false; devtools_manager->UnregisterDevToolsClientHostFor( DevToolsAgentHostRegistry::GetDevToolsAgentHost( - tab_contents->GetRenderViewHost())); + web_contents->GetRenderViewHost())); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( host->render_view_host(), L"", L"testReceiveTabCloseEvent()", &result)); EXPECT_TRUE(result); @@ -121,9 +122,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) { DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); // Grab the tab_id of whatever tab happens to be first. - TabContents* tab_contents = browser()->GetTabContentsAt(0); - ASSERT_TRUE(tab_contents); - int tab_id = ExtensionTabUtil::GetTabId(tab_contents); + WebContents* web_contents = browser()->GetWebContentsAt(0); + ASSERT_TRUE(web_contents); + int tab_id = ExtensionTabUtil::GetTabId(web_contents); // Test setup. bool result = false; @@ -137,7 +138,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) { // to be registered for the tab's RenderViewHost. ASSERT_TRUE(devtools_manager->GetDevToolsClientHostFor( DevToolsAgentHostRegistry::GetDevToolsAgentHost( - tab_contents->GetRenderViewHost()))); + web_contents->GetRenderViewHost()))); // Register listeners from the second extension as well. std::wstring script = base::StringPrintf(L"registerListenersForTab(%d)", @@ -154,7 +155,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) { EXPECT_TRUE(result); ASSERT_TRUE(devtools_manager->GetDevToolsClientHostFor( DevToolsAgentHostRegistry::GetDevToolsAgentHost( - tab_contents->GetRenderViewHost()))); + web_contents->GetRenderViewHost()))); // Removing the listeners from the second extension should tear the bridge // down. @@ -164,5 +165,5 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, ProcessRefCounting) { EXPECT_TRUE(result); ASSERT_FALSE(devtools_manager->GetDevToolsClientHostFor( DevToolsAgentHostRegistry::GetDevToolsAgentHost( - tab_contents->GetRenderViewHost()))); + web_contents->GetRenderViewHost()))); } diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc index 32cb17f..8584282 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc @@ -6,7 +6,6 @@ #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/tabs/tab_strip_model.h" -#include "content/browser/tab_contents/tab_contents.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_list.h" @@ -14,6 +13,7 @@ #include "chrome/browser/extensions/extension_tabs_module_constants.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/web_contents.h" namespace keys = extension_tabs_module_constants; namespace errors = extension_manifest_errors; @@ -90,7 +90,7 @@ ListValue* ExtensionTabUtil::CreateTabList(const Browser* browser) { TabStripModel* tab_strip = browser->tabstrip_model(); for (int i = 0; i < tab_strip->count(); ++i) { tab_list->Append(ExtensionTabUtil::CreateTabValue( - tab_strip->GetTabContentsAt(i)->tab_contents(), tab_strip, i)); + tab_strip->GetTabContentsAt(i)->web_contents(), tab_strip, i)); } return tab_list; @@ -199,7 +199,7 @@ bool ExtensionTabUtil::GetDefaultTab(Browser* browser, *contents = browser->GetSelectedTabContentsWrapper(); if (*contents) { if (tab_id) - *tab_id = ExtensionTabUtil::GetTabId((*contents)->tab_contents()); + *tab_id = ExtensionTabUtil::GetTabId((*contents)->web_contents()); return true; } diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index 7627bf7..9a97fa4 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -13,17 +13,20 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" +#include "content/browser/site_instance.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" #include "net/base/mock_host_resolver.h" +using content::WebContents; + namespace { class IsolatedAppTest : public ExtensionBrowserTest { public: // Returns whether the given tab's current URL has the given cookie. - bool WARN_UNUSED_RESULT HasCookie(TabContents* contents, std::string cookie) { + bool WARN_UNUSED_RESULT HasCookie(WebContents* contents, std::string cookie) { int value_size; std::string actual_cookie; automation_util::GetCookies(contents->GetURL(), contents, &value_size, @@ -31,7 +34,7 @@ class IsolatedAppTest : public ExtensionBrowserTest { return actual_cookie.find(cookie) != std::string::npos; } - const Extension* GetInstalledApp(TabContents* contents) { + const Extension* GetInstalledApp(WebContents* contents) { const Extension* installed_app = NULL; Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); @@ -83,9 +86,9 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CookieIsolation) { ASSERT_EQ(3, browser()->tab_count()); // Ensure first two tabs have installed apps. - TabContents* tab1 = browser()->GetTabContentsAt(0); - TabContents* tab2 = browser()->GetTabContentsAt(1); - TabContents* tab3 = browser()->GetTabContentsAt(2); + WebContents* tab1 = browser()->GetWebContentsAt(0); + WebContents* tab2 = browser()->GetWebContentsAt(1); + WebContents* tab3 = browser()->GetWebContentsAt(2); ASSERT_TRUE(GetInstalledApp(tab1)); ASSERT_TRUE(GetInstalledApp(tab2)); ASSERT_TRUE(!GetInstalledApp(tab3)); @@ -119,7 +122,7 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CookieIsolation) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController())); browser()->Reload(CURRENT_TAB); observer.Wait(); @@ -155,15 +158,15 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, NoCookieIsolationWithoutApp) { ASSERT_EQ(3, browser()->tab_count()); // Check that tabs see each others' cookies. - EXPECT_TRUE(HasCookie(browser()->GetTabContentsAt(0), "app2=4")); - EXPECT_TRUE(HasCookie(browser()->GetTabContentsAt(0), "normalPage=5")); - EXPECT_TRUE(HasCookie(browser()->GetTabContentsAt(0), "nonAppFrame=6")); - EXPECT_TRUE(HasCookie(browser()->GetTabContentsAt(1), "app1=3")); - EXPECT_TRUE(HasCookie(browser()->GetTabContentsAt(1), "normalPage=5")); - EXPECT_TRUE(HasCookie(browser()->GetTabContentsAt(1), "nonAppFrame=6")); - EXPECT_TRUE(HasCookie(browser()->GetTabContentsAt(2), "app1=3")); - EXPECT_TRUE(HasCookie(browser()->GetTabContentsAt(2), "app2=4")); - EXPECT_TRUE(HasCookie(browser()->GetTabContentsAt(2), "nonAppFrame=6")); + EXPECT_TRUE(HasCookie(browser()->GetWebContentsAt(0), "app2=4")); + EXPECT_TRUE(HasCookie(browser()->GetWebContentsAt(0), "normalPage=5")); + EXPECT_TRUE(HasCookie(browser()->GetWebContentsAt(0), "nonAppFrame=6")); + EXPECT_TRUE(HasCookie(browser()->GetWebContentsAt(1), "app1=3")); + EXPECT_TRUE(HasCookie(browser()->GetWebContentsAt(1), "normalPage=5")); + EXPECT_TRUE(HasCookie(browser()->GetWebContentsAt(1), "nonAppFrame=6")); + EXPECT_TRUE(HasCookie(browser()->GetWebContentsAt(2), "app1=3")); + EXPECT_TRUE(HasCookie(browser()->GetWebContentsAt(2), "app2=4")); + EXPECT_TRUE(HasCookie(browser()->GetWebContentsAt(2), "nonAppFrame=6")); } // Ensure that an isolated app never shares a process with WebUIs, non-isolated @@ -238,25 +241,25 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, ProcessOverflow) { // Get tab processes. ASSERT_EQ(9, browser()->tab_count()); content::RenderProcessHost* isolated1_host = - browser()->GetTabContentsAt(0)->GetRenderProcessHost(); + browser()->GetWebContentsAt(0)->GetRenderProcessHost(); content::RenderProcessHost* ntp1_host = - browser()->GetTabContentsAt(1)->GetRenderProcessHost(); + browser()->GetWebContentsAt(1)->GetRenderProcessHost(); content::RenderProcessHost* hosted1_host = - browser()->GetTabContentsAt(2)->GetRenderProcessHost(); + browser()->GetWebContentsAt(2)->GetRenderProcessHost(); content::RenderProcessHost* web1_host = - browser()->GetTabContentsAt(3)->GetRenderProcessHost(); + browser()->GetWebContentsAt(3)->GetRenderProcessHost(); content::RenderProcessHost* isolated2_host = - browser()->GetTabContentsAt(4)->GetRenderProcessHost(); + browser()->GetWebContentsAt(4)->GetRenderProcessHost(); content::RenderProcessHost* ntp2_host = - browser()->GetTabContentsAt(5)->GetRenderProcessHost(); + browser()->GetWebContentsAt(5)->GetRenderProcessHost(); content::RenderProcessHost* hosted2_host = - browser()->GetTabContentsAt(6)->GetRenderProcessHost(); + browser()->GetWebContentsAt(6)->GetRenderProcessHost(); content::RenderProcessHost* web2_host = - browser()->GetTabContentsAt(7)->GetRenderProcessHost(); + browser()->GetWebContentsAt(7)->GetRenderProcessHost(); content::RenderProcessHost* second_isolated1_host = - browser()->GetTabContentsAt(8)->GetRenderProcessHost(); + browser()->GetWebContentsAt(8)->GetRenderProcessHost(); // Get extension processes. ExtensionProcessManager* process_manager = diff --git a/chrome/browser/oom_priority_manager.cc b/chrome/browser/oom_priority_manager.cc index abbffaf..5d4f659 100644 --- a/chrome/browser/oom_priority_manager.cc +++ b/chrome/browser/oom_priority_manager.cc @@ -23,12 +23,12 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_constants.h" #include "content/browser/renderer_host/render_widget_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/zygote_host_linux.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" #if !defined(OS_CHROMEOS) #error This file only meant to be compiled on ChromeOS @@ -39,17 +39,18 @@ using base::TimeTicks; using base::ProcessHandle; using base::ProcessMetrics; using content::BrowserThread; +using content::WebContents; namespace { // Returns a unique ID for a TabContents. Do not cast back to a pointer, as // the TabContents could be deleted if the user closed the tab. -int64 IdFromTabContents(TabContents* tab_contents) { - return reinterpret_cast<int64>(tab_contents); +int64 IdFromTabContents(WebContents* web_contents) { + return reinterpret_cast<int64>(web_contents); } // Discards a tab with the given unique ID. Returns true if discard occurred. -bool DiscardTabById(int64 target_tab_contents_id) { +bool DiscardTabById(int64 target_web_contents_id) { for (BrowserList::const_iterator browser_iterator = BrowserList::begin(); browser_iterator != BrowserList::end(); ++browser_iterator) { Browser* browser = *browser_iterator; @@ -58,9 +59,9 @@ bool DiscardTabById(int64 target_tab_contents_id) { // Can't discard tabs that are already discarded. if (model->IsTabDiscarded(idx)) continue; - TabContents* tab_contents = model->GetTabContentsAt(idx)->tab_contents(); - int64 tab_contents_id = IdFromTabContents(tab_contents); - if (tab_contents_id == target_tab_contents_id) { + WebContents* web_contents = model->GetTabContentsAt(idx)->web_contents(); + int64 web_contents_id = IdFromTabContents(web_contents); + if (web_contents_id == target_web_contents_id) { model->DiscardTabContentsAt(idx); return true; } @@ -266,7 +267,7 @@ OomPriorityManager::TabStatsList OomPriorityManager::GetTabStatsOnUIThread() { Browser* browser = *browser_iterator; const TabStripModel* model = browser->tabstrip_model(); for (int i = 0; i < model->count(); i++) { - TabContents* contents = model->GetTabContentsAt(i)->tab_contents(); + WebContents* contents = model->GetTabContentsAt(i)->web_contents(); if (!contents->IsCrashed()) { TabStats stats; stats.last_selected = contents->GetLastSelectedTime(); diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index 6a04105..141e136 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -244,15 +244,15 @@ void PrerenderContents::StartPrerendering( gfx::Rect tab_bounds; if (source_render_view_host) { DCHECK(source_render_view_host->view() != NULL); - TabContents* source_tc = - source_render_view_host->delegate()->GetAsTabContents(); - if (source_tc) { + WebContents* source_wc = + source_render_view_host->delegate()->GetAsWebContents(); + if (source_wc) { // So that history merging will work, get the max page ID // of the old page as a starting id. - starting_page_id_ = source_tc->GetMaxPageID(); + starting_page_id_ = source_wc->GetMaxPageID(); // Set the size of the new TC to that of the old TC. - source_tc->GetView()->GetContainerBounds(&tab_bounds); + source_wc->GetView()->GetContainerBounds(&tab_bounds); } } else { int max_page_id = -1; @@ -264,9 +264,9 @@ void PrerenderContents::StartPrerendering( const Browser* browser = *browser_iter; int num_tabs = browser->tab_count(); for (int tab_index = 0; tab_index < num_tabs; ++tab_index) { - TabContents* tab_contents = browser->GetTabContentsAt(tab_index); - if (tab_contents != NULL) - max_page_id = std::max(max_page_id, tab_contents->GetMaxPageID()); + WebContents* web_contents = browser->GetWebContentsAt(tab_index); + if (web_contents != NULL) + max_page_id = std::max(max_page_id, web_contents->GetMaxPageID()); } } starting_page_id_ = max_page_id; @@ -276,9 +276,9 @@ void PrerenderContents::StartPrerendering( // but we shouldn't be prerendering in that case anyway. Browser* active_browser = BrowserList::GetLastActiveWithProfile(profile_); if (active_browser) { - TabContents* active_tab_contents = active_browser->GetTabContentsAt( + WebContents* active_web_contents = active_browser->GetWebContentsAt( active_browser->active_index()); - active_tab_contents->GetView()->GetContainerBounds(&tab_bounds); + active_web_contents->GetView()->GetContainerBounds(&tab_bounds); } } @@ -693,11 +693,11 @@ Value* PrerenderContents::GetAsValue() const { } bool PrerenderContents::IsCrossSiteNavigationPending() const { - if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) + if (!prerender_contents_.get() || !prerender_contents_->web_contents()) return false; - const TabContents* tab_contents = prerender_contents_->tab_contents(); - return (tab_contents->GetSiteInstance() != - tab_contents->GetPendingSiteInstance()); + const WebContents* web_contents = prerender_contents_->web_contents(); + return (web_contents->GetSiteInstance() != + web_contents->GetPendingSiteInstance()); } diff --git a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc index 1f1cac1..4d9dac7 100644 --- a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc +++ b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc @@ -11,10 +11,12 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_process_host_impl.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/result_codes.h" #include "testing/gtest/include/gtest/gtest.h" +using content::WebContents; + class WebCacheManagerBrowserTest : public InProcessBrowserTest { }; @@ -31,7 +33,7 @@ IN_PROC_BROWSER_TEST_F(WebCacheManagerBrowserTest, DISABLED_CrashOnceOnly) { browser()->NewTab(); ui_test_utils::NavigateToURL(browser(), url); - TabContents* tab = browser()->GetTabContentsAt(0); + WebContents* tab = browser()->GetWebContentsAt(0); ASSERT_TRUE(tab != NULL); base::KillProcess(tab->GetRenderProcessHost()->GetHandle(), content::RESULT_CODE_KILLED, true); diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index d546993..31b90f384 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc @@ -13,9 +13,9 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/page_transition_types.h" namespace { @@ -107,7 +107,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, ASSERT_EQ(1, new_browser->tab_count()); // And the first url should be url. - EXPECT_EQ(url, new_browser->GetTabContentsAt(0)->GetURL()); + EXPECT_EQ(url, new_browser->GetWebContentsAt(0)->GetURL()); } IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreIndividualTabFromWindow) { @@ -232,5 +232,5 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, IncognitotoNonIncognito) { // The first tab should have 'url' as its url. Browser* new_browser = ui_test_utils::WaitForNewBrowser(); ASSERT_TRUE(new_browser); - EXPECT_EQ(url, new_browser->GetTabContentsAt(0)->GetURL()); + EXPECT_EQ(url, new_browser->GetWebContentsAt(0)->GetURL()); } diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc index 1589ff4..50de7c0 100644 --- a/chrome/browser/sessions/tab_restore_service.cc +++ b/chrome/browser/sessions/tab_restore_service.cc @@ -27,9 +27,9 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/url_constants.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/web_contents.h" using base::Time; using content::NavigationEntry; @@ -252,7 +252,7 @@ void TabRestoreService::BrowserClosing(TabRestoreServiceDelegate* delegate) { PopulateTab(&(window->tabs[entry_index]), tab_index, delegate, - &delegate->GetTabContentsAt(tab_index)->GetController()); + &delegate->GetWebContentsAt(tab_index)->GetController()); if (window->tabs[entry_index].navigations.empty()) { window->tabs.erase(window->tabs.begin() + entry_index); } else { @@ -354,7 +354,7 @@ void TabRestoreService::RestoreEntryById(TabRestoreServiceDelegate* delegate, delegate = TabRestoreServiceDelegate::Create(profile()); for (size_t tab_i = 0; tab_i < window->tabs.size(); ++tab_i) { const Tab& tab = window->tabs[tab_i]; - TabContents* restored_tab = + WebContents* restored_tab = delegate->AddRestoredTab(tab.navigations, delegate->GetTabCount(), tab.current_navigation_index, tab.extension_app_id, diff --git a/chrome/browser/sessions/tab_restore_service_delegate.h b/chrome/browser/sessions/tab_restore_service_delegate.h index a3a6dda..8f1469e 100644 --- a/chrome/browser/sessions/tab_restore_service_delegate.h +++ b/chrome/browser/sessions/tab_restore_service_delegate.h @@ -12,7 +12,6 @@ class Profile; class SessionStorageNamespace; -class TabContents; class TabNavigation; namespace content { @@ -38,10 +37,10 @@ class TabRestoreServiceDelegate { virtual int GetSelectedIndex() const = 0; // see Browser methods with the same names - virtual TabContents* GetTabContentsAt(int index) const = 0; + virtual content::WebContents* GetWebContentsAt(int index) const = 0; virtual content::WebContents* GetSelectedWebContents() const = 0; virtual bool IsTabPinned(int index) const = 0; - virtual TabContents* AddRestoredTab( + virtual content::WebContents* AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, int selected_navigation, diff --git a/chrome/browser/sidebar/sidebar_browsertest.cc b/chrome/browser/sidebar/sidebar_browsertest.cc index 697cd9d..bdafed8 100644 --- a/chrome/browser/sidebar/sidebar_browsertest.cc +++ b/chrome/browser/sidebar/sidebar_browsertest.cc @@ -112,7 +112,7 @@ class SidebarTest : public ExtensionBrowserTest { } TabContents* tab_contents(int i) { - return browser()->GetTabContentsAt(i); + return browser()->GetTabContentsWrapperAt(i)->tab_contents(); } BrowserView* browser_view() const { diff --git a/chrome/browser/tab_contents/tab_util.cc b/chrome/browser/tab_contents/tab_util.cc index 3faf675..1c1300b 100644 --- a/chrome/browser/tab_contents/tab_util.cc +++ b/chrome/browser/tab_contents/tab_util.cc @@ -9,10 +9,13 @@ #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" #include "chrome/common/chrome_switches.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" +using content::WebContents; + namespace tab_util { TabContents* GetTabContentsByID(int render_process_id, int render_view_id) { @@ -34,7 +37,7 @@ content::WebContents* GetWebContentsByID(int render_process_id, return render_view_host->delegate()->GetAsWebContents(); } -SiteInstance* GetSiteInstanceForNewTab(TabContents* source_contents, +SiteInstance* GetSiteInstanceForNewTab(WebContents* source_contents, Profile* profile, const GURL& url) { // If url is a WebUI or extension, we need to be sure to use the right type diff --git a/chrome/browser/tab_contents/tab_util.h b/chrome/browser/tab_contents/tab_util.h index 63bcbfa..64f1aaf 100644 --- a/chrome/browser/tab_contents/tab_util.h +++ b/chrome/browser/tab_contents/tab_util.h @@ -10,7 +10,6 @@ class GURL; class Profile; class SiteInstance; class TabContents; - namespace content { class WebContents; } @@ -28,7 +27,7 @@ content::WebContents* GetWebContentsByID(int render_process_id, // Returns a new SiteInstance for WebUI and app URLs. Returns the SiteInstance // for |source_contents| if it represents the same website as |url|. Returns // NULL otherwise. -SiteInstance* GetSiteInstanceForNewTab(TabContents* source_contents, +SiteInstance* GetSiteInstanceForNewTab(content::WebContents* source_contents, Profile* profile, const GURL& url); diff --git a/chrome/browser/tabs/pinned_tab_codec.cc b/chrome/browser/tabs/pinned_tab_codec.cc index ad1eea1..73b8693 100644 --- a/chrome/browser/tabs/pinned_tab_codec.cc +++ b/chrome/browser/tabs/pinned_tab_codec.cc @@ -14,8 +14,8 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/web_contents.h" using content::NavigationEntry; @@ -57,9 +57,9 @@ static void EncodePinnedTab(TabStripModel* model, values->Append(value.release()); } else { NavigationEntry* entry = - tab_contents->tab_contents()->GetController().GetActiveEntry(); - if (!entry && tab_contents->tab_contents()->GetController().GetEntryCount()) - entry = tab_contents->tab_contents()->GetController().GetEntryAtIndex(0); + tab_contents->web_contents()->GetController().GetActiveEntry(); + if (!entry && tab_contents->web_contents()->GetController().GetEntryCount()) + entry = tab_contents->web_contents()->GetController().GetEntryAtIndex(0); if (entry) { value->SetString(kURL, entry->GetURL().spec()); values->Append(value.release()); diff --git a/chrome/browser/tabs/tab_finder.cc b/chrome/browser/tabs/tab_finder.cc index 1c24513..c218ccd 100644 --- a/chrome/browser/tabs/tab_finder.cc +++ b/chrome/browser/tabs/tab_finder.cc @@ -14,12 +14,12 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_switches.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/frame_navigate_params.h" #include "content/public/common/page_transition_types.h" @@ -164,8 +164,8 @@ WebContents* TabFinder::FindTabInBrowser(Browser* browser, const GURL& url) { return NULL; for (int i = 0; i < browser->tab_count(); ++i) { - if (TabMatchesURL(browser->GetTabContentsAt(i), url)) - return browser->GetTabContentsAt(i); + if (TabMatchesURL(browser->GetWebContentsAt(i), url)) + return browser->GetWebContentsAt(i); } return NULL; } diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 6f2e7ed..c9dd131 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -32,6 +32,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/user_metrics.h" +#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" using content::NavigationEntry; @@ -147,7 +148,7 @@ void TabStripModel::InsertTabContentsAt(int index, ForgetAllOpeners(); } // Anything opened by a link we deem to have an opener. - data->SetGroup(&selected_contents->tab_contents()->GetController()); + data->SetGroup(&selected_contents->web_contents()->GetController()); } else if ((add_types & ADD_INHERIT_OPENER) && selected_contents) { if (active) { // Forget any existing relationships, we don't want to make things too @@ -218,14 +219,14 @@ TabContentsWrapper* TabStripModel::DiscardTabContentsAt(int index) { NULL /* session_storage_namespace */)); TabContentsWrapper* old_contents = GetContentsAt(index); NavigationEntry* old_nav_entry = - old_contents->tab_contents()->GetController().GetActiveEntry(); + old_contents->web_contents()->GetController().GetActiveEntry(); if (old_nav_entry) { // Set the new tab contents to reload this URL when clicked. // This also allows the tab to keep drawing the favicon and page title. NavigationEntry* new_nav_entry = NavigationEntry::Create(*old_nav_entry); std::vector<NavigationEntry*> entries; entries.push_back(new_nav_entry); - null_contents->tab_contents()->GetController().Restore(0, false, &entries); + null_contents->web_contents()->GetController().Restore(0, false, &entries); } ReplaceTabContentsAt(index, null_contents); // Mark the tab so it will reload when we click. @@ -381,7 +382,7 @@ int TabStripModel::GetWrapperIndex(const WebContents* contents) const { int index = 0; TabContentsDataVector::const_iterator iter = contents_data_.begin(); for (; iter != contents_data_.end(); ++iter, ++index) { - if ((*iter)->contents->tab_contents() == contents) + if ((*iter)->contents->web_contents() == contents) return index; } return kNoTab; @@ -392,7 +393,7 @@ int TabStripModel::GetIndexOfController( int index = 0; TabContentsDataVector::const_iterator iter = contents_data_.begin(); for (; iter != contents_data_.end(); ++iter, ++index) { - if (&(*iter)->contents->tab_contents()->GetController() == controller) + if (&(*iter)->contents->web_contents()->GetController() == controller) return index; } return kNoTab; @@ -426,7 +427,7 @@ bool TabStripModel::CloseTabContentsAt(int index, uint32 close_types) { bool TabStripModel::TabsAreLoading() const { TabContentsDataVector::const_iterator iter = contents_data_.begin(); for (; iter != contents_data_.end(); ++iter) { - if ((*iter)->contents->tab_contents()->IsLoading()) + if ((*iter)->contents->web_contents()->IsLoading()) return true; } return false; @@ -730,13 +731,13 @@ void TabStripModel::AddTabContents(TabContentsWrapper* contents, // new background tab. if (TabContentsWrapper* old_contents = GetActiveTabContents()) { if ((add_types & ADD_ACTIVE) == 0) { - contents->tab_contents()->GetView()-> - SizeContents(old_contents->tab_contents()-> + contents->web_contents()->GetView()-> + SizeContents(old_contents->web_contents()-> GetView()->GetContainerSize()); // We need to hide the contents or else we get and execute paints for // background tabs. With enough background tabs they will steal the // backing store of the visible tab causing flashing. See bug 20831. - contents->tab_contents()->HideContents(); + contents->web_contents()->HideContents(); } } } @@ -1079,13 +1080,13 @@ bool TabStripModel::ContextMenuCommandToBrowserCommand(int cmd_id, void TabStripModel::GetIndicesWithSameDomain(int index, std::vector<int>* indices) { TabContentsWrapper* tab = GetTabContentsAt(index); - std::string domain = tab->tab_contents()->GetURL().host(); + std::string domain = tab->web_contents()->GetURL().host(); if (domain.empty()) return; for (int i = 0; i < count(); ++i) { if (i == index) continue; - if (GetTabContentsAt(i)->tab_contents()->GetURL().host() == domain) + if (GetTabContentsAt(i)->web_contents()->GetURL().host() == domain) indices->push_back(i); } } @@ -1095,7 +1096,7 @@ void TabStripModel::GetIndicesWithSameOpener(int index, content::NavigationController* opener = contents_data_[index]->group; if (!opener) { // If there is no group, find all tabs with the selected tab as the opener. - opener = &(GetTabContentsAt(index)->tab_contents()->GetController()); + opener = &(GetTabContentsAt(index)->web_contents()->GetController()); if (!opener) return; } @@ -1103,7 +1104,7 @@ void TabStripModel::GetIndicesWithSameOpener(int index, if (i == index) continue; if (contents_data_[i]->group == opener || - &(GetTabContentsAt(i)->tab_contents()->GetController()) == opener) { + &(GetTabContentsAt(i)->web_contents()->GetController()) == opener) { indices->push_back(i); } } @@ -1120,11 +1121,11 @@ std::vector<int> TabStripModel::GetIndicesForCommand(int index) const { bool TabStripModel::IsNewTabAtEndOfTabStrip( TabContentsWrapper* contents) const { - const GURL& url = contents->tab_contents()->GetURL(); + const GURL& url = contents->web_contents()->GetURL(); return url.SchemeIs(chrome::kChromeUIScheme) && url.host() == chrome::kChromeUINewTabHost && contents == GetContentsAt(count() - 1) && - contents->tab_contents()->GetController().GetEntryCount() == 1; + contents->web_contents()->GetController().GetEntryCount() == 1; } bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices, @@ -1154,7 +1155,7 @@ bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices, for (size_t i = 0; i < indices.size(); ++i) { TabContentsWrapper* detached_contents = GetContentsAt(indices[i]); content::RenderProcessHost* process = - detached_contents->tab_contents()->GetRenderProcessHost(); + detached_contents->web_contents()->GetRenderProcessHost(); std::map<content::RenderProcessHost*, size_t>::iterator iter = processes.find(process); if (iter == processes.end()) { @@ -1180,14 +1181,14 @@ bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices, if (index == kNoTab) continue; - detached_contents->tab_contents()->OnCloseStarted(); + detached_contents->web_contents()->OnCloseStarted(); // Update the explicitly closed state. If the unload handlers cancel the // close the state is reset in Browser. We don't update the explicitly // closed state if already marked as explicitly closed as unload handlers // call back to this if the close is allowed. - if (!detached_contents->tab_contents()->GetClosedByUserGesture()) { - detached_contents->tab_contents()->SetClosedByUserGesture( + if (!detached_contents->web_contents()->GetClosedByUserGesture()) { + detached_contents->web_contents()->SetClosedByUserGesture( close_types & CLOSE_USER_GESTURE); } diff --git a/chrome/browser/tabs/tab_strip_model_order_controller.cc b/chrome/browser/tabs/tab_strip_model_order_controller.cc index e08a110..dacd574 100644 --- a/chrome/browser/tabs/tab_strip_model_order_controller.cc +++ b/chrome/browser/tabs/tab_strip_model_order_controller.cc @@ -5,7 +5,7 @@ #include "chrome/browser/tabs/tab_strip_model_order_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" /////////////////////////////////////////////////////////////////////////////// // TabStripModelOrderController, public: @@ -131,9 +131,9 @@ void TabStripModelOrderController::ActiveTabChanged( if (user_gesture && new_opener != old_opener && ((old_contents == NULL && new_opener == NULL) || - new_opener != &old_contents->tab_contents()->GetController()) && + new_opener != &old_contents->web_contents()->GetController()) && ((new_contents == NULL && old_opener == NULL) || - old_opener != &new_contents->tab_contents()->GetController())) { + old_opener != &new_contents->web_contents()->GetController())) { tabstrip_->ForgetAllOpeners(); } } diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 2033b7a..9f1f931 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -1196,10 +1196,10 @@ TabContentsWrapper* Browser::GetTabContentsWrapperAt(int index) const { return tabstrip_model()->GetTabContentsAt(index); } -TabContents* Browser::GetTabContentsAt(int index) const { +WebContents* Browser::GetWebContentsAt(int index) const { TabContentsWrapper* wrapper = tabstrip_model()->GetTabContentsAt(index); if (wrapper) - return wrapper->tab_contents(); + return wrapper->web_contents(); return NULL; } @@ -1287,7 +1287,7 @@ void Browser::BookmarkBarSizeChanged(bool is_animating) { window_->ToolbarSizeChanged(is_animating); } -TabContents* Browser::AddRestoredTab( +WebContents* Browser::AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, int selected_navigation, @@ -1303,7 +1303,7 @@ TabContents* Browser::AddRestoredTab( MSG_ROUTING_NONE, GetSelectedWebContents(), session_storage_namespace); - TabContents* new_tab = wrapper->tab_contents(); + WebContents* new_tab = wrapper->web_contents(); wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); std::vector<NavigationEntry*> entries; TabNavigation::CreateNavigationEntriesFromTabNavigations( @@ -3103,7 +3103,7 @@ TabContentsWrapper* Browser::CreateTabContentsForURL( } bool Browser::CanDuplicateContentsAt(int index) { - content::NavigationController& nc = GetTabContentsAt(index)->GetController(); + content::NavigationController& nc = GetWebContentsAt(index)->GetController(); return nc.GetWebContents() && nc.GetLastCommittedEntry(); } @@ -4811,7 +4811,7 @@ void Browser::ProcessPendingUIUpdates() { i != scheduled_updates_.end(); ++i) { bool found = false; for (int tab = 0; tab < tab_count(); tab++) { - if (GetTabContentsAt(tab) == i->first) { + if (GetWebContentsAt(tab) == i->first) { found = true; break; } diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index a8a62d8..88a03d5 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -397,7 +397,8 @@ class Browser : public TabHandlerDelegate, // A convenient version of the above which returns the TCW's WebContents. content::WebContents* GetSelectedWebContents() const; TabContentsWrapper* GetTabContentsWrapperAt(int index) const; - TabContents* GetTabContentsAt(int index) const; + // A convenient version of the above which returns the TCW's WebContents. + content::WebContents* GetWebContentsAt(int index) const; void ActivateTabAt(int index, bool user_gesture); bool IsTabPinned(int index) const; bool IsTabDiscarded(int index) const; @@ -433,14 +434,15 @@ class Browser : public TabHandlerDelegate, // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then // the newly created tab is pinned. If |from_last_session| is true, // |navigations| are from the previous session. - TabContents* AddRestoredTab(const std::vector<TabNavigation>& navigations, - int tab_index, - int selected_navigation, - const std::string& extension_app_id, - bool select, - bool pin, - bool from_last_session, - SessionStorageNamespace* storage_namespace); + content::WebContents* AddRestoredTab( + const std::vector<TabNavigation>& navigations, + int tab_index, + int selected_navigation, + const std::string& extension_app_id, + bool select, + bool pin, + bool from_last_session, + SessionStorageNamespace* storage_namespace); // Creates a new tab with the already-created WebContents 'new_contents'. // The window for the added contents will be reparented correctly when this // method returns. If |disposition| is NEW_POPUP, |pos| should hold the diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index f6bdb59f..21a5419 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -44,11 +44,11 @@ #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/interstitial_page.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/page_transition_types.h" #include "content/public/common/url_constants.h" #include "grit/chromium_strings.h" @@ -232,7 +232,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) { AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(0, browser()->active_index()); - TabContents* second_tab = browser()->GetTabContentsAt(1); + WebContents* second_tab = browser()->GetWebContentsAt(1); ASSERT_TRUE(second_tab); second_tab->GetRenderViewHost()->ExecuteJavascriptInWebFrame( string16(), @@ -348,7 +348,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_SingleBeforeUnloadAfterWindowClose) { // Close the new window with JavaScript, which should show a single // beforeunload dialog. Then show another alert, to make it easy to verify // that a second beforeunload dialog isn't shown. - browser()->GetTabContentsAt(0)->GetRenderViewHost()-> + browser()->GetWebContentsAt(0)->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("w.close(); alert('bar');")); AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); @@ -616,9 +616,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme)); ASSERT_EQ(1, browser()->tab_count()); - TabContents* initial_tab = browser()->GetTabContentsAt(0); - TabContents* app_tab = browser()->AddSelectedTabWithURL( - http_url, content::PAGE_TRANSITION_TYPED)->tab_contents(); + WebContents* initial_tab = browser()->GetWebContentsAt(0); + WebContents* app_tab = browser()->AddSelectedTabWithURL( + http_url, content::PAGE_TRANSITION_TYPED)->web_contents(); ASSERT_EQ(2, browser()->tab_count()); ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); @@ -643,12 +643,12 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { // Check that the tab contents is in the new browser, and not in the old. ASSERT_EQ(1, browser()->tab_count()); - ASSERT_EQ(initial_tab, browser()->GetTabContentsAt(0)); + ASSERT_EQ(initial_tab, browser()->GetWebContentsAt(0)); // Check that the appliaction browser has a single tab, and that tab contains // the content that we app-ified. ASSERT_EQ(1, app_browser->tab_count()); - ASSERT_EQ(app_tab, app_browser->GetTabContentsAt(0)); + ASSERT_EQ(app_tab, app_browser->GetWebContentsAt(0)); // Normal tabs should accept load drops. EXPECT_TRUE(initial_tab->GetMutableRendererPrefs()->can_accept_load_drops); @@ -1044,7 +1044,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) { EXPECT_FALSE(new_model->IsTabPinned(2)); EXPECT_EQ(browser()->profile()->GetHomePage(), - new_model->GetTabContentsAt(2)->tab_contents()->GetURL()); + new_model->GetTabContentsAt(2)->web_contents()->GetURL()); EXPECT_TRUE( new_model->GetTabContentsAt(0)->extension_tab_helper()->extension_app() == diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 5fcac4e..91b6ca5 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -78,10 +78,10 @@ #include "chrome/common/url_constants.h" #include "chrome/installer/util/browser_distribution.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_details.h" +#include "content/public/browser/web_contents.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -453,7 +453,7 @@ bool SessionCrashedInfoBarDelegate::Accept() { uint32 behavior = 0; Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); if (browser && browser->tab_count() == 1 - && browser->GetTabContentsAt(0)->GetURL() == + && browser->GetWebContentsAt(0)->GetURL() == GURL(chrome::kChromeUINewTabURL)) { // There is only one tab and its the new tab page, make session restore // clobber it. diff --git a/chrome/browser/ui/browser_init_browsertest.cc b/chrome/browser/ui/browser_init_browsertest.cc index 05c938b..c649289 100644 --- a/chrome/browser/ui/browser_init_browsertest.cc +++ b/chrome/browser/ui/browser_init_browsertest.cc @@ -20,7 +20,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "testing/gtest/include/gtest/gtest.h" class BrowserInitTest : public ExtensionBrowserTest { @@ -151,7 +151,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, // The new browser should have one tab for each URL. ASSERT_EQ(static_cast<int>(urls.size()), new_browser->tab_count()); for (size_t i=0; i < urls.size(); i++) { - EXPECT_EQ(urls[i], new_browser->GetTabContentsAt(i)->GetURL()); + EXPECT_EQ(urls[i], new_browser->GetWebContentsAt(i)->GetURL()); } } diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 7289caa..cb1e72a 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -30,9 +30,11 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_url_handler.h" +#include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "net/http/http_util.h" using content::GlobalRequestID; @@ -245,7 +247,7 @@ Profile* GetSourceProfile(browser::NavigateParams* params, return params->browser->profile(); } -void LoadURLInContents(TabContents* target_contents, +void LoadURLInContents(WebContents* target_contents, const GURL& url, browser::NavigateParams* params, const std::string& extra_headers) { @@ -483,8 +485,8 @@ void Navigate(NavigateParams* params) { } if (params->disposition != CURRENT_TAB) { - TabContents* source_contents = params->source_contents ? - params->source_contents->tab_contents() : NULL; + WebContents* source_contents = params->source_contents ? + params->source_contents->web_contents() : NULL; params->target_contents = Browser::TabContentsFactory( params->browser->profile(), @@ -504,7 +506,7 @@ void Navigate(NavigateParams* params) { // in the background, tell it that it's hidden. if ((params->tabstrip_add_types & TabStripModel::ADD_ACTIVE) == 0) { // TabStripModel::AddTabContents invokes HideContents if not foreground. - params->target_contents->tab_contents()->WasHidden(); + params->target_contents->web_contents()->WasHidden(); } } else { // ... otherwise if we're loading in the current tab, the target is the @@ -514,8 +516,8 @@ void Navigate(NavigateParams* params) { } if (user_initiated) { - static_cast<RenderViewHostDelegate*>(params->target_contents-> - tab_contents())->OnUserGesture(); + params->target_contents->web_contents()->GetRenderViewHost()-> + delegate()->OnUserGesture(); } InitializeExtraHeaders(params, params->target_contents->profile(), @@ -527,7 +529,7 @@ void Navigate(NavigateParams* params) { // Perform the actual navigation, tracking whether it came from the // renderer. - LoadURLInContents(params->target_contents->tab_contents(), + LoadURLInContents(params->target_contents->web_contents(), url, params, extra_headers); } } else { @@ -543,7 +545,7 @@ void Navigate(NavigateParams* params) { (params->disposition == NEW_FOREGROUND_TAB || params->disposition == NEW_WINDOW) && (params->tabstrip_add_types & TabStripModel::ADD_INHERIT_OPENER)) - params->source_contents->tab_contents()->Focus(); + params->source_contents->web_contents()->Focus(); if (params->source_contents == params->target_contents) { // The navigation occurred in the source tab. @@ -569,7 +571,7 @@ void Navigate(NavigateParams* params) { } if (singleton_index >= 0) { - TabContents* target = params->browser->GetTabContentsAt(singleton_index); + WebContents* target = params->browser->GetWebContentsAt(singleton_index); if (target->IsCrashed()) { target->GetController().Reload(true); @@ -588,7 +590,7 @@ void Navigate(NavigateParams* params) { content::NotificationService::current()->Notify( content::NOTIFICATION_TAB_ADDED, content::Source<content::WebContentsDelegate>(params->browser), - content::Details<WebContents>(params->target_contents->tab_contents())); + content::Details<WebContents>(params->target_contents->web_contents())); } } @@ -625,9 +627,9 @@ int GetIndexOfSingletonTab(browser::NavigateParams* params) { replacements.ClearQuery(); } - if (CompareURLsWithReplacements(tab->tab_contents()->GetURL(), + if (CompareURLsWithReplacements(tab->web_contents()->GetURL(), params->url, replacements) || - CompareURLsWithReplacements(tab->tab_contents()->GetURL(), + CompareURLsWithReplacements(tab->web_contents()->GetURL(), rewritten_url, replacements)) { params->target_contents = tab; return tab_index; diff --git a/chrome/browser/ui/browser_tab_restore_service_delegate.cc b/chrome/browser/ui/browser_tab_restore_service_delegate.cc index 32ffe02..9006c2c 100644 --- a/chrome/browser/ui/browser_tab_restore_service_delegate.cc +++ b/chrome/browser/ui/browser_tab_restore_service_delegate.cc @@ -27,9 +27,9 @@ int BrowserTabRestoreServiceDelegate::GetSelectedIndex() const { return browser_->active_index(); } -TabContents* BrowserTabRestoreServiceDelegate::GetTabContentsAt( +WebContents* BrowserTabRestoreServiceDelegate::GetWebContentsAt( int index) const { - return browser_->GetTabContentsAt(index); + return browser_->GetWebContentsAt(index); } WebContents* BrowserTabRestoreServiceDelegate::GetSelectedWebContents() const { @@ -40,7 +40,7 @@ bool BrowserTabRestoreServiceDelegate::IsTabPinned(int index) const { return browser_->IsTabPinned(index); } -TabContents* BrowserTabRestoreServiceDelegate::AddRestoredTab( +WebContents* BrowserTabRestoreServiceDelegate::AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, int selected_navigation, diff --git a/chrome/browser/ui/browser_tab_restore_service_delegate.h b/chrome/browser/ui/browser_tab_restore_service_delegate.h index 76bd1bd..8cac1a8 100644 --- a/chrome/browser/ui/browser_tab_restore_service_delegate.h +++ b/chrome/browser/ui/browser_tab_restore_service_delegate.h @@ -26,10 +26,10 @@ class BrowserTabRestoreServiceDelegate : public TabRestoreServiceDelegate { virtual const SessionID& GetSessionID() const OVERRIDE; virtual int GetTabCount() const OVERRIDE; virtual int GetSelectedIndex() const OVERRIDE; - virtual TabContents* GetTabContentsAt(int index) const OVERRIDE; + virtual content::WebContents* GetWebContentsAt(int index) const OVERRIDE; virtual content::WebContents* GetSelectedWebContents() const OVERRIDE; virtual bool IsTabPinned(int index) const OVERRIDE; - virtual TabContents* AddRestoredTab( + virtual content::WebContents* AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, int selected_navigation, diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm index df71751..5a5f095 100644 --- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm @@ -21,7 +21,7 @@ #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/url_constants.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" @interface WindowAppleScript(WindowAppleScriptPrivateMethods) // The NSWindow that corresponds to this window. @@ -151,7 +151,7 @@ for (int i = 0; i < browser_->tab_count(); ++i) { // Check to see if tab is closing. - if (browser_->GetTabContentsAt(i)->IsBeingDestroyed()) { + if (browser_->GetWebContentsAt(i)->IsBeingDestroyed()) { continue; } @@ -176,7 +176,7 @@ TabContentsWrapper* contents = browser_->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), content::PAGE_TRANSITION_TYPED); - contents->tab_contents()->SetNewTabStartTime(newTabStartTime); + contents->web_contents()->SetNewTabStartTime(newTabStartTime); [aTab setTabContent:contents]; } @@ -194,14 +194,14 @@ params.disposition = NEW_FOREGROUND_TAB; params.tabstrip_index = index; browser::Navigate(¶ms); - params.target_contents->tab_contents()->SetNewTabStartTime( + params.target_contents->web_contents()->SetNewTabStartTime( newTabStartTime); [aTab setTabContent:params.target_contents]; } - (void)removeFromTabsAtIndex:(int)index { - browser_->CloseTabContents(browser_->GetTabContentsAt(index)); + browser_->CloseTabContents(browser_->GetWebContentsAt(index)); } - (NSNumber*)orderedIndex { diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm index 0c0cd6a..3fb3b71 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm @@ -11,10 +11,12 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util_mac.h" +using content::WebContents; + @implementation BookmarkAllTabsController - (id)initWithParentWindow:(NSWindow*)parentWindow @@ -45,9 +47,9 @@ TabStripModel* tabstrip_model = browser->tabstrip_model(); const int tabCount = tabstrip_model->count(); for (int i = 0; i < tabCount; ++i) { - TabContents* tc = tabstrip_model->GetTabContentsAt(i)->tab_contents(); - const string16 tabTitle = tc->GetTitle(); - const GURL& tabURL(tc->GetURL()); + WebContents* wc = tabstrip_model->GetTabContentsAt(i)->web_contents(); + const string16 tabTitle = wc->GetTitle(); + const GURL& tabURL(wc->GetURL()); ActiveTabNameURLPair tabPair(tabTitle, tabURL); activeTabPairsVector_.push_back(tabPair); } diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index fd6c773..140fb58 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -1479,7 +1479,7 @@ enum { // TabContentsControllerDelegate protocol. - (void)tabContentsViewFrameWillChange:(TabContentsController*)source frameRect:(NSRect)frameRect { - TabContents* contents = [source tabContents]; + WebContents* contents = [source webContents]; RenderWidgetHostView* render_widget_host_view = contents ? contents->GetRenderWidgetHostView() : NULL; if (!render_widget_host_view) @@ -1518,14 +1518,15 @@ enum { } // TabStripControllerDelegate protocol. -- (void)onActivateTabWithContents:(TabContents*)contents { +- (void)onActivateTabWithContents:(WebContents*)contents { // Update various elements that are interested in knowing the current // TabContents. // Update all the UI bits. windowShim_->UpdateTitleBar(); - [sidebarController_ updateSidebarForTabContents:contents]; + [sidebarController_ updateSidebarForTabContents: + static_cast<TabContents*>(contents)]; [devToolsController_ updateDevToolsForWebContents:contents withProfile:browser_->profile()]; @@ -1546,7 +1547,7 @@ enum { [devToolsController_ ensureContentsVisible]; } -- (void)onReplaceTabWithContents:(TabContents*)contents { +- (void)onReplaceTabWithContents:(WebContents*)contents { // Simply remove the preview view if it exists; the tab strip // controller will reinstall the view as the active view. [previewableContentsController_ hidePreview]; @@ -1554,7 +1555,7 @@ enum { } - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change - withContents:(TabContents*)contents { + withContents:(WebContents*)contents { // Update titles if this is the currently selected tab and if it isn't just // the loading state which changed. if (change != TabStripModelObserver::LOADING_ONLY) @@ -1569,7 +1570,7 @@ enum { [self updateBookmarkBarVisibilityWithAnimation:NO]; } -- (void)onTabDetachedWithContents:(TabContents*)contents { +- (void)onTabDetachedWithContents:(WebContents*)contents { TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(contents); [infoBarContainerController_ tabDetachedWithContents:wrapper]; diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.mm b/chrome/browser/ui/cocoa/dev_tools_controller.mm index 5d10075..7288b01 100644 --- a/chrome/browser/ui/cocoa/dev_tools_controller.mm +++ b/chrome/browser/ui/cocoa/dev_tools_controller.mm @@ -119,8 +119,7 @@ const int kMinContentsSize = 50; } } - [contentsController_ changeTabContents: - static_cast<TabContents*>(devToolsContents)]; + [contentsController_ changeWebContents:devToolsContents]; } - (void)showDevToolsContainer:(Profile*)profile { diff --git a/chrome/browser/ui/cocoa/sidebar_controller.mm b/chrome/browser/ui/cocoa/sidebar_controller.mm index e07cac8..72510b9 100644 --- a/chrome/browser/ui/cocoa/sidebar_controller.mm +++ b/chrome/browser/ui/cocoa/sidebar_controller.mm @@ -76,7 +76,8 @@ const int kMinWebWidth = 50; sidebarContents = activeSidebar->sidebar_contents(); } - TabContents* oldSidebarContents = [contentsController_ tabContents]; + TabContents* oldSidebarContents = static_cast<TabContents*>( + [contentsController_ webContents]); if (oldSidebarContents == sidebarContents) return; @@ -141,7 +142,7 @@ const int kMinWebWidth = 50; } } - [contentsController_ changeTabContents:sidebarContents]; + [contentsController_ changeWebContents:sidebarContents]; } - (void)resizeSidebarToNewWidth:(CGFloat)width { diff --git a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h index 8b6f768..1fcfe05 100644 --- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h +++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h @@ -10,7 +10,6 @@ #include "base/memory/scoped_ptr.h" -class TabContents; class TabContentsNotificationBridge; @class TabContentsController; @@ -28,8 +27,8 @@ class WebContents; @end -// A class that controls the TabContents view. It manages displaying the -// native view for a given TabContents. +// A class that controls the WebContents view. It manages displaying the +// native view for a given WebContents. // Note that just creating the class does not display the view. We defer // inserting it until the box is the correct size to avoid multiple resize // messages to the renderer. You must call |-ensureContentsVisible| to display @@ -37,14 +36,14 @@ class WebContents; @interface TabContentsController : NSViewController { @private - TabContents* contents_; // weak + content::WebContents* contents_; // weak // Delegate to be notified about size changes. id<TabContentsControllerDelegate> delegate_; // weak scoped_ptr<TabContentsNotificationBridge> tabContentsBridge_; } -@property(readonly, nonatomic) TabContents* tabContents; +@property(readonly, nonatomic) content::WebContents* webContents; -- (id)initWithContents:(TabContents*)contents +- (id)initWithContents:(content::WebContents*)contents delegate:(id<TabContentsControllerDelegate>)delegate; // Call when the tab contents is about to be replaced with the currently @@ -58,7 +57,7 @@ class WebContents; // Call to change the underlying web contents object. View is not changed, // call |-ensureContentsVisible| to display the |newContents|'s render widget // host view. -- (void)changeTabContents:(TabContents*)newContents; +- (void)changeWebContents:(content::WebContents*)newContents; // Called when the tab contents is the currently selected tab and is about to be // removed from the view hierarchy. @@ -72,7 +71,7 @@ class WebContents; // Called when the tab contents is updated in some non-descript way (the // notification from the model isn't specific). |updatedContents| could reflect // an entirely new tab contents object. -- (void)tabDidChange:(TabContents*)updatedContents; +- (void)tabDidChange:(content::WebContents*)updatedContents; @end diff --git a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm index 54eb98a..6282c0b 100644 --- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm +++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm @@ -20,7 +20,7 @@ using content::WebContents; @interface TabContentsController(Private) // Forwards frame update to |delegate_| (ResizeNotificationView calls it). - (void)tabContentsViewFrameWillChange:(NSRect)frameRect; -// Notification from TabContents (forwarded by TabContentsNotificationBridge). +// Notification from WebContents (forwarded by TabContentsNotificationBridge). - (void)tabContentsRenderViewHostChanged:(RenderViewHost*)oldHost newHost:(RenderViewHost*)newHost; @end @@ -100,9 +100,9 @@ void TabContentsNotificationBridge::ChangeWebContents(WebContents* contents) { @implementation TabContentsController -@synthesize tabContents = contents_; +@synthesize webContents = contents_; -- (id)initWithContents:(TabContents*)contents +- (id)initWithContents:(WebContents*)contents delegate:(id<TabContentsControllerDelegate>)delegate { if ((self = [super initWithNibName:nil bundle:nil])) { contents_ = contents; @@ -165,7 +165,7 @@ void TabContentsNotificationBridge::ChangeWebContents(WebContents* contents) { NSViewHeightSizable]; } -- (void)changeTabContents:(TabContents*)newContents { +- (void)changeWebContents:(WebContents*)newContents { contents_ = newContents; tabContentsBridge_->ChangeWebContents(contents_); } @@ -189,7 +189,7 @@ void TabContentsNotificationBridge::ChangeWebContents(WebContents* contents) { // The RWHV is ripped out of the view hierarchy on tab switches, so it never // formally resigns first responder status. Handle this by explicitly sending // a Blur() message to the renderer, but only if the RWHV currently has focus. - RenderViewHost* rvh = [self tabContents]->GetRenderViewHost(); + RenderViewHost* rvh = [self webContents]->GetRenderViewHost(); if (rvh && rvh->view() && rvh->view()->HasFocus()) rvh->Blur(); } @@ -200,13 +200,13 @@ void TabContentsNotificationBridge::ChangeWebContents(WebContents* contents) { // logic will restore focus to the appropriate view. } -- (void)tabDidChange:(TabContents*)updatedContents { +- (void)tabDidChange:(WebContents*)updatedContents { // Calling setContentView: here removes any first responder status // the view may have, so avoid changing the view hierarchy unless // the view is different. - if ([self tabContents] != updatedContents) { - [self changeTabContents:updatedContents]; - if ([self tabContents]) + if ([self webContents] != updatedContents) { + [self changeWebContents:updatedContents]; + if ([self webContents]) [self ensureContentsVisible]; } } diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index 08d3a2c..2fb2a8f 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -32,7 +32,7 @@ #include "content/browser/renderer_host/backing_store_mac.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "grit/theme_resources.h" #include "grit/ui_resources.h" #include "skia/ext/skia_utils_mac.h" @@ -225,7 +225,7 @@ void ThumbnailLoader::LoadThumbnail() { // Medium term, we want to show thumbs of the actual info bar views, which // means I need to create InfoBarControllers here. - NSWindow* window = [contents_->tab_contents()->GetNativeView() window]; + NSWindow* window = [contents_->web_contents()->GetNativeView() window]; NSWindowController* windowController = [window windowController]; if ([windowController isKindOfClass:[BrowserWindowController class]]) { BrowserWindowController* bwc = @@ -253,14 +253,14 @@ void ThumbnailLoader::LoadThumbnail() { int bottomOffset = 0; TabContentsWrapper* devToolsContents = DevToolsWindow::GetDevToolsContents(contents_->web_contents()); - if (devToolsContents && devToolsContents->tab_contents() && - devToolsContents->tab_contents()->GetRenderViewHost() && - devToolsContents->tab_contents()->GetRenderViewHost()->view()) { + if (devToolsContents && devToolsContents->web_contents() && + devToolsContents->web_contents()->GetRenderViewHost() && + devToolsContents->web_contents()->GetRenderViewHost()->view()) { // The devtool's size might not be up-to-date, but since its height doesn't // change on window resize, and since most users don't use devtools, this is // good enough. bottomOffset += - devToolsContents->tab_contents()->GetRenderViewHost()->view()-> + devToolsContents->web_contents()->GetRenderViewHost()->view()-> GetViewBounds().height(); bottomOffset += 1; // :-( Divider line between web contents and devtools. } @@ -285,7 +285,7 @@ void ThumbnailLoader::LoadThumbnail() { } - (void)drawInContext:(CGContextRef)context { - RenderWidgetHost* rwh = contents_->tab_contents()->GetRenderViewHost(); + RenderWidgetHost* rwh = contents_->web_contents()->GetRenderViewHost(); // NULL if renderer crashed. RenderWidgetHostView* rwhv = rwh ? rwh->view() : NULL; if (!rwhv) { @@ -431,7 +431,7 @@ class Tile { // Returns an unelided title. The view logic is responsible for eliding. const string16& title() const { - return contents_->tab_contents()->GetTitle(); + return contents_->web_contents()->GetTitle(); } TabContentsWrapper* tab_contents() const { return contents_; } diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h index 6f730c4..f65ad55 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h @@ -27,7 +27,6 @@ class Browser; class ConstrainedWindowMac; class TabStripModelObserverBridge; class TabStripModel; -class TabContents; // The interface for the tab strip controller's delegate. // Delegating TabStripModelObserverBridge's events (in lieu of directly @@ -37,17 +36,17 @@ class TabContents; @protocol TabStripControllerDelegate // Stripped down version of TabStripModelObserverBridge:selectTabWithContents. -- (void)onActivateTabWithContents:(TabContents*)contents; +- (void)onActivateTabWithContents:(content::WebContents*)contents; // Stripped down version of TabStripModelObserverBridge:tabReplacedWithContents. -- (void)onReplaceTabWithContents:(TabContents*)contents; +- (void)onReplaceTabWithContents:(content::WebContents*)contents; // Stripped down version of TabStripModelObserverBridge:tabChangedWithContents. - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change - withContents:(TabContents*)contents; + withContents:(content::WebContents*)contents; // Stripped down version of TabStripModelObserverBridge:tabDetachedWithContents. -- (void)onTabDetachedWithContents:(TabContents*)contents; +- (void)onTabDetachedWithContents:(content::WebContents*)contents; @end diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index 11cbb56..c9a4abc 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -51,10 +51,10 @@ #include "chrome/browser/ui/tabs/tab_menu_model.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/user_metrics.h" +#include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" @@ -69,6 +69,7 @@ using content::OpenURLParams; using content::Referrer; using content::UserMetricsAction; +using content::WebContents; NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged"; @@ -502,7 +503,7 @@ private: } // New content is in place, delegate should adjust itself accordingly. - [delegate_ onActivateTabWithContents:[controller tabContents]]; + [delegate_ onActivateTabWithContents:[controller webContents]]; // It also restores content autoresizing properties. [controller ensureContentsVisible]; @@ -1095,7 +1096,7 @@ private: // Handles setting the title of the tab based on the given |contents|. Uses // a canned string if |contents| is NULL. -- (void)setTabTitle:(NSViewController*)tab withContents:(TabContents*)contents { +- (void)setTabTitle:(NSViewController*)tab withContents:(WebContents*)contents { NSString* titleString = nil; if (contents) titleString = base::SysUTF16ToNSString(contents->GetTitle()); @@ -1123,7 +1124,7 @@ private: // Make a new tab. Load the contents of this tab from the nib and associate // the new controller with |contents| so it can be looked up later. scoped_nsobject<TabContentsController> contentsController( - [[TabContentsController alloc] initWithContents:contents->tab_contents() + [[TabContentsController alloc] initWithContents:contents->web_contents() delegate:self]); [tabContentsArray_ insertObject:contentsController atIndex:index]; @@ -1132,7 +1133,7 @@ private: [newController setMini:tabStripModel_->IsMiniTab(modelIndex)]; [newController setPinned:tabStripModel_->IsTabPinned(modelIndex)]; [newController setApp:tabStripModel_->IsAppTab(modelIndex)]; - [newController setUrl:contents->tab_contents()->GetURL()]; + [newController setUrl:contents->web_contents()->GetURL()]; [tabArray_ insertObject:newController atIndex:index]; NSView* newView = [newController view]; @@ -1142,7 +1143,7 @@ private: [newView setFrame:NSOffsetRect([newView frame], 0, -[[self class] defaultTabHeight])]; - [self setTabTitle:newController withContents:contents->tab_contents()]; + [self setTabTitle:newController withContents:contents->web_contents()]; // If a tab is being inserted, we can again use the entire tab strip width // for layout. @@ -1179,14 +1180,14 @@ private: if (oldContents) { int oldModelIndex = browser_->GetIndexOfController( - &(oldContents->tab_contents()->GetController())); + &(oldContents->web_contents()->GetController())); if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone. NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex]; TabContentsController* oldController = [tabContentsArray_ objectAtIndex:oldIndex]; [oldController willBecomeUnselectedTab]; - oldContents->tab_contents()->GetView()->StoreFocus(); - oldContents->tab_contents()->WasHidden(); + oldContents->web_contents()->GetView()->StoreFocus(); + oldContents->web_contents()->WasHidden(); } } @@ -1221,8 +1222,8 @@ private: [self swapInTabAtIndex:modelIndex]; if (newContents) { - newContents->tab_contents()->DidBecomeSelected(); - newContents->tab_contents()->GetView()->RestoreFocus(); + newContents->web_contents()->DidBecomeSelected(); + newContents->web_contents()->GetView()->RestoreFocus(); if (newContents->find_tab_helper()->find_ui_active()) browser_->GetFindBarController()->find_bar()->SetFocusAndSelection(); @@ -1235,20 +1236,20 @@ private: NSInteger index = [self indexFromModelIndex:modelIndex]; TabContentsController* oldController = [tabContentsArray_ objectAtIndex:index]; - DCHECK_EQ(oldContents->tab_contents(), [oldController tabContents]); + DCHECK_EQ(oldContents->web_contents(), [oldController webContents]); // Simply create a new TabContentsController for |newContents| and place it // into the array, replacing |oldContents|. A ActiveTabChanged notification // will follow, at which point we will install the new view. scoped_nsobject<TabContentsController> newController( [[TabContentsController alloc] - initWithContents:newContents->tab_contents() + initWithContents:newContents->web_contents() delegate:self]); // Bye bye, |oldController|. [tabContentsArray_ replaceObjectAtIndex:index withObject:newController]; - [delegate_ onReplaceTabWithContents:newContents->tab_contents()]; + [delegate_ onReplaceTabWithContents:newContents->web_contents()]; // Fake a tab changed notification to force tab titles and favicons to update. [self tabChangedWithContents:newContents @@ -1366,7 +1367,7 @@ private: postNotificationName:kTabStripNumberOfTabsChanged object:self]; - [delegate_ onTabDetachedWithContents:contents->tab_contents()]; + [delegate_ onTabDetachedWithContents:contents->web_contents()]; } // A helper routine for creating an NSImageView to hold the favicon or app icon @@ -1423,13 +1424,13 @@ private: TabLoadingState oldState = [tabController loadingState]; TabLoadingState newState = kTabDone; NSImage* throbberImage = nil; - if (contents->tab_contents()->IsCrashed()) { + if (contents->web_contents()->IsCrashed()) { newState = kTabCrashed; newHasIcon = true; - } else if (contents->tab_contents()->IsWaitingForResponse()) { + } else if (contents->web_contents()->IsWaitingForResponse()) { newState = kTabWaiting; throbberImage = throbberWaitingImage; - } else if (contents->tab_contents()->IsLoading()) { + } else if (contents->web_contents()->IsLoading()) { newState = kTabLoading; throbberImage = throbberLoadingImage; } @@ -1476,7 +1477,7 @@ private: NSInteger index = [self indexFromModelIndex:modelIndex]; if (modelIndex == tabStripModel_->active_index()) - [delegate_ onTabChanged:change withContents:contents->tab_contents()]; + [delegate_ onTabChanged:change withContents:contents->web_contents()]; if (change == TabStripModelObserver::TITLE_NOT_LOADING) { // TODO(sky): make this work. @@ -1487,13 +1488,13 @@ private: TabController* tabController = [tabArray_ objectAtIndex:index]; if (change != TabStripModelObserver::LOADING_ONLY) - [self setTabTitle:tabController withContents:contents->tab_contents()]; + [self setTabTitle:tabController withContents:contents->web_contents()]; [self updateFaviconForContents:contents atIndex:modelIndex]; TabContentsController* updatedController = [tabContentsArray_ objectAtIndex:index]; - [updatedController tabDidChange:contents->tab_contents()]; + [updatedController tabDidChange:contents->web_contents()]; } // Called when a tab is moved (usually by drag&drop). Keep our parallel arrays @@ -1543,7 +1544,7 @@ private: [tabController setMini:tabStripModel_->IsMiniTab(modelIndex)]; [tabController setPinned:tabStripModel_->IsTabPinned(modelIndex)]; [tabController setApp:tabStripModel_->IsAppTab(modelIndex)]; - [tabController setUrl:contents->tab_contents()->GetURL()]; + [tabController setUrl:contents->web_contents()->GetURL()]; [self updateFaviconForContents:contents atIndex:modelIndex]; // If the tab is being restored and it's pinned, the mini state is set after // the tab has already been rendered, so re-layout the tabstrip. In all other @@ -1886,7 +1887,7 @@ private: content::RecordAction(UserMetricsAction("Tab_DropURLOnTab")); OpenURLParams params( *url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); - tabStripModel_->GetTabContentsAt(index)->tab_contents()->OpenURL(params); + tabStripModel_->GetTabContentsAt(index)->web_contents()->OpenURL(params); tabStripModel_->ActivateTabAt(index, true); break; default: @@ -2056,7 +2057,7 @@ private: // We use the TabContentsController's view in |swapInTabAtIndex|, so we have // to pass it to the sheet controller here. NSView* tabContentsView = - [window->owner()->tab_contents()->GetNativeView() superview]; + [window->owner()->web_contents()->GetNativeView() superview]; window->delegate()->RunSheet([self sheetController], tabContentsView); // TODO(avi, thakis): GTMWindowSheetController has no api to move tabsheets @@ -2075,7 +2076,7 @@ private: - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window { NSView* tabContentsView = - [window->owner()->tab_contents()->GetNativeView() superview]; + [window->owner()->web_contents()->GetNativeView() superview]; // TODO(avi, thakis): GTMWindowSheetController has no api to move tabsheets // between windows. Until then, we have to prevent having to move a tabsheet diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm index f5783ad..1ac6841 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm @@ -19,20 +19,22 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +using content::WebContents; + @interface TestTabStripControllerDelegate : NSObject<TabStripControllerDelegate> { } @end @implementation TestTabStripControllerDelegate -- (void)onActivateTabWithContents:(TabContents*)contents { +- (void)onActivateTabWithContents:(WebContents*)contents { } -- (void)onReplaceTabWithContents:(TabContents*)contents { +- (void)onReplaceTabWithContents:(WebContents*)contents { } - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change - withContents:(TabContents*)contents { + withContents:(WebContents*)contents { } -- (void)onTabDetachedWithContents:(TabContents*)contents { +- (void)onTabDetachedWithContents:(WebContents*)contents { } @end diff --git a/chrome/browser/ui/gtk/tabs/drag_data.cc b/chrome/browser/ui/gtk/tabs/drag_data.cc index ce9268a..28ca688 100644 --- a/chrome/browser/ui/gtk/tabs/drag_data.cc +++ b/chrome/browser/ui/gtk/tabs/drag_data.cc @@ -10,6 +10,8 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/web_contents_delegate.h" +using content::WebContents; + DraggedTabData::DraggedTabData() : tab_(NULL), contents_(NULL), @@ -97,9 +99,9 @@ TabContentsWrapper* DragData::GetSourceTabContentsWrapper() { return GetSourceTabData()->contents_; } -TabContents* DragData::GetSourceTabContents() { +WebContents* DragData::GetSourceWebContents() { TabContentsWrapper* contents = GetSourceTabData()->contents_; - return contents ? contents->tab_contents(): NULL; + return contents ? contents->web_contents(): NULL; } DraggedTabData* DragData::GetSourceTabData() { diff --git a/chrome/browser/ui/gtk/tabs/drag_data.h b/chrome/browser/ui/gtk/tabs/drag_data.h index 827bb09..1cfb749 100644 --- a/chrome/browser/ui/gtk/tabs/drag_data.h +++ b/chrome/browser/ui/gtk/tabs/drag_data.h @@ -15,6 +15,7 @@ class TabContentsWrapper; class TabGtk; namespace content { +class WebContents; class WebContentsDelegate; } @@ -92,8 +93,8 @@ class DragData { // Convenience for |source_tab_drag_data()->contents_|. TabContentsWrapper* GetSourceTabContentsWrapper(); - // Convenience for |source_tab_drag_data()->contents_->tab_contents()|. - TabContents* GetSourceTabContents(); + // Convenience for |source_tab_drag_data()->contents_->web_contents()|. + content::WebContents* GetSourceWebContents(); // Convenience for getting the DraggedTabData corresponding to the tab that // was under the mouse pointer when the user started dragging. diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc index d80d4f7..fdf6b57 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc @@ -18,9 +18,9 @@ #include "chrome/browser/ui/gtk/tabs/dragged_view_gtk.h" #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "ui/gfx/screen.h" using content::OpenURLParams; @@ -90,7 +90,7 @@ void DraggedTabControllerGtk::CaptureDragInfo(const gfx::Point& mouse_offset) { void DraggedTabControllerGtk::Drag() { if (!drag_data_->GetSourceTabData()->tab_ || !drag_data_->GetSourceTabContentsWrapper() || - !drag_data_->GetSourceTabContents()) { + !drag_data_->GetSourceWebContents()) { return; } @@ -115,10 +115,10 @@ bool DraggedTabControllerGtk::EndDrag(bool canceled) { } TabGtk* DraggedTabControllerGtk::GetDraggedTabForContents( - TabContents* contents) { + WebContents* contents) { if (attached_tabstrip_ == source_tabstrip_) { for (size_t i = 0; i < drag_data_->size(); i++) { - if (contents == drag_data_->get(i)->contents_->tab_contents()) + if (contents == drag_data_->get(i)->contents_->web_contents()) return drag_data_->get(i)->tab_; } } @@ -157,15 +157,15 @@ DraggedTabData DraggedTabControllerGtk::InitDraggedTabData(TabGtk* tab) { // collected/destroyed while the drag is in process, leading to // nasty crashes. content::WebContentsDelegate* original_delegate = - contents->tab_contents()->GetDelegate(); - contents->tab_contents()->SetDelegate(this); + contents->web_contents()->GetDelegate(); + contents->web_contents()->SetDelegate(this); DraggedTabData dragged_tab_data(tab, contents, original_delegate, source_model_index, pinned, mini); registrar_.Add( this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::Source<WebContents>(dragged_tab_data.contents_->tab_contents())); + content::Source<WebContents>(dragged_tab_data.contents_->web_contents())); return dragged_tab_data; } @@ -229,7 +229,7 @@ void DraggedTabControllerGtk::Observe( DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); WebContents* destroyed_contents = content::Source<WebContents>(source).ptr(); for (size_t i = 0; i < drag_data_->size(); ++i) { - if (drag_data_->get(i)->contents_->tab_contents() == destroyed_contents) { + if (drag_data_->get(i)->contents_->web_contents() == destroyed_contents) { // One of the tabs we're dragging has been destroyed. Cancel the drag. if (destroyed_contents->GetDelegate() == this) destroyed_contents->SetDelegate(NULL); @@ -426,12 +426,12 @@ void DraggedTabControllerGtk::Attach(TabStripGtk* attached_tabstrip, // Remove ourselves as the delegate now that the dragged TabContents is // being inserted back into a Browser. for (size_t i = 0; i < drag_data_->size(); ++i) { - drag_data_->get(i)->contents_->tab_contents()->SetDelegate(NULL); + drag_data_->get(i)->contents_->web_contents()->SetDelegate(NULL); drag_data_->get(i)->original_delegate_ = NULL; } // Return the TabContents' to normalcy. - drag_data_->GetSourceTabContents()->SetCapturingContents(false); + drag_data_->GetSourceWebContents()->SetCapturingContents(false); // We need to ask the tabstrip we're attached to ensure that the ideal // bounds for all its tabs are correctly generated, because the calculation @@ -490,7 +490,7 @@ void DraggedTabControllerGtk::Detach() { // Detaching resets the delegate, but we still want to be the delegate. for (size_t i = 0; i < drag_data_->size(); ++i) - drag_data_->get(i)->contents_->tab_contents()->SetDelegate(this); + drag_data_->get(i)->contents_->web_contents()->SetDelegate(this); attached_tabstrip_ = NULL; } @@ -785,7 +785,7 @@ bool DraggedTabControllerGtk::CompleteDrag() { void DraggedTabControllerGtk::ResetDelegates() { for (size_t i = 0; i < drag_data_->size(); ++i) { if (drag_data_->get(i)->contents_ && - drag_data_->get(i)->contents_->tab_contents()->GetDelegate() == this) { + drag_data_->get(i)->contents_->web_contents()->GetDelegate() == this) { drag_data_->get(i)->ResetDelegate(); } } @@ -794,7 +794,7 @@ void DraggedTabControllerGtk::ResetDelegates() { void DraggedTabControllerGtk::EnsureDraggedView() { if (!dragged_view_.get()) { gfx::Rect rect; - drag_data_->GetSourceTabContents()->GetContainerBounds(&rect); + drag_data_->GetSourceWebContents()->GetContainerBounds(&rect); dragged_view_.reset(new DraggedViewGtk(drag_data_.get(), mouse_offset_, rect.size())); } @@ -850,7 +850,7 @@ void DraggedTabControllerGtk::CleanUpDraggedTabs() { registrar_.Remove( this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::Source<WebContents>( - drag_data_->get(i)->contents_->tab_contents())); + drag_data_->get(i)->contents_->web_contents())); } source_tabstrip_->DestroyDraggedTab(drag_data_->get(i)->tab_); drag_data_->get(i)->tab_ = NULL; diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h index 198b885..5b01d41 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h @@ -58,7 +58,7 @@ class DraggedTabControllerGtk : public content::NotificationObserver, // Retrieve the tab that corresponds to |contents| if it is being dragged by // this controller, or NULL if |contents| does not correspond to any tab // being dragged. - TabGtk* GetDraggedTabForContents(TabContents* contents); + TabGtk* GetDraggedTabForContents(content::WebContents* contents); // Returns true if |tab| matches any tab being dragged. bool IsDraggingTab(const TabGtk* tab); diff --git a/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc index 86ed7c8..2857c22 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc @@ -390,7 +390,7 @@ gboolean DraggedViewGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event) { gtk_widget_get_allocation(widget, &allocation); // Draw the render area. - BackingStore* backing_store = drag_data_->GetSourceTabContents()-> + BackingStore* backing_store = drag_data_->GetSourceWebContents()-> GetRenderViewHost()->GetBackingStore(false); if (backing_store && !attached_) { // This leaves room for the border. diff --git a/chrome/browser/ui/gtk/tabs/tab_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_gtk.cc index 7b0037a..e32085c 100644 --- a/chrome/browser/ui/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_gtk.cc @@ -24,6 +24,8 @@ #include "ui/base/gtk/scoped_handle_gtk.h" #include "ui/gfx/path.h" +using content::WebContents; + namespace { // Returns the width of the title for the current font, in pixels. @@ -264,7 +266,7 @@ void TabGtk::CloseButtonClicked() { delegate_->CloseTab(this); } -void TabGtk::UpdateData(TabContents* contents, bool app, bool loading_only) { +void TabGtk::UpdateData(WebContents* contents, bool app, bool loading_only) { TabRendererGtk::UpdateData(contents, app, loading_only); // Cache the title width so we don't recalculate it every time the tab is // resized. diff --git a/chrome/browser/ui/gtk/tabs/tab_gtk.h b/chrome/browser/ui/gtk/tabs/tab_gtk.h index 85e24fd..145b48f 100644 --- a/chrome/browser/ui/gtk/tabs/tab_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_gtk.h @@ -120,7 +120,7 @@ class TabGtk : public TabRendererGtk, virtual bool IsVisible() const OVERRIDE; virtual void SetVisible(bool visible) const OVERRIDE; virtual void CloseButtonClicked() OVERRIDE; - virtual void UpdateData(TabContents* contents, + virtual void UpdateData(content::WebContents* contents, bool app, bool loading_only) OVERRIDE; virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc index b34a600..bfb6d66 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc @@ -41,6 +41,8 @@ #include "ui/gfx/platform_font_pango.h" #include "ui/gfx/skbitmap_operations.h" +using content::WebContents; + #if !GTK_CHECK_VERSION(2, 22, 0) #define gtk_button_get_event_window(button) button->event_window #endif // Gtk+ >= 2.22 @@ -322,7 +324,7 @@ void TabRendererGtk::Observe(int type, theme_service_->GetColor(ThemeService::COLOR_BACKGROUND_TAB_TEXT); } -void TabRendererGtk::UpdateData(TabContents* contents, +void TabRendererGtk::UpdateData(WebContents* contents, bool app, bool loading_only) { DCHECK(contents); diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h index a0617a2..b7cc579 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h @@ -31,9 +31,12 @@ class Size; } // namespace gfx class CustomDrawButton; -class TabContents; class GtkThemeService; +namespace content { +class WebContents; +} + namespace ui { class SlideAnimation; class ThrobAnimation; @@ -106,10 +109,10 @@ class TabRendererGtk : public ui::AnimationDelegate, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // TabContents. If only the loading state was updated, the loading_only flag + // WebContents. If only the loading state was updated, the loading_only flag // should be specified. If other things change, set this flag to false to // update everything. - virtual void UpdateData(TabContents* contents, bool app, bool loading_only); + void UpdateData(content::WebContents* contents, bool app, bool loading_only); // Sets the blocked state of the tab. void SetBlocked(bool pinned); diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index 5b15a55..64c8946 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -29,8 +29,8 @@ #include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_notification_types.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_source.h" +#include "content/public/browser/web_contents.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "grit/ui_resources.h" @@ -44,6 +44,8 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/point.h" +using content::WebContents; + namespace { const int kDefaultAnimationDurationMs = 100; @@ -333,7 +335,7 @@ class InsertTabAnimation : public TabStripGtk::TabAnimation { // Handles removal of a Tab from |index| class RemoveTabAnimation : public TabStripGtk::TabAnimation { public: - RemoveTabAnimation(TabStripGtk* tabstrip, int index, TabContents* contents) + RemoveTabAnimation(TabStripGtk* tabstrip, int index, WebContents* contents) : TabAnimation(tabstrip, REMOVE), index_(index) { int tab_count = tabstrip->GetTabCount(); @@ -850,9 +852,9 @@ void TabStripGtk::UpdateLoadingAnimations() { } else { TabRendererGtk::AnimationState state; TabContentsWrapper* contents = model_->GetTabContentsAt(index); - if (!contents || !contents->tab_contents()->IsLoading()) { + if (!contents || !contents->web_contents()->IsLoading()) { state = TabGtk::ANIMATION_NONE; - } else if (contents->tab_contents()->IsWaitingForResponse()) { + } else if (contents->web_contents()->IsWaitingForResponse()) { state = TabGtk::ANIMATION_WAITING; } else { state = TabGtk::ANIMATION_LOADING; @@ -983,7 +985,7 @@ void TabStripGtk::TabInsertedAt(TabContentsWrapper* contents, // again. if (IsDragSessionActive()) { tab = drag_controller_->GetDraggedTabForContents( - contents->tab_contents()); + contents->web_contents()); if (tab) { // If the Tab was detached, it would have been animated closed but not // removed, so we need to reset this property. @@ -1007,7 +1009,7 @@ void TabStripGtk::TabInsertedAt(TabContentsWrapper* contents, if (!contains_tab) { TabData d = { tab, gfx::Rect() }; tab_data_.insert(tab_data_.begin() + index, d); - tab->UpdateData(contents->tab_contents(), model_->IsAppTab(index), false); + tab->UpdateData(contents->web_contents(), model_->IsAppTab(index), false); } tab->set_mini(model_->IsMiniTab(index)); tab->set_app(model_->IsAppTab(index)); @@ -1032,7 +1034,7 @@ void TabStripGtk::TabInsertedAt(TabContentsWrapper* contents, void TabStripGtk::TabDetachedAt(TabContentsWrapper* contents, int index) { GenerateIdealBounds(); - StartRemoveTabAnimation(index, contents->tab_contents()); + StartRemoveTabAnimation(index, contents->web_contents()); // Have to do this _after_ calling StartRemoveTabAnimation, so that any // previous remove is completed fully and index is valid in sync with the // model index. @@ -1120,7 +1122,7 @@ void TabStripGtk::TabChangedAt(TabContentsWrapper* contents, int index, // We'll receive another notification of the change asynchronously. return; } - tab->UpdateData(contents->tab_contents(), + tab->UpdateData(contents->web_contents(), model_->IsAppTab(index), change_type == LOADING_ONLY); tab->UpdateFromModel(); @@ -1944,7 +1946,7 @@ void TabStripGtk::StartInsertTabAnimation(int index) { active_animation_->Start(); } -void TabStripGtk::StartRemoveTabAnimation(int index, TabContents* contents) { +void TabStripGtk::StartRemoveTabAnimation(int index, WebContents* contents) { if (active_animation_.get()) { // Some animations (e.g. MoveTabAnimation) cause there to be a Layout when // they're completed (which includes canceled). Since |tab_data_| is now diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h index 8f353f8..fb72d5d 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h @@ -412,7 +412,7 @@ class TabStripGtk : public TabStripModelObserver, // Starts various types of TabStrip animations. void StartInsertTabAnimation(int index); - void StartRemoveTabAnimation(int index, TabContents* contents); + void StartRemoveTabAnimation(int index, content::WebContents* contents); void StartMoveTabAnimation(int from_index, int to_index); void StartMiniTabAnimation(int index); void StartMiniMoveTabAnimation(int from_index, diff --git a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm index d414b22..4597ff2 100644 --- a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm +++ b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm @@ -305,12 +305,12 @@ int PanelBrowserWindowCocoa::TitleOnlyHeight() const { void PanelBrowserWindowCocoa::TabInsertedAt(TabContentsWrapper* contents, int index, bool foreground) { - [controller_ tabInserted:contents->tab_contents()]; + [controller_ tabInserted:contents->web_contents()]; } void PanelBrowserWindowCocoa::TabDetachedAt(TabContentsWrapper* contents, int index) { - [controller_ tabDetached:contents->tab_contents()]; + [controller_ tabDetached:contents->web_contents()]; } // NativePanelTesting implementation. diff --git a/chrome/browser/ui/panels/panel_window_controller_cocoa.h b/chrome/browser/ui/panels/panel_window_controller_cocoa.h index 1d4ea54..651f7bc 100644 --- a/chrome/browser/ui/panels/panel_window_controller_cocoa.h +++ b/chrome/browser/ui/panels/panel_window_controller_cocoa.h @@ -63,8 +63,8 @@ class PanelBrowserWindowCocoa; - (ThemedWindowStyle)themedWindowStyle; - (NSPoint)themePatternPhase; -- (void)tabInserted:(TabContents*)contents; -- (void)tabDetached:(TabContents*)contents; +- (void)tabInserted:(content::WebContents*)contents; +- (void)tabDetached:(content::WebContents*)contents; // Sometimes (when we animate the size of the window) we want to stop resizing // the TabContents' cocoa view to avoid unnecessary rendering and issues diff --git a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm index b3d04d7..6b24cc2 100644 --- a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm +++ b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm @@ -40,6 +40,8 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/mac/nsimage_cache.h" +using content::WebContents; + const int kMinimumWindowSize = 1; const double kBoundsAnimationSpeedPixelsPerSecond = 1000; const double kBoundsAnimationMaxDurationSeconds = 0.18; @@ -182,10 +184,10 @@ enum { // we always deactivate the controls here. If we're created as an active // panel, we'll get a NSWindowDidBecomeKeyNotification and reactivate the web // view properly. See crbug.com/97831 for more details. - TabContents* tab_contents = [contentsController_ tabContents]; + WebContents* web_contents = [contentsController_ webContents]; // RWHV may be NULL in unit tests. - if (tab_contents && tab_contents->GetRenderWidgetHostView()) - tab_contents->GetRenderWidgetHostView()->SetActive(false); + if (web_contents && web_contents->GetRenderWidgetHostView()) + web_contents->GetRenderWidgetHostView()->SetActive(false); [window setFrame:frame display:YES animate:YES]; [self enableTabContentsViewAutosizing]; @@ -249,14 +251,14 @@ enum { [findBarCocoaController positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; } -- (void)tabInserted:(TabContents*)contents { - [contentsController_ changeTabContents:contents]; +- (void)tabInserted:(WebContents*)contents { + [contentsController_ changeWebContents:contents]; DCHECK(![[contentsController_ view] isHidden]); } -- (void)tabDetached:(TabContents*)contents { - DCHECK(contents == [contentsController_ tabContents]); - [contentsController_ changeTabContents:NULL]; +- (void)tabDetached:(WebContents*)contents { + DCHECK(contents == [contentsController_ webContents]); + [contentsController_ changeWebContents:NULL]; [[contentsController_ view] setHidden:YES]; } @@ -541,7 +543,7 @@ enum { // We need to activate the controls (in the "WebView"). To do this, get the // selected TabContents's RenderWidgetHostViewMac and tell it to activate. - if (TabContents* contents = [contentsController_ tabContents]) { + if (WebContents* contents = [contentsController_ webContents]) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetActive(true); } @@ -569,7 +571,7 @@ enum { // We need to deactivate the controls (in the "WebView"). To do this, get the // selected TabContents's RenderWidgetHostView and tell it to deactivate. - if (TabContents* contents = [contentsController_ tabContents]) { + if (WebContents* contents = [contentsController_ webContents]) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetActive(false); } diff --git a/chrome/browser/ui/toolbar/toolbar_model_unittest.cc b/chrome/browser/ui/toolbar/toolbar_model_unittest.cc index a5bc9c8..ea46d4a 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_unittest.cc +++ b/chrome/browser/ui/toolbar/toolbar_model_unittest.cc @@ -8,11 +8,12 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" #include "chrome/test/base/browser_with_test_window_test.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h" using content::OpenURLParams; using content::Referrer; +using content::WebContents; class ToolbarModelTest : public BrowserWithTestWindowTest { public: @@ -22,7 +23,7 @@ class ToolbarModelTest : public BrowserWithTestWindowTest { void NavigateAndCheckText(const std::string& url, const std::string& expected_text, bool should_display) { - TabContents* contents = browser()->GetTabContentsAt(0); + WebContents* contents = browser()->GetWebContentsAt(0); browser()->OpenURL(OpenURLParams( GURL(url), Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc index 75a0fde..1829fed 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc @@ -15,8 +15,8 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "net/test/test_server.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -97,7 +97,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_CrashEscHandlers) { browser()->ActivateTabAt(0, true); // Close tab B. - browser()->CloseTabContents(browser()->GetTabContentsAt(1)); + browser()->CloseTabContents(browser()->GetWebContentsAt(1)); // Click on the location bar so that Find box loses focus. ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(), diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc index 42527d8..45e1e1a 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc @@ -10,8 +10,8 @@ #include "chrome/browser/ui/views/ssl_client_certificate_selector.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/ssl/ssl_client_auth_handler_mock.h" +#include "content/public/browser/web_contents.h" #include "net/base/cert_test_util.h" #include "net/base/x509_certificate.h" #include "net/url_request/url_request.h" @@ -142,11 +142,11 @@ class SSLClientCertificateSelectorMultiTabTest AddTabAtIndex(1, GURL("about:blank"), content::PAGE_TRANSITION_LINK); AddTabAtIndex(2, GURL("about:blank"), content::PAGE_TRANSITION_LINK); - ASSERT_TRUE(NULL != browser()->GetTabContentsAt(0)); - ASSERT_TRUE(NULL != browser()->GetTabContentsAt(1)); - ASSERT_TRUE(NULL != browser()->GetTabContentsAt(2)); - ui_test_utils::WaitForLoadStop(browser()->GetTabContentsAt(1)); - ui_test_utils::WaitForLoadStop(browser()->GetTabContentsAt(2)); + ASSERT_TRUE(NULL != browser()->GetWebContentsAt(0)); + ASSERT_TRUE(NULL != browser()->GetWebContentsAt(1)); + ASSERT_TRUE(NULL != browser()->GetWebContentsAt(2)); + ui_test_utils::WaitForLoadStop(browser()->GetWebContentsAt(1)); + ui_test_utils::WaitForLoadStop(browser()->GetWebContentsAt(2)); selector_1_ = new SSLClientCertificateSelector( browser()->GetTabContentsWrapperAt(1), diff --git a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc index 554dd8b..b691495 100644 --- a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc +++ b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc @@ -20,12 +20,12 @@ #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" #include "chrome/browser/ui/views/tabs/tab.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/user_metrics.h" +#include "content/public/browser/web_contents.h" #include "grit/theme_resources.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/animation/animation.h" @@ -381,14 +381,14 @@ void DefaultTabDragController::InitTabDragData(BaseTab* tab, registrar_.Add( this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::Source<WebContents>(drag_data->contents->tab_contents())); + content::Source<WebContents>(drag_data->contents->web_contents())); // We need to be the delegate so we receive messages about stuff, otherwise // our dragged TabContents may be replaced and subsequently // collected/destroyed while the drag is in process, leading to nasty crashes. drag_data->original_delegate = - drag_data->contents->tab_contents()->GetDelegate(); - drag_data->contents->tab_contents()->SetDelegate(this); + drag_data->contents->web_contents()->GetDelegate(); + drag_data->contents->web_contents()->SetDelegate(this); } void DefaultTabDragController::Drag() { @@ -491,7 +491,7 @@ void DefaultTabDragController::Observe( DCHECK_EQ(type, content::NOTIFICATION_WEB_CONTENTS_DESTROYED); WebContents* destroyed_contents = content::Source<WebContents>(source).ptr(); for (size_t i = 0; i < drag_data_.size(); ++i) { - if (drag_data_[i].contents->tab_contents() == destroyed_contents) { + if (drag_data_[i].contents->web_contents() == destroyed_contents) { // One of the tabs we're dragging has been destroyed. Cancel the drag. if (destroyed_contents->GetDelegate() == this) destroyed_contents->SetDelegate(NULL); @@ -839,12 +839,12 @@ void DefaultTabDragController::Attach(TabStrip* attached_tabstrip, // Remove ourselves as the delegate now that the dragged TabContents is // being inserted back into a Browser. for (size_t i = 0; i < drag_data_.size(); ++i) { - drag_data_[i].contents->tab_contents()->SetDelegate(NULL); + drag_data_[i].contents->web_contents()->SetDelegate(NULL); drag_data_[i].original_delegate = NULL; } // Return the TabContents' to normalcy. - source_dragged_contents()->tab_contents()->SetCapturingContents(false); + source_dragged_contents()->web_contents()->SetCapturingContents(false); // Inserting counts as a move. We don't want the tabs to jitter when the // user moves the tab immediately after attaching it. @@ -899,7 +899,7 @@ void DefaultTabDragController::Attach(TabStrip* attached_tabstrip, void DefaultTabDragController::Detach() { // Prevent the TabContents' HWND from being hidden by any of the model // operations performed during the drag. - source_dragged_contents()->tab_contents()->SetCapturingContents(true); + source_dragged_contents()->web_contents()->SetCapturingContents(true); // Calculate the drag bounds. std::vector<gfx::Rect> drag_bounds; @@ -922,7 +922,7 @@ void DefaultTabDragController::Detach() { attached_model->DetachTabContentsAt(index); // Detaching resets the delegate, but we still want to be the delegate. - drag_data_[i].contents->tab_contents()->SetDelegate(this); + drag_data_[i].contents->web_contents()->SetDelegate(this); // Detaching may end up deleting the tab, drop references to it. drag_data_[i].attached_tab = NULL; @@ -1274,8 +1274,8 @@ void DefaultTabDragController::CompleteDrag() { void DefaultTabDragController::ResetDelegates() { for (size_t i = 0; i < drag_data_.size(); ++i) { if (drag_data_[i].contents && - drag_data_[i].contents->tab_contents()->GetDelegate() == this) { - drag_data_[i].contents->tab_contents()->SetDelegate( + drag_data_[i].contents->web_contents()->GetDelegate() == this) { + drag_data_[i].contents->web_contents()->SetDelegate( drag_data_[i].original_delegate); } } @@ -1292,10 +1292,10 @@ void DefaultTabDragController::CreateDraggedView( // TabContents. NativeViewPhotobooth* photobooth = NativeViewPhotobooth::Create( - source_dragged_contents()->tab_contents()->GetNativeView()); + source_dragged_contents()->web_contents()->GetNativeView()); gfx::Rect content_bounds; - source_dragged_contents()->tab_contents()->GetContainerBounds( + source_dragged_contents()->web_contents()->GetContainerBounds( &content_bounds); std::vector<views::View*> renderers; diff --git a/chrome/browser/ui/webui/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals_ui_browsertest.cc index bf25c4c..1bed68a 100644 --- a/chrome/browser/ui/webui/net_internals_ui_browsertest.cc +++ b/chrome/browser/ui/webui/net_internals_ui_browsertest.cc @@ -19,7 +19,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui_message_handler.h" #include "content/test/test_browser_thread.h" #include "googleurl/src/gurl.h" @@ -259,7 +259,7 @@ void NetInternalsTest::MessageHandler::AddCacheEntry( void NetInternalsTest::MessageHandler::NavigateToPrerender( const ListValue* list_value) { - RenderViewHost* host = browser()->GetTabContentsAt(1)->GetRenderViewHost(); + RenderViewHost* host = browser()->GetWebContentsAt(1)->GetRenderViewHost(); host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("Click()")); } diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc index 810ce22..586154f 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc @@ -6,9 +6,10 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" using content::OpenURLParams; @@ -29,7 +30,7 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) { ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:")); bool empty_inner_html = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetTabContentsAt(0)->GetRenderViewHost(), L"", + browser()->GetWebContentsAt(0)->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.body.innerHTML == '')", &empty_inner_html)); ASSERT_FALSE(empty_inner_html); @@ -48,7 +49,7 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { ui_test_utils::NavigateToURLWithDisposition( browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - EXPECT_EQ(1, browser()->GetTabContentsAt(1)->GetMaxPageID()); + EXPECT_EQ(1, browser()->GetWebContentsAt(1)->GetMaxPageID()); // Navigate that tab to another site. This allows the NTP process to exit, // but it keeps the NTP SiteInstance (and its max_page_id) alive in history. @@ -69,25 +70,25 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { ui_test_utils::NavigateToURLWithDisposition( browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - EXPECT_EQ(1, browser()->GetTabContentsAt(2)->GetMaxPageID()); + EXPECT_EQ(1, browser()->GetWebContentsAt(2)->GetMaxPageID()); browser()->CloseTab(); // Open another Web UI page in a new tab. ui_test_utils::NavigateToURLWithDisposition( browser(), GURL(chrome::kChromeUISettingsURL), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - EXPECT_EQ(1, browser()->GetTabContentsAt(2)->GetMaxPageID()); + EXPECT_EQ(1, browser()->GetWebContentsAt(2)->GetMaxPageID()); // At this point, opening another NTP will use the old SiteInstance in the // existing Web UI process, but the page IDs shouldn't affect each other. ui_test_utils::NavigateToURLWithDisposition( browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - EXPECT_EQ(1, browser()->GetTabContentsAt(3)->GetMaxPageID()); + EXPECT_EQ(1, browser()->GetWebContentsAt(3)->GetMaxPageID()); // Only navigating to the NTP in the original tab should have a higher // page ID. browser()->ActivateTabAt(1, true); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); - EXPECT_EQ(2, browser()->GetTabContentsAt(1)->GetMaxPageID()); + EXPECT_EQ(2, browser()->GetWebContentsAt(1)->GetMaxPageID()); } diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 7deca62..f9339b2 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -44,13 +44,14 @@ #include "chrome/test/automation/javascript_execution_controller.h" #include "chrome/test/base/bookmark_load_observer.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/public/browser/download_item.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/test/test_navigation_observer.h" #include "googleurl/src/gurl.h" @@ -84,7 +85,7 @@ class DOMOperationObserver : public content::NotificationObserver, public: explicit DOMOperationObserver(RenderViewHost* render_view_host) : content::WebContentsObserver( - render_view_host->delegate()->GetAsTabContents()), + render_view_host->delegate()->GetAsWebContents()), did_respond_(false) { registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, content::Source<RenderViewHost>(render_view_host)); @@ -128,7 +129,7 @@ class FindInPageNotificationObserver : public content::NotificationObserver { current_find_request_id_ = parent_tab->find_tab_helper()->current_find_request_id(); registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, - content::Source<WebContents>(parent_tab_->tab_contents())); + content::Source<WebContents>(parent_tab_->web_contents())); ui_test_utils::RunMessageLoop(); } @@ -434,7 +435,7 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete( WebContents* web_contents = NULL; if (disposition == NEW_BACKGROUND_TAB) { // We've opened up a new tab, but not selected it. - web_contents = browser->GetTabContentsAt(browser->active_index() + 1); + web_contents = browser->GetWebContentsAt(browser->active_index() + 1); EXPECT_TRUE(web_contents != NULL) << " Unable to wait for navigation to \"" << url.spec() << "\" because the new tab is not available yet"; diff --git a/content/browser/child_process_security_policy_browsertest.cc b/content/browser/child_process_security_policy_browsertest.cc index 785d584..225535f 100644 --- a/content/browser/child_process_security_policy_browsertest.cc +++ b/content/browser/child_process_security_policy_browsertest.cc @@ -16,6 +16,8 @@ #include "content/public/common/result_codes.h" #include "testing/gtest/include/gtest/gtest.h" +using content::WebContents; + class ChildProcessSecurityPolicyInProcessBrowserTest : public InProcessBrowserTest { public: @@ -41,7 +43,7 @@ IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { EXPECT_EQ( ChildProcessSecurityPolicy::GetInstance()->security_state_.size(), 1U); - TabContents* tab = browser()->GetTabContentsAt(0); + WebContents* tab = browser()->GetWebContentsAt(0); ASSERT_TRUE(tab != NULL); base::KillProcess(tab->GetRenderProcessHost()->GetHandle(), content::RESULT_CODE_KILLED, true); diff --git a/content/browser/renderer_host/render_process_host_browsertest.cc b/content/browser/renderer_host/render_process_host_browsertest.cc index 9db2c2f..d69383c 100644 --- a/content/browser/renderer_host/render_process_host_browsertest.cc +++ b/content/browser/renderer_host/render_process_host_browsertest.cc @@ -158,8 +158,8 @@ IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessOverflow) { int tab_count = 1; int host_count = 1; - TabContents* tab1 = NULL; - TabContents* tab2 = NULL; + WebContents* tab1 = NULL; + WebContents* tab2 = NULL; content::RenderProcessHost* rph1 = NULL; content::RenderProcessHost* rph2 = NULL; content::RenderProcessHost* rph3 = NULL; @@ -172,7 +172,7 @@ IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessOverflow) { GURL newtab(chrome::kTestNewTabURL); ui_test_utils::NavigateToURL(browser(), newtab); EXPECT_EQ(tab_count, browser()->tab_count()); - tab1 = browser()->GetTabContentsAt(tab_count - 1); + tab1 = browser()->GetWebContentsAt(tab_count - 1); rph1 = tab1->GetRenderProcessHost(); EXPECT_EQ(tab1->GetURL(), newtab); EXPECT_EQ(host_count, RenderProcessHostCount()); @@ -185,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessOverflow) { tab_count++; host_count++; EXPECT_EQ(tab_count, browser()->tab_count()); - tab1 = browser()->GetTabContentsAt(tab_count - 1); + tab1 = browser()->GetWebContentsAt(tab_count - 1); rph2 = tab1->GetRenderProcessHost(); EXPECT_EQ(tab1->GetURL(), page1); EXPECT_EQ(host_count, RenderProcessHostCount()); @@ -198,7 +198,7 @@ IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessOverflow) { ui_test_utils::WaitForNewTab(browser()); tab_count++; EXPECT_EQ(tab_count, browser()->tab_count()); - tab2 = browser()->GetTabContentsAt(tab_count - 1); + tab2 = browser()->GetWebContentsAt(tab_count - 1); EXPECT_EQ(tab2->GetURL(), page2); EXPECT_EQ(host_count, RenderProcessHostCount()); EXPECT_EQ(tab2->GetRenderProcessHost(), rph2); @@ -213,7 +213,7 @@ IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessOverflow) { ui_test_utils::WaitForNewTab(browser()); tab_count++; EXPECT_EQ(tab_count, browser()->tab_count()); - tab2 = browser()->GetTabContentsAt(tab_count - 1); + tab2 = browser()->GetWebContentsAt(tab_count - 1); EXPECT_EQ(tab2->GetURL(), history); EXPECT_EQ(host_count, RenderProcessHostCount()); EXPECT_EQ(tab2->GetRenderProcessHost(), rph1); @@ -231,7 +231,7 @@ IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessOverflow) { host_count++; #endif EXPECT_EQ(tab_count, browser()->tab_count()); - tab1 = browser()->GetTabContentsAt(tab_count - 1); + tab1 = browser()->GetWebContentsAt(tab_count - 1); rph3 = tab1->GetRenderProcessHost(); EXPECT_EQ(tab1->GetURL(), bookmarks); EXPECT_EQ(host_count, RenderProcessHostCount()); |