diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 07:58:34 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 07:58:34 +0000 |
commit | 57c6a6579cf274fe37d6196931a3034d90da7113 (patch) | |
tree | ec42313580156ccc039b5fee714ee12259cb08ee /chrome/browser | |
parent | b23c9e1f05d474adc327c85d87eacc77554976e0 (diff) | |
download | chromium_src-57c6a6579cf274fe37d6196931a3034d90da7113.zip chromium_src-57c6a6579cf274fe37d6196931a3034d90da7113.tar.gz chromium_src-57c6a6579cf274fe37d6196931a3034d90da7113.tar.bz2 |
Replace all occurrances of WebContents with TabContents.
Review URL: http://codereview.chromium.org/99177
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
174 files changed, 1189 insertions, 1391 deletions
diff --git a/chrome/browser/alternate_nav_url_fetcher.cc b/chrome/browser/alternate_nav_url_fetcher.cc index 7e7f24e..b134e1b 100644 --- a/chrome/browser/alternate_nav_url_fetcher.cc +++ b/chrome/browser/alternate_nav_url_fetcher.cc @@ -6,7 +6,7 @@ #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/resource_bundle.h" diff --git a/chrome/browser/app_modal_dialog.cc b/chrome/browser/app_modal_dialog.cc index dac60e4..fb16ac8 100644 --- a/chrome/browser/app_modal_dialog.cc +++ b/chrome/browser/app_modal_dialog.cc @@ -5,12 +5,12 @@ #include "chrome/browser/app_modal_dialog.h" #include "chrome/browser/app_modal_dialog_queue.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" #include "chrome/common/ipc_message.h" -AppModalDialog::AppModalDialog(WebContents* web_contents, +AppModalDialog::AppModalDialog(TabContents* tab_contents, const std::wstring& title, int dialog_flags, const std::wstring& message_text, @@ -18,7 +18,7 @@ AppModalDialog::AppModalDialog(WebContents* web_contents, bool display_suppress_checkbox, bool is_before_unload_dialog, IPC::Message* reply_msg) - : web_contents_(web_contents), + : tab_contents_(tab_contents), title_(title), dialog_flags_(dialog_flags), message_text_(message_text), @@ -32,20 +32,20 @@ AppModalDialog::AppModalDialog(WebContents* web_contents, void AppModalDialog::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - if (!web_contents_) + if (!tab_contents_) return; if (type == NotificationType::NAV_ENTRY_COMMITTED && Source<NavigationController>(source).ptr() == - &web_contents_->controller()) - web_contents_ = NULL; + &tab_contents_->controller()) + tab_contents_ = NULL; if (type == NotificationType::TAB_CONTENTS_DESTROYED && Source<TabContents>(source).ptr() == - static_cast<TabContents*>(web_contents_)) - web_contents_ = NULL; + static_cast<TabContents*>(tab_contents_)) + tab_contents_ = NULL; - if (!web_contents_) + if (!tab_contents_) CloseModalDialog(); } @@ -59,15 +59,15 @@ void AppModalDialog::InitNotifications() { } void AppModalDialog::ShowModalDialog() { - // If the WebContents that created this dialog navigated away before this + // If the TabContents that created this dialog navigated away before this // dialog became visible, simply show the next dialog if any. - if (!web_contents_) { + if (!tab_contents_) { AppModalDialogQueue::ShowNextDialog(); delete this; return; } - web_contents_->Activate(); + tab_contents_->Activate(); CreateAndShowDialog(); } @@ -80,8 +80,8 @@ void AppModalDialog::OnCancel() { // is a temporary workaround. AppModalDialogQueue::ShowNextDialog(); - if (web_contents_) { - web_contents_->OnJavaScriptMessageBoxClosed(reply_msg_, false, + if (tab_contents_) { + tab_contents_->OnJavaScriptMessageBoxClosed(reply_msg_, false, std::wstring()); } } @@ -90,11 +90,11 @@ void AppModalDialog::OnAccept(const std::wstring& prompt_text, bool suppress_js_messages) { AppModalDialogQueue::ShowNextDialog(); - if (web_contents_) { - web_contents_->OnJavaScriptMessageBoxClosed(reply_msg_, true, + if (tab_contents_) { + tab_contents_->OnJavaScriptMessageBoxClosed(reply_msg_, true, prompt_text); if (suppress_js_messages) - web_contents()->set_suppress_javascript_messages(true); + tab_contents()->set_suppress_javascript_messages(true); } } diff --git a/chrome/browser/app_modal_dialog.h b/chrome/browser/app_modal_dialog.h index 3fa7384..c7e2dc9 100644 --- a/chrome/browser/app_modal_dialog.h +++ b/chrome/browser/app_modal_dialog.h @@ -21,7 +21,7 @@ typedef GtkWidget* NativeDialog; typedef void* NativeDialog; #endif -class WebContents; +class TabContents; namespace IPC { class Message; } @@ -33,7 +33,7 @@ class AppModalDialog : public NotificationObserver { public: // A union of data necessary to determine the type of message box to // show. |dialog_flags| is a MessageBox flag. - AppModalDialog(WebContents* web_contents, + AppModalDialog(TabContents* tab_contents, const std::wstring& title, int dialog_flags, const std::wstring& message_text, @@ -63,8 +63,8 @@ class AppModalDialog : public NotificationObserver { ///////////////////////////////////////////////////////////////////////////// // Getters so NativeDialog can get information about the message box. - WebContents* web_contents() { - return web_contents_; + TabContents* tab_contents() { + return tab_contents_; } int dialog_flags() { return dialog_flags_; @@ -100,7 +100,7 @@ class AppModalDialog : public NotificationObserver { NativeDialog dialog_; // Information about the message box is held in the following variables. - WebContents* web_contents_; + TabContents* tab_contents_; std::wstring title_; int dialog_flags_; std::wstring message_text_; diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 25131e5..79e384e 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -25,7 +25,7 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/ssl/ssl_manager.h" #include "chrome/browser/ssl/ssl_blocking_page.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/message_box_flags.h" @@ -761,7 +761,7 @@ class DocumentPrintedNotificationObserver : public NotificationObserver { class AutomationInterstitialPage : public InterstitialPage { public: - AutomationInterstitialPage(WebContents* tab, + AutomationInterstitialPage(TabContents* tab, const GURL& url, const std::string& contents) : InterstitialPage(tab, true, url), @@ -1886,12 +1886,10 @@ void AutomationProvider::GetTabProcessID(int handle, int* process_id) { if (tab_tracker_->ContainsHandle(handle)) { *process_id = 0; - NavigationController* tab = tab_tracker_->GetResource(handle); - if (tab->tab_contents()->AsWebContents()) { - WebContents* web_contents = tab->tab_contents()->AsWebContents(); - if (web_contents->process()) - *process_id = web_contents->process()->process().pid(); - } + TabContents* tab_contents = + tab_tracker_->GetResource(handle)->tab_contents(); + if (tab_contents->process()) + *process_id = tab_contents->process()->process().pid(); } } @@ -1905,8 +1903,8 @@ void AutomationProvider::ExecuteJavascript(int handle, const std::wstring& script, IPC::Message* reply_message) { bool succeeded = false; - WebContents* web_contents = GetWebContentsForHandle(handle, NULL); - if (web_contents) { + TabContents* tab_contents = GetTabContentsForHandle(handle, NULL); + if (tab_contents) { // Set the routing id of this message with the controller. // This routing id needs to be remembered for the reverse // communication while sending back the response of @@ -1919,9 +1917,9 @@ void AutomationProvider::ExecuteJavascript(int handle, DCHECK(reply_message_ == NULL); reply_message_ = reply_message; - web_contents->render_view_host()->ExecuteJavascriptInWebFrame( + tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( frame_xpath, set_automation_id); - web_contents->render_view_host()->ExecuteJavascriptInWebFrame( + tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( frame_xpath, script); succeeded = true; } @@ -1935,9 +1933,9 @@ void AutomationProvider::ExecuteJavascript(int handle, void AutomationProvider::GetShelfVisibility(int handle, bool* visible) { *visible = false; - WebContents* web_contents = GetWebContentsForHandle(handle, NULL); - if (web_contents) - *visible = web_contents->IsDownloadShelfVisible(); + TabContents* tab_contents = GetTabContentsForHandle(handle, NULL); + if (tab_contents) + *visible = tab_contents->IsDownloadShelfVisible(); } void AutomationProvider::GetConstrainedWindowCount(int handle, int* count) { @@ -2030,15 +2028,12 @@ void AutomationProvider::HandleFindRequest( reply_message->routing_id(), reply_message)); - WebContents* web_contents = tab_contents->AsWebContents(); - if (web_contents) { - web_contents->set_current_find_request_id( - FindInPageNotificationObserver::kFindInPageRequestId); - web_contents->render_view_host()->StartFinding( - FindInPageNotificationObserver::kFindInPageRequestId, - params.search_string, params.forward, params.match_case, - params.find_next); - } + tab_contents->set_current_find_request_id( + FindInPageNotificationObserver::kFindInPageRequestId); + tab_contents->render_view_host()->StartFinding( + FindInPageNotificationObserver::kFindInPageRequestId, + params.search_string, params.forward, params.match_case, + params.find_next); } void AutomationProvider::HandleOpenFindInPageRequest( @@ -2106,12 +2101,12 @@ void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible, void AutomationProvider::HandleInspectElementRequest( int handle, int x, int y, IPC::Message* reply_message) { - WebContents* web_contents = GetWebContentsForHandle(handle, NULL); - if (web_contents) { + TabContents* tab_contents = GetTabContentsForHandle(handle, NULL); + if (tab_contents) { DCHECK(reply_message_ == NULL); reply_message_ = reply_message; - web_contents->render_view_host()->InspectElementAt(x, y); + tab_contents->render_view_host()->InspectElementAt(x, y); inspect_element_routing_id_ = reply_message->routing_id(); } else { AutomationMsg_InspectElement::WriteReplyParams(reply_message, -1); @@ -2253,9 +2248,8 @@ void AutomationProvider::ShowInterstitialPage(int tab_handle, AddNavigationStatusListener<bool>(controller, reply_message, true, false, false); - WebContents* web_contents = tab_contents->AsWebContents(); AutomationInterstitialPage* interstitial = - new AutomationInterstitialPage(web_contents, + new AutomationInterstitialPage(tab_contents, GURL("about:interstitial"), html_text); interstitial->Show(); @@ -2269,9 +2263,9 @@ void AutomationProvider::ShowInterstitialPage(int tab_handle, void AutomationProvider::HideInterstitialPage(int tab_handle, bool* success) { *success = false; - WebContents* web_contents = GetWebContentsForHandle(tab_handle, NULL); - if (web_contents && web_contents->interstitial_page()) { - web_contents->interstitial_page()->DontProceed(); + TabContents* tab_contents = GetTabContentsForHandle(tab_handle, NULL); + if (tab_contents && tab_contents->interstitial_page()) { + tab_contents->interstitial_page()->DontProceed(); *success = true; } } @@ -2431,10 +2425,9 @@ void AutomationProvider::GetPageType(int handle, bool* success, *page_type = entry->page_type(); *success = true; // In order to return the proper result when an interstitial is shown and - // no navigation entry were created for it we need to ask the WebContents. + // no navigation entry were created for it we need to ask the TabContents. if (*page_type == NavigationEntry::NORMAL_PAGE && - tab->tab_contents()->AsWebContents() && - tab->tab_contents()->AsWebContents()->showing_interstitial_page()) + tab->tab_contents()->showing_interstitial_page()) *page_type = NavigationEntry::INTERSTITIAL_PAGE; } else { *success = false; @@ -2450,7 +2443,7 @@ void AutomationProvider::ActionOnSSLBlockingPage(int handle, bool proceed, if (entry->page_type() == NavigationEntry::INTERSTITIAL_PAGE) { TabContents* tab_contents = tab->tab_contents(); InterstitialPage* ssl_blocking_page = - InterstitialPage::GetInterstitialPage(tab_contents->AsWebContents()); + InterstitialPage::GetInterstitialPage(tab_contents); if (ssl_blocking_page) { if (proceed) { AddNavigationStatusListener<bool>(tab, reply_message, true, true, @@ -2501,14 +2494,14 @@ void AutomationProvider::IsPageMenuCommandEnabled(int browser_handle, void AutomationProvider::PrintNow(int tab_handle, IPC::Message* reply_message) { NavigationController* tab = NULL; - WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab); - if (web_contents) { + TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); + if (tab_contents) { FindAndActivateTab(tab); notification_observer_list_.AddObserver( new DocumentPrintedNotificationObserver(this, reply_message->routing_id(), reply_message)); - if (web_contents->PrintNow()) + if (tab_contents->PrintNow()) return; } AutomationMsg_PrintNow::WriteReplyParams(reply_message, false); @@ -2538,8 +2531,7 @@ void AutomationProvider::SavePage(int tab_handle, static_cast<SavePackage::SavePackageType>(type); DCHECK(save_type >= SavePackage::SAVE_AS_ONLY_HTML && save_type <= SavePackage::SAVE_AS_COMPLETE_HTML); - nav->tab_contents()->AsWebContents()->SavePage( - file_name, dir_path, save_type); + nav->tab_contents()->SavePage(file_name, dir_path, save_type); *success = true; } @@ -2612,13 +2604,7 @@ void AutomationProvider::OnMessageFromExternalHost(int handle, return; } - WebContents* web_contents = tab_contents->AsWebContents(); - if (!web_contents) { - NOTREACHED(); - return; - } - - RenderViewHost* view_host = web_contents->render_view_host(); + RenderViewHost* view_host = tab_contents->render_view_host(); if (!view_host) { return; } @@ -2628,19 +2614,16 @@ void AutomationProvider::OnMessageFromExternalHost(int handle, } #endif // defined(OS_WIN) -WebContents* AutomationProvider::GetWebContentsForHandle( +TabContents* AutomationProvider::GetTabContentsForHandle( int handle, NavigationController** tab) { - WebContents* web_contents = NULL; if (tab_tracker_->ContainsHandle(handle)) { NavigationController* nav_controller = tab_tracker_->GetResource(handle); TabContents* tab_contents = nav_controller->tab_contents(); - if (tab_contents) { - web_contents = tab_contents->AsWebContents(); - if (tab) - *tab = nav_controller; - } + if (tab) + *tab = nav_controller; + return nav_controller->tab_contents(); } - return web_contents; + return NULL; } #if defined(OS_WIN) @@ -2831,10 +2814,8 @@ void AutomationProvider::GetPageCurrentEncoding( Browser* browser = FindAndActivateTab(nav); DCHECK(browser); - if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) { - TabContents* tab_contents = nav->tab_contents(); - *current_encoding = tab_contents->AsWebContents()->encoding(); - } + if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) + *current_encoding = nav->tab_contents()->encoding(); } } diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 8d62914..2849cd1 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -430,10 +430,10 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, void GetWindowTitle(int handle, string16* text); - // Convert a tab handle into a WebContents. If |tab| is non-NULL a pointer + // Convert a tab handle into a TabContents. If |tab| is non-NULL a pointer // to the tab is also returned. Returns NULL in case of failure or if the tab - // is not of the WebContents type. - WebContents* GetWebContentsForHandle(int handle, NavigationController** tab); + // is not of the TabContents type. + TabContents* GetTabContentsForHandle(int handle, NavigationController** tab); ExternalTabContainer* GetExternalTabForHandle(int handle); diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index c5762fe..6d4e3a6 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -31,7 +31,7 @@ #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/site_instance.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" @@ -157,10 +157,9 @@ namespace { // Returns true if the specified TabContents has unload listeners registered. bool TabHasUnloadListener(TabContents* contents) { - WebContents* web_contents = contents->AsWebContents(); - return web_contents && web_contents->notify_disconnection() && - !web_contents->showing_interstitial_page() && - !web_contents->render_view_host()->SuddenTerminationAllowed(); + return contents->notify_disconnection() && + !contents->showing_interstitial_page() && + !contents->render_view_host()->SuddenTerminationAllowed(); } } // namespace @@ -323,7 +322,7 @@ void Browser::OpenApplicationWindow(Profile* profile, const GURL& url) { browser->window()->Show(); // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial // focus explicitly. - browser->GetSelectedTabContents()->AsWebContents()->view()->SetInitialFocus(); + browser->GetSelectedTabContents()->view()->SetInitialFocus(); } /////////////////////////////////////////////////////////////////////////////// @@ -573,7 +572,7 @@ TabContents* Browser::AddRestoredTab( int tab_index, int selected_navigation, bool select) { - TabContents* new_tab = new WebContents(profile(), NULL, + TabContents* new_tab = new TabContents(profile(), NULL, MSG_ROUTING_NONE, NULL); new_tab->controller().RestoreFromState(navigations, selected_navigation); @@ -591,7 +590,7 @@ TabContents* Browser::AddRestoredTab( void Browser::ReplaceRestoredTab( const std::vector<TabNavigation>& navigations, int selected_navigation) { - TabContents* replacement = new WebContents(profile(), NULL, + TabContents* replacement = new TabContents(profile(), NULL, MSG_ROUTING_NONE, NULL); replacement->controller().RestoreFromState(navigations, selected_navigation); @@ -627,13 +626,12 @@ void Browser::GoBack(WindowOpenDisposition disposition) { // If we are showing an interstitial, just hide it. TabContents* current_tab = GetSelectedTabContents(); - WebContents* web_contents = current_tab->AsWebContents(); - if (web_contents && web_contents->interstitial_page()) { + if (current_tab->interstitial_page()) { // The GoBack() case is a special case when an interstitial is shown because // the "previous" page is still available, just hidden by the interstitial. // We treat the back as a "Don't proceed", this hides the interstitial and // reveals the previous page. - web_contents->interstitial_page()->DontProceed(); + current_tab->interstitial_page()->DontProceed(); return; } @@ -680,17 +678,14 @@ void Browser::Reload() { // If we are showing an interstitial, treat this as an OpenURL. TabContents* current_tab = GetSelectedTabContents(); if (current_tab) { - WebContents* web_contents = current_tab->AsWebContents(); - if (web_contents && web_contents->showing_interstitial_page()) { + if (current_tab->showing_interstitial_page()) { NavigationEntry* entry = current_tab->controller().GetActiveEntry(); DCHECK(entry); // Should exist if interstitial is showing. OpenURL(entry->url(), GURL(), CURRENT_TAB, PageTransition::RELOAD); return; } - } - if (current_tab) { - // As this is caused by a user action, give the focus to the page. + // As this is caused by a user action, give the focus to the page. current_tab->Focus(); current_tab->controller().Reload(true); } @@ -755,7 +750,7 @@ void Browser::NewTab() { // The call to AddBlankTab above did not set the focus to the tab as its // window was not active, so we have to do it explicitly. // See http://crbug.com/6380. - b->GetSelectedTabContents()->AsWebContents()->view()->RestoreFocus(); + b->GetSelectedTabContents()->view()->RestoreFocus(); } } @@ -846,7 +841,7 @@ void Browser::BookmarkCurrentPage() { void Browser::SavePage() { UserMetrics::RecordAction(L"SavePage", profile_); - GetSelectedTabContents()->AsWebContents()->OnSavePage(); + GetSelectedTabContents()->OnSavePage(); } void Browser::ViewSource() { @@ -888,7 +883,7 @@ void Browser::ClosePopups() { void Browser::Print() { UserMetrics::RecordAction(L"PrintPreview", profile_); - GetSelectedTabContents()->AsWebContents()->PrintPreview(); + GetSelectedTabContents()->PrintPreview(); } #endif // #if defined(OS_WIN) @@ -903,9 +898,9 @@ void Browser::OverrideEncoding(int encoding_id) { UserMetrics::RecordAction(L"OverrideEncoding", profile_); const std::wstring selected_encoding = CharacterEncoding::GetCanonicalEncodingNameByCommandId(encoding_id); - WebContents* current_web_contents = GetSelectedTabContents()->AsWebContents(); - if (!selected_encoding.empty() && current_web_contents) - current_web_contents->override_encoding(selected_encoding); + TabContents* contents = GetSelectedTabContents(); + if (!selected_encoding.empty() && contents) + contents->override_encoding(selected_encoding); // Update the list of recently selected encodings. std::wstring new_selected_encoding_list; if (CharacterEncoding::UpdateRecentlySelectdEncoding( @@ -983,20 +978,17 @@ void Browser::FindPrevious() { void Browser::ZoomIn() { UserMetrics::RecordAction(L"ZoomPlus", profile_); - GetSelectedTabContents()->AsWebContents()->render_view_host()->Zoom( - PageZoom::LARGER); + GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::LARGER); } void Browser::ZoomReset() { UserMetrics::RecordAction(L"ZoomNormal", profile_); - GetSelectedTabContents()->AsWebContents()->render_view_host()->Zoom( - PageZoom::STANDARD); + GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::STANDARD); } void Browser::ZoomOut() { UserMetrics::RecordAction(L"ZoomMinus", profile_); - GetSelectedTabContents()->AsWebContents()->render_view_host()->Zoom( - PageZoom::SMALLER); + GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::SMALLER); } #if defined(OS_WIN) @@ -1033,35 +1025,31 @@ void Browser::OpenFile() { #if defined(OS_WIN) void Browser::OpenCreateShortcutsDialog() { UserMetrics::RecordAction(L"CreateShortcut", profile_); - GetSelectedTabContents()->AsWebContents()->CreateShortcut(); + GetSelectedTabContents()->CreateShortcut(); } void Browser::OpenDebuggerWindow() { #ifndef CHROME_DEBUGGER_DISABLED UserMetrics::RecordAction(L"Debugger", profile_); TabContents* current_tab = GetSelectedTabContents(); - WebContents* wc = current_tab->AsWebContents(); - if (wc) { - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableOutOfProcessDevTools)) { - DevToolsManager* manager = g_browser_process->devtools_manager(); - manager->OpenDevToolsWindow(wc); - } else { - // Only one debugger instance can exist at a time right now. - // TODO(erikkay): need an alert, dialog, something - // or better yet, fix the one instance limitation - if (!DebuggerWindow::DoesDebuggerExist()) - debugger_window_ = new DebuggerWindow(); - debugger_window_->Show(current_tab); - } + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableOutOfProcessDevTools)) { + DevToolsManager* manager = g_browser_process->devtools_manager(); + manager->OpenDevToolsWindow(current_tab); + } else { + // Only one debugger instance can exist at a time right now. + // TODO(erikkay): need an alert, dialog, something + // or better yet, fix the one instance limitation + if (!DebuggerWindow::DoesDebuggerExist()) + debugger_window_ = new DebuggerWindow(); + debugger_window_->Show(current_tab); } #endif } void Browser::OpenJavaScriptConsole() { UserMetrics::RecordAction(L"ShowJSConsole", profile_); - GetSelectedTabContents()->AsWebContents()->render_view_host()-> - ShowJavaScriptConsole(); + GetSelectedTabContents()->render_view_host()->ShowJavaScriptConsole(); } void Browser::OpenTaskManager() { @@ -1416,7 +1404,7 @@ TabContents* Browser::CreateTabContentsForURL( const GURL& url, const GURL& referrer, Profile* profile, PageTransition::Type transition, bool defer_load, SiteInstance* instance) const { - WebContents* contents = new WebContents(profile, instance, + TabContents* contents = new TabContents(profile, instance, MSG_ROUTING_NONE, NULL); if (!defer_load) { @@ -1508,20 +1496,17 @@ void Browser::CreateHistoricalTab(TabContents* contents) { } bool Browser::RunUnloadListenerBeforeClosing(TabContents* contents) { - WebContents* web_contents = contents->AsWebContents(); - if (web_contents) { - // If the WebContents is not connected yet, then there's no unload - // handler we can fire even if the WebContents has an unload listener. - // One case where we hit this is in a tab that has an infinite loop - // before load. - if (TabHasUnloadListener(contents)) { - // If the page has unload listeners, then we tell the renderer to fire - // them. Once they have fired, we'll get a message back saying whether - // to proceed closing the page or not, which sends us back to this method - // with the HasUnloadListener bit cleared. - web_contents->render_view_host()->FirePageBeforeUnload(); - return true; - } + // If the TabContents is not connected yet, then there's no unload + // handler we can fire even if the TabContents has an unload listener. + // One case where we hit this is in a tab that has an infinite loop + // before load. + if (TabHasUnloadListener(contents)) { + // If the page has unload listeners, then we tell the renderer to fire + // them. Once they have fired, we'll get a message back saying whether + // to proceed closing the page or not, which sends us back to this method + // with the HasUnloadListener bit cleared. + contents->render_view_host()->FirePageBeforeUnload(); + return true; } return false; } @@ -1555,7 +1540,7 @@ void Browser::TabInsertedAt(TabContents* contents, // able to ack. But we know we can close it. NotificationService::current()->AddObserver( this, - NotificationType::WEB_CONTENTS_DISCONNECTED, + NotificationType::TAB_CONTENTS_DISCONNECTED, Source<TabContents>(contents)); } @@ -1577,11 +1562,11 @@ void Browser::TabDetachedAt(TabContents* contents, int index) { RemoveScheduledUpdatesFor(contents); if (find_bar_controller_.get() && index == tabstrip_model_.selected_index()) - find_bar_controller_->ChangeWebContents(NULL); + find_bar_controller_->ChangeTabContents(NULL); NotificationService::current()->RemoveObserver( this, - NotificationType::WEB_CONTENTS_DISCONNECTED, + NotificationType::TAB_CONTENTS_DISCONNECTED, Source<TabContents>(contents)); } @@ -1624,7 +1609,7 @@ void Browser::TabSelectedAt(TabContents* old_contents, } if (find_bar_controller_.get()) { - find_bar_controller_->ChangeWebContents(new_contents->AsWebContents()); + find_bar_controller_->ChangeTabContents(new_contents); find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true); } @@ -1696,12 +1681,9 @@ void Browser::OpenURLFromTab(TabContents* source, // Don't use this logic when "--process-per-tab" is specified. if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerTab)) { if (current_tab) { - const WebContents* const web_contents = current_tab->AsWebContents(); - if (web_contents) { - const GURL& current_url = web_contents->GetURL(); - if (SiteInstance::IsSameWebSite(current_url, url)) - instance = web_contents->GetSiteInstance(); - } + const GURL& current_url = current_tab->GetURL(); + if (SiteInstance::IsSameWebSite(current_url, url)) + instance = current_tab->GetSiteInstance(); } } @@ -2017,7 +1999,7 @@ void Browser::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { switch (type.value) { - case NotificationType::WEB_CONTENTS_DISCONNECTED: + case NotificationType::TAB_CONTENTS_DISCONNECTED: if (is_attempting_to_close_browser_) { // Need to do this asynchronously as it will close the tab, which is // currently on the call stack above us. @@ -2186,52 +2168,38 @@ void Browser::UpdateCommandsForTabState() { command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, CanDuplicateContentsAt(selected_index())); - // Initialize commands available only for web content. - { - WebContents* web_contents = current_tab->AsWebContents(); - bool is_web_contents = web_contents != NULL; + // Current navigation entry, may be NULL. + NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); bool is_source_viewable = - is_web_contents && net::IsSupportedNonImageMimeType( - web_contents->contents_mime_type().c_str()); - - // Current navigation entry, may be NULL. - NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); + current_tab->contents_mime_type().c_str()); - // Page-related commands - // Only allow bookmarking for web content in normal windows. - command_updater_.UpdateCommandEnabled(IDC_STAR, - is_web_contents && (type() == TYPE_NORMAL)); - window_->SetStarredState(is_web_contents && web_contents->is_starred()); - // View-source should not be enabled if already in view-source mode or - // the source is not viewable. - command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, - is_web_contents && active_entry && !active_entry->IsViewSourceMode() && - is_source_viewable); - command_updater_.UpdateCommandEnabled(IDC_PRINT, is_web_contents); - command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, - is_web_contents && SavePackage::IsSavableURL(current_tab->GetURL())); - command_updater_.UpdateCommandEnabled(IDC_ENCODING_MENU, - is_web_contents && - SavePackage::IsSavableContents(web_contents->contents_mime_type()) && - SavePackage::IsSavableURL(current_tab->GetURL())); - - // Find-in-page - command_updater_.UpdateCommandEnabled(IDC_FIND, is_web_contents); - command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, is_web_contents); - command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, is_web_contents); - - // Zoom - command_updater_.UpdateCommandEnabled(IDC_ZOOM_MENU, is_web_contents); - command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, is_web_contents); - command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, is_web_contents); - command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, is_web_contents); + // Page-related commands + // Only allow bookmarking for web content in normal windows. + command_updater_.UpdateCommandEnabled(IDC_STAR, (type() == TYPE_NORMAL)); + window_->SetStarredState(current_tab->is_starred()); + // View-source should not be enabled if already in view-source mode or + // the source is not viewable. + command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, + active_entry && !active_entry->IsViewSourceMode() && + is_source_viewable); + command_updater_.UpdateCommandEnabled(IDC_PRINT, true); + command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, + SavePackage::IsSavableURL(current_tab->GetURL())); + command_updater_.UpdateCommandEnabled(IDC_ENCODING_MENU, + SavePackage::IsSavableContents(current_tab->contents_mime_type()) && + SavePackage::IsSavableURL(current_tab->GetURL())); + + // Zoom + command_updater_.UpdateCommandEnabled(IDC_ZOOM_MENU, true); + command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, true); + command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, true); + command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true); - // Show various bits of UI - command_updater_.UpdateCommandEnabled(IDC_JS_CONSOLE, is_web_contents); - command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, - is_web_contents && !current_tab->GetFavIcon().isNull()); - } + // Show various bits of UI + command_updater_.UpdateCommandEnabled(IDC_JS_CONSOLE, true); + command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, + !current_tab->GetFavIcon().isNull()); } void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) { @@ -2446,7 +2414,7 @@ TabContents* Browser::BuildRestoredTab( selected_navigation < static_cast<int>(navigations.size())); // Create a NavigationController. This constructor creates the appropriate // set of TabContents. - TabContents* new_tab = new WebContents(profile_, NULL, + TabContents* new_tab = new TabContents(profile_, NULL, MSG_ROUTING_NONE, NULL); new_tab->controller().RestoreFromState(navigations, selected_navigation); return new_tab; @@ -2474,7 +2442,7 @@ void Browser::ProcessPendingTabs() { // unload tabs. if (!tabs_needing_before_unload_fired_.empty()) { TabContents* tab = *(tabs_needing_before_unload_fired_.begin()); - tab->AsWebContents()->render_view_host()->FirePageBeforeUnload(); + tab->render_view_host()->FirePageBeforeUnload(); } else if (!tabs_needing_unload_fired_.empty()) { // We've finished firing all beforeunload events and can proceed with unload // events. @@ -2485,7 +2453,7 @@ void Browser::ProcessPendingTabs() { // get a perf benefit from that in the cases where the tab hangs in it's // unload handler or takes a long time to page in. TabContents* tab = *(tabs_needing_unload_fired_.begin()); - tab->AsWebContents()->render_view_host()->FirePageUnload(); + tab->render_view_host()->FirePageUnload(); } else { NOTREACHED(); } @@ -2505,7 +2473,6 @@ void Browser::CancelWindowClose() { tabs_needing_before_unload_fired_.clear(); tabs_needing_unload_fired_.clear(); - is_attempting_to_close_browser_ = false; } @@ -2623,9 +2590,8 @@ GURL Browser::GetHomePage() const { void Browser::FindInPage(bool find_next, bool forward_direction) { ShowFindBar(); if (find_next) { - GetSelectedTabContents()->AsWebContents()->StartFinding( - string16(), - forward_direction); + GetSelectedTabContents()->StartFinding(string16(), + forward_direction); } } diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 2afce4c..4685780 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -2370,14 +2370,6 @@ > </File> <File - RelativePath=".\tab_contents\web_contents.cc" - > - </File> - <File - RelativePath=".\tab_contents\web_contents.h" - > - </File> - <File RelativePath=".\tab_contents\web_drag_source.cc" > </File> diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc index 4a6735c..768edd5 100644 --- a/chrome/browser/browser_commands_unittest.cc +++ b/chrome/browser/browser_commands_unittest.cc @@ -87,7 +87,7 @@ TEST_F(BrowserCommandsTest, BookmarkCurrentPage) { AddTab(browser(), url1); browser()->OpenURL(url1, GURL(), CURRENT_TAB, PageTransition::TYPED); - // TODO(beng): remove this once we can use WebContentses directly in testing + // TODO(beng): remove this once we can use TabContentses directly in testing // instead of the TestTabContents which causes this command not to // be enabled when the tab is added (and selected). browser()->command_updater()->UpdateCommandEnabled(IDC_STAR, true); diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index c9f8052..4738ea25 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -6,7 +6,6 @@ #include "base/ref_counted.h" #include "chrome/browser/automation/ui_controls.h" #include "chrome/browser/browser.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/browser/view_ids.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/location_bar_view.h" @@ -266,7 +265,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusTraversal) { // Let's make sure the focus is on the expected element in the page. std::string actual; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->AsWebContents(), + browser()->GetSelectedTabContents(), L"", L"window.domAutomationController.send(getFocusedElement());", &actual)); @@ -303,7 +302,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusTraversal) { // Let's make sure the focus is on the expected element in the page. std::string actual; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->AsWebContents(), + browser()->GetSelectedTabContents(), L"", L"window.domAutomationController.send(getFocusedElement());", &actual)); diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index d0a8d14..8adb962 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -28,7 +28,7 @@ #include "chrome/browser/shell_integration.h" #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/tab_contents/navigation_controller.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/common/chrome_constants.h" @@ -446,10 +446,7 @@ Browser* BrowserInit::LaunchWithProfile::OpenURLsInBrowser( browser->window()->Show(); // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial // focus explicitly. - if (browser->GetSelectedTabContents()->AsWebContents()) { - browser->GetSelectedTabContents()->AsWebContents()->view()-> - SetInitialFocus(); - } + browser->GetSelectedTabContents()->view()->SetInitialFocus(); return browser; } diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc index c1676c0..3b6ee8b 100644 --- a/chrome/browser/browser_list.cc +++ b/chrome/browser/browser_list.cc @@ -18,7 +18,7 @@ #if defined(OS_WIN) // TODO(port): these can probably all go away, even on win #include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #endif @@ -289,20 +289,20 @@ void BrowserList::RemoveBrowserFrom(Browser* browser, list_type* browser_list) { browser_list->erase(remove_browser); } -WebContentsIterator::WebContentsIterator() +TabContentsIterator::TabContentsIterator() : browser_iterator_(BrowserList::begin()), web_view_index_(-1), cur_(NULL) { Advance(); } -void WebContentsIterator::Advance() { +void TabContentsIterator::Advance() { // Unless we're at the beginning (index = -1) or end (iterator = end()), - // then the current WebContents should be valid. + // then the current TabContents should be valid. DCHECK(web_view_index_ || browser_iterator_ == BrowserList::end() || cur_) << "Trying to advance past the end"; - // Update cur_ to the next WebContents in the list. + // Update cur_ to the next TabContents in the list. for (;;) { web_view_index_++; @@ -316,8 +316,8 @@ void WebContentsIterator::Advance() { } } - WebContents* next_tab = - (*browser_iterator_)->GetTabContentsAt(web_view_index_)->AsWebContents(); + TabContents* next_tab = + (*browser_iterator_)->GetTabContentsAt(web_view_index_); if (next_tab) { cur_ = next_tab; return; diff --git a/chrome/browser/browser_list.h b/chrome/browser/browser_list.h index faa2f64..c73ac2e 100644 --- a/chrome/browser/browser_list.h +++ b/chrome/browser/browser_list.h @@ -124,7 +124,7 @@ class BrowserList { static list_type last_active_browsers_; }; -class WebContents; +class TabContents; // Iterates through all web view hosts in all browser windows. Because the // renderers act asynchronously, getting a host through this interface does @@ -132,36 +132,36 @@ class WebContents; // browser windows or tabs while iterating may cause incorrect behavior. // // Example: -// for (WebContentsIterator iterator; !iterator.done(); iterator++) { -// WebContents* cur = *iterator; +// for (TabContentsIterator iterator; !iterator.done(); iterator++) { +// TabContents* cur = *iterator; // -or- -// iterator->operationOnWebContents(); +// iterator->operationOnTabContents(); // ... // } -class WebContentsIterator { +class TabContentsIterator { public: - WebContentsIterator(); + TabContentsIterator(); // Returns true if we are past the last Browser. bool done() const { return cur_ == NULL; } - // Returns the current WebContents, valid as long as !Done() - WebContents* operator->() const { + // Returns the current TabContents, valid as long as !Done() + TabContents* operator->() const { return cur_; } - WebContents* operator*() const { + TabContents* operator*() const { return cur_; } // Incrementing operators, valid as long as !Done() - WebContents* operator++() { // ++preincrement + TabContents* operator++() { // ++preincrement Advance(); return cur_; } - WebContents* operator++(int) { // postincrement++ - WebContents* tmp = cur_; + TabContents* operator++(int) { // postincrement++ + TabContents* tmp = cur_; Advance(); return tmp; } @@ -178,10 +178,10 @@ class WebContentsIterator { // tab index into the current Browser of the current web view int web_view_index_; - // Current WebContents, or NULL if we're at the end of the list. This can + // Current TabContents, or NULL if we're at the end of the list. This can // be extracted given the browser iterator and index, but it's nice to cache // this since the caller may access the current host many times. - WebContents* cur_; + TabContents* cur_; }; #endif // CHROME_BROWSER_BROWSER_LIST_H__ diff --git a/chrome/browser/browser_prefs.cc b/chrome/browser/browser_prefs.cc index 661ab6b..fce04ae 100644 --- a/chrome/browser/browser_prefs.cc +++ b/chrome/browser/browser_prefs.cc @@ -21,7 +21,7 @@ #include "chrome/browser/search_engines/template_url_prepopulate_data.h" #include "chrome/browser/session_startup_pref.h" #include "chrome/browser/ssl/ssl_manager.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #if defined(OS_WIN) // TODO(port): whittle this down as we port #include "chrome/browser/task_manager.h" diff --git a/chrome/browser/cert_store.cc b/chrome/browser/cert_store.cc index 84e6ab6..55fdc5a 100644 --- a/chrome/browser/cert_store.cc +++ b/chrome/browser/cert_store.cc @@ -9,7 +9,7 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" #include "chrome/common/stl_util-inl.h" diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index 6df869f..c2cf3e0 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -7,7 +7,7 @@ #include "chrome/app/chrome_dll_resource.h" // IDC_* #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/browser/tabs/tab_strip_model.h" #import "chrome/browser/cocoa/bookmark_bar_controller.h" @@ -448,9 +448,8 @@ willPositionSheet:(NSWindow *)sheet // We do not store the focus when closing the tab to work-around bug 4633. // Some reports seem to show that the focus manager and/or focused view can // be garbage at that point, it is not clear why. - if (oldContents && !oldContents->is_being_destroyed() && - oldContents->AsWebContents()) - oldContents->AsWebContents()->view()->StoreFocus(); + if (oldContents && !oldContents->is_being_destroyed()) + oldContents->view()->StoreFocus(); // Update various elements that are interested in knowing the current // TabContents. @@ -469,10 +468,8 @@ willPositionSheet:(NSWindow *)sheet filename:NO]; if (BrowserList::GetLastActive() == browser_ && - !browser_->tabstrip_model()->closing_all() && - newContents->AsWebContents()) { - newContents->AsWebContents()->view()->RestoreFocus(); - } + !browser_->tabstrip_model()->closing_all()) + newContents->view()->RestoreFocus(); #if 0 // TODO(pinkerton):Update as more things become window-specific diff --git a/chrome/browser/cocoa/find_bar_cocoa_controller.mm b/chrome/browser/cocoa/find_bar_cocoa_controller.mm index a4229fc..bdd0937 100644 --- a/chrome/browser/cocoa/find_bar_cocoa_controller.mm +++ b/chrome/browser/cocoa/find_bar_cocoa_controller.mm @@ -12,7 +12,7 @@ #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" #import "chrome/browser/cocoa/find_bar_bridge.h" #import "chrome/browser/cocoa/tab_strip_controller.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" @implementation FindBarCocoaController @@ -40,14 +40,14 @@ - (IBAction)previousResult:(id)sender { if (findBarBridge_) - findBarBridge_->GetFindBarController()->web_contents()->StartFinding( + findBarBridge_->GetFindBarController()->tab_contents()->StartFinding( base::SysNSStringToUTF16([findText_ stringValue]), false); } - (IBAction)nextResult:(id)sender { if (findBarBridge_) - findBarBridge_->GetFindBarController()->web_contents()->StartFinding( + findBarBridge_->GetFindBarController()->tab_contents()->StartFinding( base::SysNSStringToUTF16([findText_ stringValue]), true); } @@ -80,18 +80,18 @@ if (!findBarBridge_) return; - WebContents* web_contents = - findBarBridge_->GetFindBarController()->web_contents(); - if (!web_contents) + TabContents* tab_contents = + findBarBridge_->GetFindBarController()->tab_contents(); + if (!tab_contents) return; string16 findText = base::SysNSStringToUTF16([findText_ stringValue]); if (findText.length() > 0) { - web_contents->StartFinding(findText, true); + tab_contents->StartFinding(findText, true); } else { // The textbox is empty so we reset. - web_contents->StopFinding(true); // true = clear selection on page. - [self updateUIForFindResult:web_contents->find_result() + tab_contents->StopFinding(true); // true = clear selection on page. + [self updateUIForFindResult:tab_contents->find_result() withText:string16()]; } } diff --git a/chrome/browser/cocoa/tab_strip_controller_unittest.mm b/chrome/browser/cocoa/tab_strip_controller_unittest.mm index f60ab03..386b8e1 100644 --- a/chrome/browser/cocoa/tab_strip_controller_unittest.mm +++ b/chrome/browser/cocoa/tab_strip_controller_unittest.mm @@ -7,7 +7,7 @@ #include "chrome/browser/cocoa/browser_test_helper.h" #import "chrome/browser/cocoa/cocoa_test_helper.h" #import "chrome/browser/cocoa/tab_strip_controller.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -97,7 +97,7 @@ class TabStripControllerTest : public testing::Test { }; TEST_F(TabStripControllerTest, GrowBox) { - // TODO(pinkerton): Creating a WebContents crashes an unrelated test, even + // TODO(pinkerton): Creating a TabContents crashes an unrelated test, even // if you don't do anything with it. http://crbug.com/10899 } @@ -106,24 +106,24 @@ TEST_F(TabStripControllerTest, GrowBox) { TEST_F(TabStripControllerTest, AddRemoveTabs) { EXPECT_TRUE(model_->empty()); #if 0 - // TODO(pinkerton): Creating a WebContents crashes an unrelated test, even + // TODO(pinkerton): Creating a TabContents crashes an unrelated test, even // if you don't do anything with it. http://crbug.com/10899 SiteInstance* instance = SiteInstance::CreateSiteInstance(browser_helper_.profile()); - WebContents* tab_contents = - new WebContents(browser_helper_.profile(), instance); + TabContents* tab_contents = + new TabContents(browser_helper_.profile(), instance); model_->AppendTabContents(tab_contents, true); EXPECT_EQ(model_->count(), 1); #endif } TEST_F(TabStripControllerTest, SelectTab) { - // TODO(pinkerton): Creating a WebContents crashes an unrelated test, even + // TODO(pinkerton): Creating a TabContents crashes an unrelated test, even // if you don't do anything with it. http://crbug.com/10899 } TEST_F(TabStripControllerTest, RearrangeTabs) { - // TODO(pinkerton): Creating a WebContents crashes an unrelated test, even + // TODO(pinkerton): Creating a TabContents crashes an unrelated test, even // if you don't do anything with it. http://crbug.com/10899 } diff --git a/chrome/browser/cross_site_request_manager.h b/chrome/browser/cross_site_request_manager.h index 03ed1f9..0c93f4a 100644 --- a/chrome/browser/cross_site_request_manager.h +++ b/chrome/browser/cross_site_request_manager.h @@ -14,7 +14,7 @@ // CrossSiteRequestManager is used to handle bookkeeping for cross-site // requests and responses between the UI and IO threads. Such requests involve -// a transition from one RenderViewHost to another within WebContents, and +// a transition from one RenderViewHost to another within TabContents, and // involve coordination with ResourceDispatcherHost. // // CrossSiteRequestManager is a singleton that may be used on any thread. diff --git a/chrome/browser/debugger/debugger_host_impl.cpp b/chrome/browser/debugger/debugger_host_impl.cpp index 1f98f4b8..c9bfa21 100644 --- a/chrome/browser/debugger/debugger_host_impl.cpp +++ b/chrome/browser/debugger/debugger_host_impl.cpp @@ -10,7 +10,7 @@ #include "chrome/browser/debugger/debugger_io.h" #include "chrome/browser/debugger/debugger_wrapper.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" class TabContentsReference : public NotificationObserver { @@ -134,12 +134,7 @@ void DebuggerHostImpl::OnDebuggerHostMsg(const ListValue* args) { NOTREACHED(); return; } - const WebContents* web = t->AsWebContents(); - if (web == NULL) { - NOTREACHED(); - return; - } - RenderViewHost* host = web->render_view_host(); + RenderViewHost* host = t->render_view_host(); if (methodName == L"attach") { host->DebugAttach(); diff --git a/chrome/browser/debugger/debugger_node.cc b/chrome/browser/debugger/debugger_node.cc index 0beedce..3322500 100644 --- a/chrome/browser/debugger/debugger_node.cc +++ b/chrome/browser/debugger/debugger_node.cc @@ -11,7 +11,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/debugger/debugger_shell.h" #include "chrome/common/notification_service.h" @@ -19,8 +19,8 @@ DebuggerNode::DebuggerNode() : data_(NULL), valid_(true), observing_(false) { } void DebuggerNode::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { + const NotificationSource& source, + const NotificationDetails& details) { StopObserving(); Invalidate(); } @@ -43,12 +43,12 @@ void DebuggerNode::StopObserving(NotificationService *service) { } v8::Handle<v8::Value> DebuggerNode::IndexGetter(uint32_t index, - const v8::AccessorInfo& info) { + const v8::AccessorInfo& info) { return v8::Undefined(); } v8::Handle<v8::Value> DebuggerNode::PropGetter(v8::Handle<v8::String> prop, - const v8::AccessorInfo& info) { + const v8::AccessorInfo& info) { return v8::Undefined(); } @@ -318,8 +318,8 @@ TabContents* TabNode::GetTab() { } v8::Handle<v8::Value> TabNode::SendToDebugger(const v8::Arguments& args, - WebContents* web) { - RenderViewHost* host = web->render_view_host(); + TabContents* tab) { + RenderViewHost* host = tab->render_view_host(); if (args.Length() == 1) { std::wstring cmd; v8::Handle<v8::Value> obj; @@ -331,24 +331,24 @@ v8::Handle<v8::Value> TabNode::SendToDebugger(const v8::Arguments& args, } v8::Handle<v8::Value> TabNode::Attach(const v8::Arguments& args, - WebContents* web) { - RenderViewHost* host = web->render_view_host(); + TabContents* tab) { + RenderViewHost* host = tab->render_view_host(); host->DebugAttach(); RenderProcessHost* proc = host->process(); return v8::Int32::New(proc->process().pid()); } v8::Handle<v8::Value> TabNode::Detach(const v8::Arguments& args, - WebContents* web) { - RenderViewHost* host = web->render_view_host(); + TabContents* tab) { + RenderViewHost* host = tab->render_view_host(); host->DebugDetach(); RenderProcessHost* proc = host->process(); return v8::Int32::New(proc->process().pid()); } v8::Handle<v8::Value> TabNode::Break(const v8::Arguments& args, - WebContents* web) { - RenderViewHost* host = web->render_view_host(); + TabContents* tab) { + RenderViewHost* host = tab->render_view_host(); bool force = false; if (args.Length() >= 1) { force = args[0]->BooleanValue(); @@ -359,29 +359,27 @@ v8::Handle<v8::Value> TabNode::Break(const v8::Arguments& args, v8::Handle<v8::Value> TabNode::PropGetter(v8::Handle<v8::String> prop, const v8::AccessorInfo& info) { - TabContents* t = GetTab(); - if (t != NULL) { - WebContents* web = t->AsWebContents(); + TabContents* tab = GetTab(); + if (tab != NULL) { if (prop->Equals(v8::String::New("title"))) { - std::wstring title = UTF16ToWideHack(t->GetTitle()); - std::string title2 = WideToUTF8(title); - return v8::String::New(title2.c_str()); - } else if (web) { + std::string title = UTF16ToUTF8(tab->GetTitle()); + return v8::String::New(title.c_str()); + } else { if (prop->Equals(v8::String::New("attach"))) { - FunctionNode<WebContents>* f = - new FunctionNode<WebContents>(TabNode::Attach, web); + FunctionNode<TabContents>* f = + new FunctionNode<TabContents>(TabNode::Attach, tab); return f->NewInstance(); } else if (prop->Equals(v8::String::New("detach"))) { - FunctionNode<WebContents>* f = - new FunctionNode<WebContents>(TabNode::Detach, web); + FunctionNode<TabContents>* f = + new FunctionNode<TabContents>(TabNode::Detach, tab); return f->NewInstance(); } else if (prop->Equals(v8::String::New("sendToDebugger"))) { - FunctionNode<WebContents>* f = - new FunctionNode<WebContents>(TabNode::SendToDebugger, web); + FunctionNode<TabContents>* f = + new FunctionNode<TabContents>(TabNode::SendToDebugger, tab); return f->NewInstance(); } else if (prop->Equals(v8::String::New("debugBreak"))) { - FunctionNode<WebContents>* f = - new FunctionNode<WebContents>(TabNode::Break, web); + FunctionNode<TabContents>* f = + new FunctionNode<TabContents>(TabNode::Break, tab); return f->NewInstance(); } } diff --git a/chrome/browser/debugger/debugger_node.h b/chrome/browser/debugger/debugger_node.h index 0a38cd5..f62a006 100644 --- a/chrome/browser/debugger/debugger_node.h +++ b/chrome/browser/debugger/debugger_node.h @@ -23,7 +23,7 @@ class Browser; class TabContents; class DebuggerShell; class NotificationService; -class WebContents; +class TabContents; class DebuggerNode : public NotificationObserver { public: @@ -201,13 +201,13 @@ class TabNode : public DebuggerNode { private: static v8::Handle<v8::Value> SendToDebugger(const v8::Arguments& args, - WebContents* data); + TabContents* data); static v8::Handle<v8::Value> Attach(const v8::Arguments& args, - WebContents* data); + TabContents* data); static v8::Handle<v8::Value> Detach(const v8::Arguments& args, - WebContents* data); + TabContents* data); static v8::Handle<v8::Value> Break(const v8::Arguments& args, - WebContents* data); + TabContents* data); virtual ~TabNode(); TabContents* GetTab(); diff --git a/chrome/browser/debugger/debugger_remote_service.cc b/chrome/browser/debugger/debugger_remote_service.cc index a856fb6..729dc8a 100644 --- a/chrome/browser/debugger/debugger_remote_service.cc +++ b/chrome/browser/debugger/debugger_remote_service.cc @@ -13,7 +13,7 @@ #include "chrome/browser/debugger/devtools_protocol_handler.h" #include "chrome/browser/debugger/devtools_remote_message.h" #include "chrome/browser/debugger/inspectable_tab_proxy.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/devtools_messages.h" #include "chrome/common/render_messages.h" @@ -83,10 +83,10 @@ void DebuggerRemoteService::HandleMessage( if (manager == NULL) { response.SetInteger(kResultWide, Result::kDebuggerError); } - WebContents* web_contents = ToWebContents(tab_uid); - if (web_contents != NULL) { + TabContents* tab_contents = ToTabContents(tab_uid); + if (tab_contents != NULL) { DevToolsClientHost* client_host = - manager->GetDevToolsClientHostFor(*web_contents); + manager->GetDevToolsClientHostFor(*tab_contents); if (client_host != NULL) { std::string v8_command; DictionaryValue* v8_command_value; @@ -111,9 +111,9 @@ void DebuggerRemoteService::HandleMessage( } } else if (command == DebuggerRemoteServiceCommand::kEvaluateJavascript) { if (tab_uid != -1) { - WebContents* web_contents = ToWebContents(tab_uid); - if (web_contents != NULL) { - RenderViewHost* rvh = web_contents->render_view_host(); + TabContents* tab_contents = ToTabContents(tab_uid); + if (tab_contents != NULL) { + RenderViewHost* rvh = tab_contents->render_view_host(); if (rvh != NULL) { std::wstring javascript; content->GetString(kDataWide, &javascript); @@ -156,7 +156,7 @@ void DebuggerRemoteService::SendResponse(const Value& response, delegate_->Send(*response_message.get()); } -WebContents* DebuggerRemoteService::ToWebContents(int32 tab_uid) { +TabContents* DebuggerRemoteService::ToTabContents(int32 tab_uid) { const InspectableTabProxy::ControllersMap& navcon_map = delegate_->inspectable_tab_proxy()->controllers_map(); InspectableTabProxy::ControllersMap::const_iterator it = @@ -166,7 +166,7 @@ WebContents* DebuggerRemoteService::ToWebContents(int32 tab_uid) { if (tab_contents == NULL) { return NULL; } else { - return tab_contents->AsWebContents(); + return tab_contents; } } else { return NULL; @@ -207,19 +207,19 @@ void DebuggerRemoteService::AttachTab(const std::string& destination, response->SetInteger(kResultWide, Result::kUnknownTab); return; } - WebContents* web_contents = ToWebContents(tab_uid); - if (web_contents == NULL) { + TabContents* tab_contents = ToTabContents(tab_uid); + if (tab_contents == NULL) { // No active web contents with tab_uid response->SetInteger(kResultWide, Result::kUnknownTab); return; } if (g_browser_process->devtools_manager()->GetDevToolsClientHostFor( - *web_contents) == NULL) { + *tab_contents) == NULL) { DevToolsClientHost* client_host = delegate_->inspectable_tab_proxy()->NewClientHost(tab_uid, this); DevToolsManager* manager = g_browser_process->devtools_manager(); if (manager != NULL) { - manager->RegisterDevToolsClientHostFor(*web_contents, client_host); + manager->RegisterDevToolsClientHostFor(*tab_contents, client_host); manager->ForwardToDevToolsAgent(*client_host, DevToolsAgentMsg_Attach()); response->SetInteger(kResultWide, Result::kOk); } else { @@ -243,15 +243,15 @@ void DebuggerRemoteService::DetachTab(const std::string& destination, } return; } - WebContents* web_contents = ToWebContents(tab_uid); - if (web_contents == NULL) { + TabContents* tab_contents = ToTabContents(tab_uid); + if (tab_contents == NULL) { // Unknown tab resultCode = Result::kUnknownTab; } else { DevToolsManager* manager = g_browser_process->devtools_manager(); if (manager != NULL) { DevToolsClientHost* client_host = - manager->GetDevToolsClientHostFor(*web_contents); + manager->GetDevToolsClientHostFor(*tab_contents); if (client_host != NULL) { manager->ForwardToDevToolsAgent( *client_host, DevToolsAgentMsg_Detach()); diff --git a/chrome/browser/debugger/debugger_remote_service.h b/chrome/browser/debugger/debugger_remote_service.h index 53d06ba..7b2b683 100644 --- a/chrome/browser/debugger/debugger_remote_service.h +++ b/chrome/browser/debugger/debugger_remote_service.h @@ -16,7 +16,7 @@ class DevToolsProtocolHandler; class DevToolsRemoteMessage; class DictionaryValue; class Value; -class WebContents; +class TabContents; // Contains constants for DebuggerRemoteService tool protocol commands // (only V8-related). @@ -63,7 +63,7 @@ class DebuggerRemoteService : public DevToolsRemoteListener { void AttachTab(const std::string& destination, DictionaryValue* response); - WebContents* ToWebContents(int32 tab_uid); + TabContents* ToTabContents(int32 tab_uid); void SendResponse(const Value& response, const std::string& tool, const std::string& destination); diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc index c292b39..bf3dc09 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/debugger/debugger_window.h" +#include "chrome/browser/debugger/debugger_view.h" #include "base/logging.h" #include "base/string_util.h" @@ -11,7 +11,7 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/debugger_shell.h" -#include "chrome/browser/debugger/debugger_view.h" +#include "chrome/browser/debugger/debugger_window.h" #include "chrome/browser/debugger/debugger_wrapper.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" #include "chrome/browser/renderer_host/render_view_host.h" @@ -19,7 +19,6 @@ #include "chrome/browser/view_ids.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/browser/views/tab_contents_container_view.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/grid_layout.h" @@ -96,27 +95,27 @@ void DebuggerView::Output(const std::wstring& out) { } void DebuggerView::OnInit() { - // We can't create the WebContents until we've actually been put into a real + // We can't create the TabContents until we've actually been put into a real // view hierarchy somewhere. Profile* profile = BrowserList::GetLastActive()->profile(); - web_contents_ = new WebContents(profile, NULL, MSG_ROUTING_NONE, NULL); + tab_contents_ = new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL); - web_contents_->set_delegate(this); - web_container_->SetTabContents(web_contents_); - web_contents_->render_view_host()->AllowDOMUIBindings(); + tab_contents_->set_delegate(this); + web_container_->SetTabContents(tab_contents_); + tab_contents_->render_view_host()->AllowDOMUIBindings(); GURL contents("chrome-ui://inspector/debugger.html"); - web_contents_->controller().LoadURL(contents, GURL(), + tab_contents_->controller().LoadURL(contents, GURL(), PageTransition::START_PAGE); } void DebuggerView::OnShow() { - web_contents_->Focus(); + tab_contents_->Focus(); } void DebuggerView::OnClose() { web_container_->SetTabContents(NULL); - delete web_contents_; + delete tab_contents_; } void DebuggerView::OpenURLFromTab(TabContents* source, @@ -149,7 +148,7 @@ void DebuggerView::SendEventToPage(const std::wstring& name, } void DebuggerView::ExecuteJavascript(const std::string& js) { - web_contents_->render_view_host()->ExecuteJavascriptInWebFrame(L"", + tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame(L"", UTF8ToWide(js)); } diff --git a/chrome/browser/debugger/debugger_view.h b/chrome/browser/debugger/debugger_view.h index 7707713..616afce 100644 --- a/chrome/browser/debugger/debugger_view.h +++ b/chrome/browser/debugger/debugger_view.h @@ -17,9 +17,9 @@ class DebuggerView; class DebuggerWindow; +class TabContents; class TabContentsContainerView; class Value; -class WebContents; class DebuggerView : public views::View, public TabContentsDelegate { @@ -89,7 +89,7 @@ class DebuggerView : public views::View, DebuggerWindow* window_; ChromeFont font_; - WebContents* web_contents_; + TabContents* tab_contents_; TabContentsContainerView* web_container_; std::vector<std::wstring> pending_output_; std::vector<std::string> pending_events_; diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc index b18b9af..3ebfbd3 100644 --- a/chrome/browser/debugger/devtools_manager.cc +++ b/chrome/browser/debugger/devtools_manager.cc @@ -8,7 +8,6 @@ #include "chrome/browser/debugger/devtools_client_host.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/devtools_messages.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_type.h" @@ -26,9 +25,9 @@ DevToolsManager::~DevToolsManager() { void DevToolsManager::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::WEB_CONTENTS_DISCONNECTED); + DCHECK(type == NotificationType::TAB_CONTENTS_DISCONNECTED); - if (type == NotificationType::WEB_CONTENTS_DISCONNECTED) { + if (type == NotificationType::TAB_CONTENTS_DISCONNECTED) { Source<TabContents> src(source); DevToolsClientHost* client_host = GetDevToolsClientHostFor(*src.ptr()); if (!client_host) { @@ -111,12 +110,8 @@ void DevToolsManager::ForwardToDevToolsAgent(const DevToolsClientHost& from, void DevToolsManager::ForwardToDevToolsClient(const RenderViewHost& from, const IPC::Message& message) { - TabContents* wc = from.delegate()->GetAsWebContents(); - if (!wc) { - NOTREACHED(); - return; - } - DevToolsClientHost* target_host = GetDevToolsClientHostFor(*wc); + TabContents* tc = from.delegate()->GetAsTabContents(); + DevToolsClientHost* target_host = GetDevToolsClientHostFor(*tc); if (!target_host) { // Client window was closed while there were messages // being sent to it. @@ -187,7 +182,7 @@ void DevToolsManager::StartListening( tab_contents_listeners_.reset(new NotificationRegistrar); tab_contents_listeners_->Add( this, - NotificationType::WEB_CONTENTS_DISCONNECTED, + NotificationType::TAB_CONTENTS_DISCONNECTED, NotificationService::AllSources()); } } diff --git a/chrome/browser/debugger/devtools_protocol_handler.h b/chrome/browser/debugger/devtools_protocol_handler.h index 7080794..7b4c7fd 100644 --- a/chrome/browser/debugger/devtools_protocol_handler.h +++ b/chrome/browser/debugger/devtools_protocol_handler.h @@ -16,7 +16,6 @@ class InspectableTabProxy; class DevToolsRemoteListenSocket; class DevToolsRemoteMessage; -class WebContents; // Dispatches DevToolsRemoteMessages to their appropriate handlers (Tools) // based on the value of the Tool message header. diff --git a/chrome/browser/debugger/devtools_view.cc b/chrome/browser/debugger/devtools_view.cc index 179eb7e..34cbb20 100644 --- a/chrome/browser/debugger/devtools_view.cc +++ b/chrome/browser/debugger/devtools_view.cc @@ -9,13 +9,13 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/debugger/devtools_client_host.h" #include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/views/tab_contents_container_view.h" #include "chrome/common/property_bag.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" -DevToolsView::DevToolsView() : web_contents_(NULL) { +DevToolsView::DevToolsView() : tab_contents_(NULL) { web_container_ = new TabContentsContainerView(); AddChildView(web_container_); } @@ -45,38 +45,38 @@ void DevToolsView::ViewHierarchyChanged(bool is_add, } void DevToolsView::Init() { - // We can't create the WebContents until we've actually been put into a real + // We can't create the TabContents until we've actually been put into a real // view hierarchy somewhere. Profile* profile = BrowserList::GetLastActive()->profile(); - web_contents_ = new WebContents(profile, NULL, MSG_ROUTING_NONE, NULL); - web_contents_->set_delegate(this); - web_container_->SetTabContents(web_contents_); - web_contents_->render_view_host()->AllowDOMUIBindings(); + tab_contents_ = new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL); + tab_contents_->set_delegate(this); + web_container_->SetTabContents(tab_contents_); + tab_contents_->render_view_host()->AllowDOMUIBindings(); // chrome-ui://devtools/devtools.html GURL contents(std::string(chrome::kChromeUIDevToolsURL) + "devtools.html"); // this will call CreateRenderView to create renderer process - web_contents_->controller().LoadURL(contents, GURL(), + tab_contents_->controller().LoadURL(contents, GURL(), PageTransition::START_PAGE); } void DevToolsView::OnWindowClosing() { - DCHECK(web_contents_) << "OnWindowClosing is called twice"; - if (web_contents_) { + DCHECK(tab_contents_) << "OnWindowClosing is called twice"; + if (tab_contents_) { // Detach last (and only) tab. web_container_->SetTabContents(NULL); // Destroy the tab and navigation controller. - delete web_contents_; - web_contents_ = NULL; + delete tab_contents_; + tab_contents_ = NULL; } } void DevToolsView::SendMessageToClient(const IPC::Message& message) { - if (web_contents_) { - RenderViewHost* target_host = web_contents_->render_view_host(); + if (tab_contents_) { + RenderViewHost* target_host = tab_contents_->render_view_host(); IPC::Message* m = new IPC::Message(message); m->set_routing_id(target_host->routing_id()); target_host->Send(m); @@ -84,8 +84,8 @@ void DevToolsView::SendMessageToClient(const IPC::Message& message) { } bool DevToolsView::HasRenderViewHost(const RenderViewHost& rvh) const { - if (web_contents_) { - return (&rvh == web_contents_->render_view_host()); + if (tab_contents_) { + return (&rvh == tab_contents_->render_view_host()); } return false; } diff --git a/chrome/browser/debugger/devtools_view.h b/chrome/browser/debugger/devtools_view.h index 0836ccc..39de03b 100644 --- a/chrome/browser/debugger/devtools_view.h +++ b/chrome/browser/debugger/devtools_view.h @@ -18,7 +18,7 @@ class Message; class RenderViewHost; class TabContentsContainerView; -class WebContents; +class TabContents; class DevToolsView : public views::View, public TabContentsDelegate { @@ -67,7 +67,7 @@ class DevToolsView : public views::View, void Init(); - WebContents* web_contents_; + TabContents* tab_contents_; TabContentsContainerView* web_container_; DISALLOW_COPY_AND_ASSIGN(DevToolsView); diff --git a/chrome/browser/dom_ui/debugger_ui.cc b/chrome/browser/dom_ui/debugger_ui.cc index c8b4e74..c20286a 100644 --- a/chrome/browser/dom_ui/debugger_ui.cc +++ b/chrome/browser/dom_ui/debugger_ui.cc @@ -121,7 +121,7 @@ class DebuggerHandler : public DOMMessageHandler { } // namespace -DebuggerUI::DebuggerUI(WebContents* contents) : DOMUI(contents) { +DebuggerUI::DebuggerUI(TabContents* contents) : DOMUI(contents) { AddMessageHandler(new DebuggerHandler(this)); DebuggerHTMLSource* html_source = new DebuggerHTMLSource(); diff --git a/chrome/browser/dom_ui/debugger_ui.h b/chrome/browser/dom_ui/debugger_ui.h index 8cefc66..f64fc36 100644 --- a/chrome/browser/dom_ui/debugger_ui.h +++ b/chrome/browser/dom_ui/debugger_ui.h @@ -11,7 +11,7 @@ class DebuggerUI : public DOMUI { public: - DebuggerUI(WebContents* contents); + DebuggerUI(TabContents* contents); private: DISALLOW_COPY_AND_ASSIGN(DebuggerUI); diff --git a/chrome/browser/dom_ui/devtools_ui.cc b/chrome/browser/dom_ui/devtools_ui.cc index daf2de6..04fcd04 100644 --- a/chrome/browser/dom_ui/devtools_ui.cc +++ b/chrome/browser/dom_ui/devtools_ui.cc @@ -8,7 +8,7 @@ #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" -DevToolsUI::DevToolsUI(WebContents* contents) : DOMUI(contents) { +DevToolsUI::DevToolsUI(TabContents* contents) : DOMUI(contents) { } void DevToolsUI::RenderViewCreated(RenderViewHost* render_view_host) { diff --git a/chrome/browser/dom_ui/devtools_ui.h b/chrome/browser/dom_ui/devtools_ui.h index afc9fe5..ecdc413 100644 --- a/chrome/browser/dom_ui/devtools_ui.h +++ b/chrome/browser/dom_ui/devtools_ui.h @@ -9,7 +9,7 @@ class DevToolsUI : public DOMUI { public: - explicit DevToolsUI(WebContents* contents); + explicit DevToolsUI(TabContents* contents); // DOMUI overrides. virtual void RenderViewCreated(RenderViewHost* render_view_host); diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc index ea9e1a5..54325b4 100644 --- a/chrome/browser/dom_ui/dom_ui.cc +++ b/chrome/browser/dom_ui/dom_ui.cc @@ -8,17 +8,17 @@ #include "base/json_writer.h" #include "base/string_util.h" #include "base/values.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" #include "chrome/common/stl_util-inl.h" -DOMUI::DOMUI(WebContents* contents) +DOMUI::DOMUI(TabContents* contents) : hide_favicon_(false), force_bookmark_bar_visible_(false), focus_location_bar_by_default_(false), should_hide_url_(false), link_transition_type_(PageTransition::LINK), - web_contents_(contents) { + tab_contents_(contents) { } DOMUI::~DOMUI() { @@ -85,7 +85,7 @@ void DOMUI::RegisterMessageCallback(const std::string &message, } Profile* DOMUI::GetProfile() { - return web_contents()->profile(); + return tab_contents()->profile(); } // DOMUI, protected: ---------------------------------------------------------- @@ -97,7 +97,7 @@ void DOMUI::AddMessageHandler(DOMMessageHandler* handler) { // DOMUI, private: ------------------------------------------------------------ void DOMUI::ExecuteJavascript(const std::wstring& javascript) { - web_contents()->render_view_host()->ExecuteJavascriptInWebFrame( + tab_contents()->render_view_host()->ExecuteJavascriptInWebFrame( std::wstring(), javascript); } diff --git a/chrome/browser/dom_ui/dom_ui.h b/chrome/browser/dom_ui/dom_ui.h index 68db631..3c2dc16 100644 --- a/chrome/browser/dom_ui/dom_ui.h +++ b/chrome/browser/dom_ui/dom_ui.h @@ -20,13 +20,13 @@ class GURL; class Profile; class RenderViewHost; class Value; -class WebContents; +class TabContents; // A DOMUI sets up the datasources and message handlers for a given HTML-based // UI. It is contained by a DOMUIManager. class DOMUI { public: - explicit DOMUI(WebContents* contents); + explicit DOMUI(TabContents* contents); virtual ~DOMUI(); virtual void RenderViewCreated(RenderViewHost* render_view_host) {} @@ -89,7 +89,7 @@ class DOMUI { const Value& arg1, const Value& arg2); - WebContents* web_contents() { return web_contents_; } + TabContents* tab_contents() { return tab_contents_; } Profile* GetProfile(); @@ -109,8 +109,8 @@ class DOMUI { // Execute a string of raw Javascript on the page. void ExecuteJavascript(const std::wstring& javascript); - // Non-owning pointer to the WebContents this DOMUI is associated with. - WebContents* web_contents_; + // Non-owning pointer to the TabContents this DOMUI is associated with. + TabContents* tab_contents_; // The DOMMessageHandlers we own. std::vector<DOMMessageHandler*> handlers_; diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc index d90ab39..c2dea2d 100644 --- a/chrome/browser/dom_ui/dom_ui_factory.cc +++ b/chrome/browser/dom_ui/dom_ui_factory.cc @@ -22,23 +22,23 @@ // web contents and the new_ui. The return value will indiacate whether a DOM UI // exists for the given URL. // -// If you want to create a DOM UI, pass non-NULL pointers for both web_contents +// If you want to create a DOM UI, pass non-NULL pointers for both tab_contents // and new_ui. The *new_ui pointer will be filled with the created UI if it // succeeds (indicated by a return value of true). The caller owns the *new_ui // pointer. -static bool CreateDOMUI(const GURL& url, WebContents* web_contents, +static bool CreateDOMUI(const GURL& url, TabContents* tab_contents, DOMUI** new_ui) { // Currently, any gears: URL means an HTML dialog. if (url.SchemeIs(chrome::kGearsScheme)) { if (new_ui) - *new_ui = new HtmlDialogUI(web_contents); + *new_ui = new HtmlDialogUI(tab_contents); return true; } #ifdef CHROME_PERSONALIZATION if (Personalization::NeedsDOMUI(url)) { if (new_ui) - *new_ui = new HtmlDialogUI(web_contents); + *new_ui = new HtmlDialogUI(tab_contents); return true; } #endif @@ -56,7 +56,7 @@ static bool CreateDOMUI(const GURL& url, WebContents* web_contents, if (url.host() == chrome::kChromeUINewTabHost || url.SchemeIs(chrome::kChromeInternalScheme)) { if (new_ui) - *new_ui = new NewTabUI(web_contents); + *new_ui = new NewTabUI(tab_contents); return true; } @@ -64,31 +64,31 @@ static bool CreateDOMUI(const GURL& url, WebContents* web_contents, // after the host name. if (url.host() == chrome::kChromeUIHistoryHost) { if (new_ui) - *new_ui = new HistoryUI(web_contents); + *new_ui = new HistoryUI(tab_contents); return true; } if (url.host() == chrome::kChromeUIDownloadsHost) { if (new_ui) - *new_ui = new DownloadsUI(web_contents); + *new_ui = new DownloadsUI(tab_contents); return true; } if (url.host() == chrome::kChromeUIExtensionsHost) { if (new_ui) - *new_ui = new ExtensionsUI(web_contents); + *new_ui = new ExtensionsUI(tab_contents); return true; } if (url.host() == chrome::kChromeUIInspectorHost) { if (new_ui) - *new_ui = new DebuggerUI(web_contents); + *new_ui = new DebuggerUI(tab_contents); return true; } if (url.host() == chrome::kChromeUIDevToolsHost) { if (new_ui) - *new_ui = new DevToolsUI(web_contents); + *new_ui = new DevToolsUI(tab_contents); return true; } @@ -107,10 +107,10 @@ bool DOMUIFactory::UseDOMUIForURL(const GURL& url) { } // static -DOMUI* DOMUIFactory::CreateDOMUIForURL(WebContents* web_contents, +DOMUI* DOMUIFactory::CreateDOMUIForURL(TabContents* tab_contents, const GURL& url) { DOMUI* dom_ui; - if (!CreateDOMUI(url, web_contents, &dom_ui)) + if (!CreateDOMUI(url, tab_contents, &dom_ui)) return NULL; return dom_ui; } diff --git a/chrome/browser/dom_ui/dom_ui_factory.h b/chrome/browser/dom_ui/dom_ui_factory.h index 1641a8a..77c7c98 100644 --- a/chrome/browser/dom_ui/dom_ui_factory.h +++ b/chrome/browser/dom_ui/dom_ui_factory.h @@ -7,7 +7,7 @@ class DOMUI;
class GURL;
-class WebContents;
+class TabContents;
class DOMUIFactory {
public:
@@ -23,7 +23,7 @@ class DOMUIFactory { // Allocates a new DOMUI object for the given URL, and returns it. If the URL
// is not a DOM UI URL, then it will return NULL. When non-NULL, ownership of
// the returned pointer is passed to the caller.
- static DOMUI* CreateDOMUIForURL(WebContents* web_contents, const GURL& url);
+ static DOMUI* CreateDOMUIForURL(TabContents* tab_contents, const GURL& url);
private:
// Class is for scoping only.
diff --git a/chrome/browser/dom_ui/dom_ui_unittest.cc b/chrome/browser/dom_ui/dom_ui_unittest.cc index e108c23..43a3f71 100644 --- a/chrome/browser/dom_ui/dom_ui_unittest.cc +++ b/chrome/browser/dom_ui/dom_ui_unittest.cc @@ -15,7 +15,7 @@ class DOMUITest : public RenderViewHostTestHarness { // state, through pending, committed, then another navigation. The first page // ID that we should use is passed as a parameter. We'll use the next two // values. This must be increasing for the life of the tests. - static void DoNavigationTest(WebContents* contents, int page_id) { + static void DoNavigationTest(TabContents* contents, int page_id) { NavigationController* controller = &contents->controller(); // Start a pending load. @@ -79,16 +79,16 @@ class DOMUITest : public RenderViewHostTestHarness { }; // Tests that the New Tab Page flags are correctly set and propogated by -// WebContents when we first navigate to a DOM UI page, then to a standard +// TabContents when we first navigate to a DOM UI page, then to a standard // non-DOM-UI page. TEST_F(DOMUITest, DOMUIToStandard) { DoNavigationTest(contents(), 1); // Test the case where we're not doing the initial navigation. This is // slightly different than the very-first-navigation case since the - // SiteInstance will be the same (the original WebContents must still be + // SiteInstance will be the same (the original TabContents must still be // alive), which will trigger different behavior in RenderViewHostManager. - TestWebContents contents2(profile_.get(), NULL); + TestTabContents contents2(profile_.get(), NULL); DoNavigationTest(&contents2, 101); } diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc index 1bc5794..639be99 100644 --- a/chrome/browser/dom_ui/downloads_ui.cc +++ b/chrome/browser/dom_ui/downloads_ui.cc @@ -509,7 +509,7 @@ std::wstring DownloadsDOMHandler::GetProgressStatusText( // /////////////////////////////////////////////////////////////////////////////// -DownloadsUI::DownloadsUI(WebContents* contents) : DOMUI(contents) { +DownloadsUI::DownloadsUI(TabContents* contents) : DOMUI(contents) { DownloadManager* dlm = GetProfile()->GetDownloadManager(); DownloadsDOMHandler* handler = new DownloadsDOMHandler(this, dlm); diff --git a/chrome/browser/dom_ui/downloads_ui.h b/chrome/browser/dom_ui/downloads_ui.h index ed435e1..a24e07b 100644 --- a/chrome/browser/dom_ui/downloads_ui.h +++ b/chrome/browser/dom_ui/downloads_ui.h @@ -9,7 +9,7 @@ class DownloadsUI : public DOMUI { public: - explicit DownloadsUI(WebContents* contents); + explicit DownloadsUI(TabContents* contents); private: DISALLOW_COPY_AND_ASSIGN(DownloadsUI); diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index b9cba34..25f84ba 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -362,7 +362,7 @@ void BrowsingHistoryHandler::Observe(NotificationType type, // //////////////////////////////////////////////////////////////////////////////// -HistoryUI::HistoryUI(WebContents* contents) : DOMUI(contents) { +HistoryUI::HistoryUI(TabContents* contents) : DOMUI(contents) { AddMessageHandler(new BrowsingHistoryHandler(this)); HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource(); diff --git a/chrome/browser/dom_ui/history_ui.h b/chrome/browser/dom_ui/history_ui.h index 41bba82..a4f201c 100644 --- a/chrome/browser/dom_ui/history_ui.h +++ b/chrome/browser/dom_ui/history_ui.h @@ -81,7 +81,7 @@ class BrowsingHistoryHandler : public DOMMessageHandler, class HistoryUI : public DOMUI { public: - explicit HistoryUI(WebContents* contents); + explicit HistoryUI(TabContents* contents); // Return the URL for a given search term. static const GURL GetHistoryURLWithSearchText(const std::wstring& text); diff --git a/chrome/browser/dom_ui/html_dialog_ui.cc b/chrome/browser/dom_ui/html_dialog_ui.cc index 4062438..060625d 100644 --- a/chrome/browser/dom_ui/html_dialog_ui.cc +++ b/chrome/browser/dom_ui/html_dialog_ui.cc @@ -6,10 +6,10 @@ #include "base/singleton.h" #include "base/values.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/renderer_host/render_view_host.h" -HtmlDialogUI::HtmlDialogUI(WebContents* web_contents) : DOMUI(web_contents) { +HtmlDialogUI::HtmlDialogUI(TabContents* tab_contents) : DOMUI(tab_contents) { } HtmlDialogUI::~HtmlDialogUI() { @@ -62,7 +62,7 @@ void HtmlDialogUI::RenderViewCreated(RenderViewHost* render_view_host) { // Pass the arguments to the renderer supplied by the delegate. std::string dialog_args; HtmlDialogUIDelegate** delegate = GetPropertyAccessor().GetProperty( - web_contents()->property_bag()); + tab_contents()->property_bag()); if (delegate) dialog_args = (*delegate)->GetDialogArgs(); render_view_host->SetDOMUIProperty("dialogArguments", dialog_args); @@ -70,7 +70,7 @@ void HtmlDialogUI::RenderViewCreated(RenderViewHost* render_view_host) { void HtmlDialogUI::OnDialogClosed(const Value* content) { HtmlDialogUIDelegate** delegate = GetPropertyAccessor().GetProperty( - web_contents()->property_bag()); + tab_contents()->property_bag()); if (delegate) (*delegate)->OnDialogClosed(GetJsonResponse(content)); } diff --git a/chrome/browser/dom_ui/html_dialog_ui.h b/chrome/browser/dom_ui/html_dialog_ui.h index 070315f..29895d2 100644 --- a/chrome/browser/dom_ui/html_dialog_ui.h +++ b/chrome/browser/dom_ui/html_dialog_ui.h @@ -37,13 +37,13 @@ class HtmlDialogUIDelegate { // Displays file URL contents inside a modal HTML dialog. // -// This application really should not use WebContents + DOMUI. It should instead +// This application really should not use TabContents + DOMUI. It should instead // just embed a RenderView in a dialog and be done with it. // // Before loading a URL corresponding to this DOMUI, the caller should set its -// delegate as a property on the WebContents. This DOMUI will pick it up from +// delegate as a property on the TabContents. This DOMUI will pick it up from // there and call it back. This is a bit of a hack to allow the dialog to pass -// its delegate to the DOM UI without having nasty accessors on the WebContents. +// its delegate to the DOM UI without having nasty accessors on the TabContents. // The correct design using RVH directly would avoid all of this. class HtmlDialogUI : public DOMUI { public: @@ -58,12 +58,12 @@ class HtmlDialogUI : public DOMUI { std::string json_input; }; - // When created, the property should already be set on the WebContents. - HtmlDialogUI(WebContents* web_contents); + // When created, the property should already be set on the TabContents. + HtmlDialogUI(TabContents* tab_contents); virtual ~HtmlDialogUI(); // Returns the PropertyBag accessor object used to write the delegate pointer - // into the WebContents (see class-level comment above). + // into the TabContents (see class-level comment above). static PropertyAccessor<HtmlDialogUIDelegate*>& GetPropertyAccessor(); private: diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 9965b43..a187560 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -22,7 +22,7 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/sessions/session_types.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/sessions/tab_restore_service.h" #include "chrome/browser/user_data_manager.h" @@ -688,7 +688,7 @@ void TemplateURLHandler::HandleDoSearch(const Value* content) { } // Load the URL. - dom_ui_->web_contents()->OpenURL(url, GURL(), CURRENT_TAB, + dom_ui_->tab_contents()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::LINK); // We've been deleted. return; @@ -893,7 +893,7 @@ RecentlyClosedTabsHandler::~RecentlyClosedTabsHandler() { void RecentlyClosedTabsHandler::HandleReopenTab(const Value* content) { Browser* browser = Browser::GetBrowserForController( - &dom_ui_->web_contents()->controller(), NULL); + &dom_ui_->tab_contents()->controller(), NULL); if (!browser) return; @@ -1054,7 +1054,7 @@ void HistoryHandler::HandleSearchHistoryPage(const Value* content) { #if defined(OS_WIN) // TODO(port): include this once history is converted to HTML - dom_ui_->web_contents()->controller().LoadURL( + dom_ui_->tab_contents()->controller().LoadURL( HistoryUI::GetHistoryURLWithSearchText(wstring_value), GURL(), PageTransition::LINK); @@ -1117,7 +1117,7 @@ void MetricsHandler::HandleMetrics(const Value* content) { /////////////////////////////////////////////////////////////////////////////// // NewTabUI -NewTabUI::NewTabUI(WebContents* contents) +NewTabUI::NewTabUI(TabContents* contents) : DOMUI(contents), motd_message_id_(0), incognito_(false) { @@ -1139,7 +1139,7 @@ NewTabUI::NewTabUI(WebContents* contents) NewTabHTMLSource::set_first_view(false); } - web_contents()->render_view_host()->set_paint_observer(new PaintTimer); + tab_contents()->render_view_host()->set_paint_observer(new PaintTimer); if (GetProfile()->IsOffTheRecord()) { incognito_ = true; diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h index ef101b3..8e3b560 100644 --- a/chrome/browser/dom_ui/new_tab_ui.h +++ b/chrome/browser/dom_ui/new_tab_ui.h @@ -14,7 +14,7 @@ class Profile; // The TabContents used for the New Tab page. class NewTabUI : public DOMUI { public: - explicit NewTabUI(WebContents* manager); + explicit NewTabUI(TabContents* manager); ~NewTabUI(); static void RegisterUserPrefs(PrefService* prefs); diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc index 89b468c..a44e5fe 100644 --- a/chrome/browser/download/download_file.cc +++ b/chrome/browser/download/download_file.cc @@ -14,7 +14,7 @@ #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/platform_util.h" #include "chrome/common/stl_util-inl.h" @@ -363,7 +363,7 @@ void DownloadFileManager::UpdateInProgressDownloads() { // Notifications sent from the download thread and run on the UI thread. -// Lookup the DownloadManager for this WebContents' profile and inform it of +// Lookup the DownloadManager for this TabContents' profile and inform it of // a new download. // TODO(paulg): When implementing download restart via the Downloads tab, // there will be no 'render_process_id' or 'render_view_id'. @@ -471,7 +471,7 @@ void DownloadFileManager::RemoveDownload(int id, DownloadManager* manager) { // static DownloadManager* DownloadFileManager::DownloadManagerFromRenderIds( int render_process_id, int render_view_id) { - WebContents* contents = tab_util::GetWebContentsByID(render_process_id, + TabContents* contents = tab_util::GetTabContentsByID(render_process_id, render_view_id); if (contents) { Profile* profile = contents->profile(); diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 14c1348..5e87d0e 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -25,7 +25,7 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -638,7 +638,7 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) { if (!select_file_dialog_.get()) select_file_dialog_ = SelectFileDialog::Create(this); - WebContents* contents = tab_util::GetWebContentsByID( + TabContents* contents = tab_util::GetTabContentsByID( info->render_process_id, info->render_view_id); SelectFileDialog::FileTypeInfo file_type_info; file_type_info.extensions.resize(1); @@ -1088,13 +1088,13 @@ int DownloadManager::RemoveAllDownloads() { void DownloadManager::DownloadUrl(const GURL& url, const GURL& referrer, const std::string& referrer_charset, - WebContents* web_contents) { - DCHECK(web_contents); + TabContents* tab_contents) { + DCHECK(tab_contents); request_context_->set_referrer_charset(referrer_charset); file_manager_->DownloadUrl(url, referrer, - web_contents->process()->pid(), - web_contents->render_view_host()->routing_id(), + tab_contents->process()->pid(), + tab_contents->render_view_host()->routing_id(), request_context_.get()); } @@ -1463,10 +1463,10 @@ void DownloadManager::OnCreateDownloadEntryComplete(DownloadCreateInfo info, downloads_[download->db_handle()] = download; // The 'contents' may no longer exist if the user closed the tab before we get - // this start completion event. If it does, tell the origin WebContents to + // this start completion event. If it does, tell the origin TabContents to // display its download shelf. TabContents* contents = - tab_util::GetWebContentsByID(info.render_process_id, info.render_view_id); + tab_util::GetTabContentsByID(info.render_process_id, info.render_view_id); // If the contents no longer exists, we start the download in the last active // browser. This is not ideal but better than fully hiding the download from diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 50f4fa3..0fb1675 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -63,7 +63,7 @@ class PrefService; class Profile; class ResourceDispatcherHost; class URLRequestContext; -class WebContents; +class TabContents; namespace base { class Thread; @@ -357,7 +357,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, void DownloadUrl(const GURL& url, const GURL& referrer, const std::string& referrer_encoding, - WebContents* web_contents); + TabContents* tab_contents); // Allow objects to observe the download creation process. void AddObserver(Observer* observer); diff --git a/chrome/browser/download/download_request_manager.cc b/chrome/browser/download/download_request_manager.cc index 6078fce..4cd4319 100644 --- a/chrome/browser/download/download_request_manager.cc +++ b/chrome/browser/download/download_request_manager.cc @@ -11,7 +11,7 @@ #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" // TabDownloadState ------------------------------------------------------------ @@ -228,8 +228,8 @@ void DownloadRequestManager::CanDownload(int render_process_host_id, Callback* callback) { DCHECK(!ui_loop_ || MessageLoop::current() == ui_loop_); - WebContents* originating_tab = - tab_util::GetWebContentsByID(render_process_host_id, render_view_id); + TabContents* originating_tab = + tab_util::GetTabContentsByID(render_process_host_id, render_view_id); if (!originating_tab) { // The tab was closed, don't allow the download. ScheduleNotification(callback, false); diff --git a/chrome/browser/download/save_file_manager.cc b/chrome/browser/download/save_file_manager.cc index 4d1b2ad..133cdbe 100644 --- a/chrome/browser/download/save_file_manager.cc +++ b/chrome/browser/download/save_file_manager.cc @@ -16,7 +16,6 @@ #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/platform_util.h" #include "chrome/common/stl_util-inl.h" @@ -213,7 +212,7 @@ void SaveFileManager::RemoveSaveFile(int save_id, const GURL& save_url, // only on the UI thread. SavePackage* SaveFileManager::GetSavePackageFromRenderIds( int render_process_id, int render_view_id) { - WebContents* contents = tab_util::GetWebContentsByID(render_process_id, + TabContents* contents = tab_util::GetTabContentsByID(render_process_id, render_view_id); if (contents) return contents->save_package(); diff --git a/chrome/browser/download/save_file_manager.h b/chrome/browser/download/save_file_manager.h index 89672fc..ac6c1c8 100644 --- a/chrome/browser/download/save_file_manager.h +++ b/chrome/browser/download/save_file_manager.h @@ -181,7 +181,7 @@ class SaveFileManager // Notifications sent from the file thread and run on the UI thread. - // Lookup the SaveManager for this WebContents' saving profile and inform it + // Lookup the SaveManager for this TabContents' saving profile and inform it // the saving job has been started. void OnStartSave(const SaveFileCreateInfo* info); // Update the SavePackage with the current state of a started saving job. diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 19d7df6..57ed679 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -22,8 +22,8 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/render_view_host_delegate.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/l10n_util.h" #include "chrome/common/platform_util.h" @@ -112,12 +112,12 @@ FilePath::StringType StripOrdinalNumber( } // namespace -SavePackage::SavePackage(WebContents* web_content, +SavePackage::SavePackage(TabContents* web_content, SavePackageType save_type, const FilePath& file_full_path, const FilePath& directory_full_path) : file_manager_(NULL), - web_contents_(web_content), + tab_contents_(web_content), download_(NULL), saved_main_file_path_(file_full_path), saved_main_directory_path_(directory_full_path), @@ -129,7 +129,7 @@ SavePackage::SavePackage(WebContents* web_content, wait_state_(INITIALIZE), tab_id_(web_content->process()->pid()) { DCHECK(web_content); - const GURL& current_page_url = web_contents_->GetURL(); + const GURL& current_page_url = tab_contents_->GetURL(); DCHECK(current_page_url.is_valid()); page_url_ = current_page_url; DCHECK(save_type_ == SAVE_AS_ONLY_HTML || @@ -140,17 +140,17 @@ SavePackage::SavePackage(WebContents* web_content, saved_main_directory_path_.value().length() < kMaxFilePathLength); } -SavePackage::SavePackage(WebContents* web_contents) +SavePackage::SavePackage(TabContents* tab_contents) : file_manager_(NULL), - web_contents_(web_contents), + tab_contents_(tab_contents), download_(NULL), finished_(false), user_canceled_(false), disk_error_occurred_(false), all_save_items_count_(0), wait_state_(INITIALIZE), - tab_id_(web_contents->process()->pid()) { - const GURL& current_page_url = web_contents_->GetURL(); + tab_id_(tab_contents->process()->pid()) { + const GURL& current_page_url = tab_contents_->GetURL(); DCHECK(current_page_url.is_valid()); page_url_ = current_page_url; } @@ -232,7 +232,7 @@ bool SavePackage::Init() { wait_state_ = START_PROCESS; // Initialize the request context and resource dispatcher. - Profile* profile = web_contents_->profile(); + Profile* profile = tab_contents_->profile(); if (!profile) { NOTREACHED(); return false; @@ -255,11 +255,11 @@ bool SavePackage::Init() { // Create the fake DownloadItem and display the view. download_ = new DownloadItem(1, saved_main_file_path_, 0, page_url_, FilePath(), Time::Now(), 0, -1, -1, false); - download_->set_manager(web_contents_->profile()->GetDownloadManager()); + download_->set_manager(tab_contents_->profile()->GetDownloadManager()); #if !defined(OS_MACOSX) - DownloadShelf* shelf = web_contents_->GetDownloadShelf(); + DownloadShelf* shelf = tab_contents_->GetDownloadShelf(); shelf->AddDownload(new SavePageModel(this, download_)); - web_contents_->SetDownloadShelfVisible(true); + tab_contents_->SetDownloadShelfVisible(true); #else // TODO(port): Create a download shelf for mac. NOTIMPLEMENTED(); @@ -577,8 +577,8 @@ void SavePackage::CheckFinish() { &SaveFileManager::RenameAllFiles, final_names, dir, - web_contents_->process()->pid(), - web_contents_->render_view_host()->routing_id())); + tab_contents_->process()->pid(), + tab_contents_->render_view_host()->routing_id())); } // Successfully finished all items of this SavePackage. @@ -699,7 +699,7 @@ void SavePackage::SaveCanceled(SaveItem* save_item) { // the save source. Parameter process_all_remaining_items indicates whether // we need to save all remaining items. void SavePackage::SaveNextFile(bool process_all_remaining_items) { - DCHECK(web_contents_); + DCHECK(tab_contents_); DCHECK(waiting_item_queue_.size()); do { @@ -715,8 +715,8 @@ void SavePackage::SaveNextFile(bool process_all_remaining_items) { save_item->Start(); file_manager_->SaveURL(save_item->url(), save_item->referrer(), - web_contents_->process()->pid(), - web_contents_->render_view_host()->routing_id(), + tab_contents_->process()->pid(), + tab_contents_->render_view_host()->routing_id(), save_item->save_source(), save_item->full_path(), request_context_.get(), @@ -827,7 +827,7 @@ void SavePackage::GetSerializedHtmlDataForCurrentPageWithLocalLinks() { // Get the relative directory name. FilePath relative_dir_name = saved_main_directory_path_.BaseName(); - web_contents_->render_view_host()-> + tab_contents_->render_view_host()-> GetSerializedHtmlDataForCurrentPageWithLocalLinks( saved_links, saved_file_paths, relative_dir_name); } @@ -902,7 +902,7 @@ void SavePackage::GetAllSavableResourceLinksForCurrentPage() { wait_state_ = RESOURCES_LIST; GURL main_page_url(page_url_); - web_contents_->render_view_host()-> + tab_contents_->render_view_host()-> GetAllSavableResourceLinksForCurrentPage(main_page_url); } @@ -1001,12 +1001,12 @@ void SavePackage::GetSaveInfo() { SelectFileDialog::FileTypeInfo file_type_info; FilePath::StringType default_extension; FilePath title = - FilePath::FromWStringHack(UTF16ToWideHack(web_contents_->GetTitle())); + FilePath::FromWStringHack(UTF16ToWideHack(tab_contents_->GetTitle())); FilePath suggested_path = - GetSuggestNameForSaveAs(web_contents_->profile()->GetPrefs(), title); + GetSuggestNameForSaveAs(tab_contents_->profile()->GetPrefs(), title); SavePackageParam* save_params = - new SavePackageParam(web_contents_->contents_mime_type()); + new SavePackageParam(tab_contents_->contents_mime_type()); // If the contents can not be saved as complete-HTML, do not show the // file filters. @@ -1039,7 +1039,7 @@ void SavePackage::GetSaveInfo() { file_type_index, default_extension, platform_util::GetTopLevel( - web_contents_->GetNativeView()), + tab_contents_->GetNativeView()), save_params); } else { // Just use 'suggested_path' instead of opening the dialog prompt. @@ -1054,7 +1054,7 @@ void SavePackage::ContinueSave(SavePackageParam* param, int index) { // Ensure the filename is safe. param->saved_main_file_path = final_name; - DownloadManager* dlm = web_contents_->profile()->GetDownloadManager(); + DownloadManager* dlm = tab_contents_->profile()->GetDownloadManager(); DCHECK(dlm); dlm->GenerateSafeFilename(param->current_tab_mime_type, ¶m->saved_main_file_path); @@ -1063,7 +1063,7 @@ void SavePackage::ContinueSave(SavePackageParam* param, DCHECK(index > 0 && index < 3); param->dir = param->saved_main_file_path.DirName(); - PrefService* prefs = web_contents_->profile()->GetPrefs(); + PrefService* prefs = tab_contents_->profile()->GetPrefs(); StringPrefMember save_file_path; save_file_path.Init(prefs::kSaveFileDefaultDirectory, prefs, NULL); // If user change the default saving directory, we will remember it just diff --git a/chrome/browser/download/save_package.h b/chrome/browser/download/save_package.h index 8feabd3..698fa60 100644 --- a/chrome/browser/download/save_package.h +++ b/chrome/browser/download/save_package.h @@ -29,9 +29,9 @@ class GURL; class MessageLoop; class PrefService; class Profile; -class WebContents; +class TabContents; class URLRequestContext; -class WebContents; +class TabContents; namespace base { class Thread; @@ -83,12 +83,12 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage>, // Constructor for user initiated page saving. This constructor results in a // SavePackage that will generate and sanitize a suggested name for the user // in the "Save As" dialog box. - SavePackage(WebContents* web_content); + SavePackage(TabContents* web_content); // This contructor is used only for testing. We can bypass the file and // directory name generation / sanitization by providing well known paths // better suited for tests. - SavePackage(WebContents* web_content, + SavePackage(TabContents* web_content, SavePackageType save_type, const FilePath& file_full_path, const FilePath& directory_full_path); @@ -259,7 +259,7 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage>, // Non-owning pointer for handling file writing on the file thread. SaveFileManager* file_manager_; - WebContents* web_contents_; + TabContents* tab_contents_; // We use a fake DownloadItem here in order to reuse the DownloadItemView. // This class owns the pointer. diff --git a/chrome/browser/encoding_menu_controller_delegate.cc b/chrome/browser/encoding_menu_controller_delegate.cc index 62572d0..5c9088f 100644 --- a/chrome/browser/encoding_menu_controller_delegate.cc +++ b/chrome/browser/encoding_menu_controller_delegate.cc @@ -9,7 +9,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/character_encoding.h" #include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" @@ -26,9 +26,7 @@ bool EncodingMenuControllerDelegate::IsItemChecked(int id) const { TabContents* current_tab = browser_->GetSelectedTabContents(); if (!current_tab) return false; - std::wstring encoding; - if (current_tab->AsWebContents()) - encoding = current_tab->AsWebContents()->encoding(); + std::wstring encoding = current_tab->encoding(); if (encoding.empty()) encoding = profile->GetPrefs()->GetString(prefs::kDefaultCharset); switch (id) { diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 509810b..8cfec94 100755 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -15,7 +15,7 @@ #include "chrome/browser/renderer_host/render_widget_host.h" #include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/tab_contents/site_instance.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" @@ -105,7 +105,7 @@ RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() const { // must be const (no good reason for it as far as I can tell) which means you // can't return self without doing this const_cast. Either we need to change // the interface, or we need to split out the view delegate into another - // object (which is how WebContents works). + // object (which is how TabContents works). return const_cast<ExtensionHost*>(this); } @@ -125,7 +125,7 @@ void ExtensionHost::ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { - WebContents* contents = delegate_view_helper_.GetCreatedWindow(route_id); + TabContents* contents = delegate_view_helper_.GetCreatedWindow(route_id); if (contents) { // TODO(erikkay) is it safe to pass in NULL as source? GetBrowser()->AddTabContents(contents, disposition, initial_pos, diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index d393881..9e90522 100755 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -13,7 +13,7 @@ class Extension; class ExtensionView; class RenderWidgetHost; class RenderWidgetHostView; -class WebContents; +class TabContents; struct WebPreferences; // This class is the browser component of an extension component's RenderView. diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index 95dd221..afac5c9 100755 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -14,8 +14,8 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/resource_message_filter.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" #include "chrome/common/stl_util-inl.h" @@ -163,7 +163,7 @@ void ExtensionMessageService::OpenChannelOnUIThread( channels_[GET_CHANNEL_ID(source_port_id)] = channel; std::string tab_json = "null"; - WebContents* contents = tab_util::GetWebContentsByID(source_process_id, + TabContents* contents = tab_util::GetTabContentsByID(source_process_id, source_routing_id); if (contents) { DictionaryValue* tab_value = ExtensionTabUtil::CreateTabValue(contents); diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index 64a68f7..c73bdc6 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -170,7 +170,7 @@ ExtensionsDOMHandler::~ExtensionsDOMHandler() { void ExtensionsDOMHandler::Init() { } -ExtensionsUI::ExtensionsUI(WebContents* contents) : DOMUI(contents) { +ExtensionsUI::ExtensionsUI(TabContents* contents) : DOMUI(contents) { ExtensionsService *exstension_service = GetProfile()->GetExtensionsService(); ExtensionsDOMHandler* handler = new ExtensionsDOMHandler(this, diff --git a/chrome/browser/extensions/extensions_ui.h b/chrome/browser/extensions/extensions_ui.h index 56bd08a..3d1ed7b 100644 --- a/chrome/browser/extensions/extensions_ui.h +++ b/chrome/browser/extensions/extensions_ui.h @@ -60,7 +60,7 @@ class ExtensionsDOMHandler : public DOMMessageHandler { class ExtensionsUI : public DOMUI { public: - explicit ExtensionsUI(WebContents* contents); + explicit ExtensionsUI(TabContents* contents); private: DISALLOW_COPY_AND_ASSIGN(ExtensionsUI); diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 322db1f..9fd060e 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -14,7 +14,6 @@ #include "chrome/browser/tab_contents/provisional_load_details.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/views/tab_contents_container_view.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/win_util.h" // Included for SetRootViewForHWND. @@ -68,7 +67,7 @@ bool ExternalTabContainer::Init(Profile* profile, HWND parent, DCHECK(focus_manager); focus_manager->AddKeystrokeListener(this); - tab_contents_ = new WebContents(profile, NULL, MSG_ROUTING_NONE, NULL); + tab_contents_ = new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL); tab_contents_->set_delegate(this); tab_contents_->render_view_host()->AllowExternalHostBindings(); diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h index 2718ac9..cc794a7 100644 --- a/chrome/browser/external_tab_container.h +++ b/chrome/browser/external_tab_container.h @@ -21,7 +21,7 @@ #include "chrome/views/widget/widget.h" class AutomationProvider; -class WebContents; +class TabContents; class Profile; class TabContentsContainerView; // This class serves as the container window for an external tab. @@ -47,7 +47,7 @@ class ExternalTabContainer : public TabContentsDelegate, ExternalTabContainer(AutomationProvider* automation); ~ExternalTabContainer(); - WebContents* tab_contents() const { + TabContents* tab_contents() const { return tab_contents_; } @@ -144,7 +144,7 @@ class ExternalTabContainer : public TabContentsDelegate, void OnFinalMessage(HWND window); protected: - WebContents* tab_contents_; + TabContents* tab_contents_; scoped_refptr<AutomationProvider> automation_; NotificationRegistrar registrar_; diff --git a/chrome/browser/fav_icon_helper.cc b/chrome/browser/fav_icon_helper.cc index a3c3fcc..fda769c 100644 --- a/chrome/browser/fav_icon_helper.cc +++ b/chrome/browser/fav_icon_helper.cc @@ -12,12 +12,12 @@ #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/gfx/favicon_size.h" #include "skia/ext/image_operations.h" -FavIconHelper::FavIconHelper(WebContents* web_contents) - : web_contents_(web_contents), +FavIconHelper::FavIconHelper(TabContents* tab_contents) + : tab_contents_(tab_contents), got_fav_icon_url_(false), got_fav_icon_from_history_(false), fav_icon_expired_(false) { @@ -31,7 +31,7 @@ void FavIconHelper::FetchFavIcon(const GURL& url) { fav_icon_expired_ = got_fav_icon_from_history_ = got_fav_icon_url_ = false; // Request the favicon from the history service. In parallel to this the - // renderer is going to notify us (well webcontents) when the favicon url is + // renderer is going to notify us (well TabContents) when the favicon url is // available. if (GetHistoryService()) { GetHistoryService()->GetFavIconForURL(url_, &cancelable_consumer_, @@ -62,7 +62,7 @@ void FavIconHelper::SetFavIconURL(const GURL& icon_url) { } Profile* FavIconHelper::profile() { - return web_contents_->profile(); + return tab_contents_->profile(); } HistoryService* FavIconHelper::GetHistoryService() { @@ -75,7 +75,7 @@ void FavIconHelper::SetFavIcon( const SkBitmap& image) { DownloadRequests::iterator i = download_requests_.find(download_id); if (i == download_requests_.end()) { - // Currently WebContents notifies us of ANY downloads so that it is + // Currently TabContents notifies us of ANY downloads so that it is // possible to get here. return; } @@ -122,16 +122,16 @@ void FavIconHelper::UpdateFavIcon(NavigationEntry* entry, return; entry->favicon().set_bitmap(image); - if (web_contents_->delegate()) { - web_contents_->delegate()->NavigationStateChanged( - web_contents_, TabContents::INVALIDATE_FAVICON); + if (tab_contents_->delegate()) { + tab_contents_->delegate()->NavigationStateChanged( + tab_contents_, TabContents::INVALIDATE_FAVICON); } } NavigationEntry* FavIconHelper::GetEntry() { - NavigationEntry* entry = web_contents_->controller().GetActiveEntry(); + NavigationEntry* entry = tab_contents_->controller().GetActiveEntry(); if (entry && entry->url() == url_ && - web_contents_->IsActiveEntry(entry->page_id())) { + tab_contents_->IsActiveEntry(entry->page_id())) { return entry; } // If the URL has changed out from under us (as will happen with redirects) @@ -237,7 +237,7 @@ void FavIconHelper::OnFavIconData( } void FavIconHelper::ScheduleDownload(NavigationEntry* entry) { - const int download_id = web_contents_->render_view_host()->DownloadImage( + const int download_id = tab_contents_->render_view_host()->DownloadImage( entry->favicon().url(), kFavIconSize); if (!download_id) { // Download request failed. diff --git a/chrome/browser/fav_icon_helper.h b/chrome/browser/fav_icon_helper.h index 25cb56a..3a674d5 100644 --- a/chrome/browser/fav_icon_helper.h +++ b/chrome/browser/fav_icon_helper.h @@ -18,9 +18,9 @@ class NavigationEntry; class Profile; class SkBitmap; -class WebContents; +class TabContents; -// FavIconHelper is used to fetch the favicon for WebContents. +// FavIconHelper is used to fetch the favicon for TabContents. // // FetchFavIcon requests the favicon from the history database. At this point // we only know the URL of the page, and not necessarily the url of the @@ -63,7 +63,7 @@ class WebContents; class FavIconHelper { public: - explicit FavIconHelper(WebContents* web_contents); + explicit FavIconHelper(TabContents* tab_contents); // Initiates loading the favicon for the specified url. void FetchFavIcon(const GURL& url); @@ -73,7 +73,7 @@ class FavIconHelper { void SetFavIconURL(const GURL& icon_url); // Sets the image data for the favicon. This is invoked asynchronously after - // we request the WebContents to download the favicon. + // we request the TabContents to download the favicon. void SetFavIcon(int download_id, const GURL& icon_url, const SkBitmap& image); @@ -82,7 +82,7 @@ class FavIconHelper { void FavIconDownloadFailed(int download_id); // Converts the image data to an SkBitmap and sets it on the NavigationEntry. - // If the WebContents has a delegate, it is notified of the new favicon + // If the TabContents has a delegate, it is notified of the new favicon // (INVALIDATE_FAVICON). void UpdateFavIcon(NavigationEntry* entry, const std::vector<unsigned char>& data); @@ -135,8 +135,8 @@ class FavIconHelper { // wide. Does nothing if the image is empty. SkBitmap ConvertToFavIconSize(const SkBitmap& image); - // Hosting WebContents. We callback into this when done. - WebContents* web_contents_; + // Hosting TabContents. We callback into this when done. + TabContents* tab_contents_; // Used for history requests. CancelableRequestConsumer cancelable_consumer_; @@ -145,17 +145,17 @@ class FavIconHelper { GURL url_; // Whether we got the url for the page back from the renderer. - // See "Favicon Details" in web_contents.cc for more details. + // See "Favicon Details" in tab_contents.cc for more details. bool got_fav_icon_url_; // Whether we got the initial response for the favicon back from the renderer. - // See "Favicon Details" in web_contents.cc for more details. + // See "Favicon Details" in tab_contents.cc for more details. bool got_fav_icon_from_history_; // Whether the favicon is out of date. If true, it means history knows about // the favicon, but we need to download the favicon because the icon has // expired. - // See "Favicon Details" in web_contents.cc for more details. + // See "Favicon Details" in tab_contents.cc for more details. bool fav_icon_expired_; // Requests to the renderer to download favicons. diff --git a/chrome/browser/find_backend_unittest.cc b/chrome/browser/find_backend_unittest.cc index 260e897..3b2cdcc 100644 --- a/chrome/browser/find_backend_unittest.cc +++ b/chrome/browser/find_backend_unittest.cc @@ -7,15 +7,15 @@ typedef RenderViewHostTestHarness FindBackendTest; -// This test takes two WebContents objects, searches in both of them and +// This test takes two TabContents objects, searches in both of them and // tests the internal state for find_text and find_prepopulate_text. TEST_F(FindBackendTest, InternalState) { - // Initial state for the WebContents is blank strings. + // Initial state for the TabContents is blank strings. EXPECT_EQ(string16(), contents()->find_prepopulate_text()); EXPECT_EQ(string16(), contents()->find_text()); - // Get another WebContents object ready. - TestWebContents contents2(profile_.get(), NULL); + // Get another TabContents object ready. + TestTabContents contents2(profile_.get(), NULL); // No search has still been issued, strings should be blank. EXPECT_EQ(string16(), contents()->find_prepopulate_text()); @@ -27,7 +27,7 @@ TEST_F(FindBackendTest, InternalState) { string16 search_term2 = L" but the economy "; string16 search_term3 = L" eated it. "; - // Start searching in the first WebContents. + // Start searching in the first TabContents. contents()->StartFinding(search_term1, true); // true=forward. // Pre-populate string should always match between the two, but find_text @@ -37,7 +37,7 @@ TEST_F(FindBackendTest, InternalState) { EXPECT_EQ(search_term1, contents2.find_prepopulate_text()); EXPECT_EQ(string16(), contents2.find_text()); - // Now search in the other WebContents. + // Now search in the other TabContents. contents2.StartFinding(search_term2, true); // true=forward. // Again, pre-populate string should always match between the two, but @@ -47,7 +47,7 @@ TEST_F(FindBackendTest, InternalState) { EXPECT_EQ(search_term2, contents2.find_prepopulate_text()); EXPECT_EQ(search_term2, contents2.find_text()); - // Search again in the first WebContents. + // Search again in the first TabContents. contents()->StartFinding(search_term3, true); // true=forward. // Once more, pre-populate string should always match between the two, but diff --git a/chrome/browser/find_bar.h b/chrome/browser/find_bar.h index d0ebe3a..7321113 100644 --- a/chrome/browser/find_bar.h +++ b/chrome/browser/find_bar.h @@ -15,7 +15,7 @@ class FindBarController; class FindBarTesting; class FindNotificationDetails; -class WebContents; +class TabContents; class FindBar { public: diff --git a/chrome/browser/find_bar_controller.cc b/chrome/browser/find_bar_controller.cc index fb5cf3b..07cd5e6 100644 --- a/chrome/browser/find_bar_controller.cc +++ b/chrome/browser/find_bar_controller.cc @@ -8,23 +8,23 @@ #include "chrome/browser/find_bar.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/common/notification_service.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" FindBarController::FindBarController(FindBar* find_bar) - : find_bar_(find_bar), web_contents_(NULL) { + : find_bar_(find_bar), tab_contents_(NULL) { } FindBarController::~FindBarController() { // Web contents should have been NULLed out. If not, then we're leaking // notification observers. - DCHECK(!web_contents_); + DCHECK(!tab_contents_); } void FindBarController::Show() { // Only show the animation if we're not already showing a find bar for the - // selected WebContents. - if (!web_contents_->find_ui_active()) { - web_contents_->set_find_ui_active(true); + // selected TabContents. + if (!tab_contents_->find_ui_active()) { + tab_contents_->set_find_ui_active(true); find_bar_->Show(); } find_bar_->SetFocusAndSelection(); @@ -33,55 +33,55 @@ void FindBarController::Show() { void FindBarController::EndFindSession() { find_bar_->Hide(true); - // |web_contents_| can be NULL for a number of reasons, for example when the + // |tab_contents_| can be NULL for a number of reasons, for example when the // tab is closing. We must guard against that case. See issue 8030. - if (web_contents_) { + if (tab_contents_) { // When we hide the window, we need to notify the renderer that we are done // for now, so that we can abort the scoping effort and clear all the // tickmarks and highlighting. - web_contents_->StopFinding(false); // false = don't clear selection on + tab_contents_->StopFinding(false); // false = don't clear selection on // page. - find_bar_->ClearResults(web_contents_->find_result()); + find_bar_->ClearResults(tab_contents_->find_result()); // When we get dismissed we restore the focus to where it belongs. find_bar_->RestoreSavedFocus(); } } -void FindBarController::ChangeWebContents(WebContents* contents) { - if (web_contents_) { +void FindBarController::ChangeTabContents(TabContents* contents) { + if (tab_contents_) { NotificationService::current()->RemoveObserver( this, NotificationType::FIND_RESULT_AVAILABLE, - Source<TabContents>(web_contents_)); + Source<TabContents>(tab_contents_)); NotificationService::current()->RemoveObserver( this, NotificationType::NAV_ENTRY_COMMITTED, - Source<NavigationController>(&web_contents_->controller())); + Source<NavigationController>(&tab_contents_->controller())); find_bar_->StopAnimation(); } - web_contents_ = contents; + tab_contents_ = contents; - // Hide any visible find window from the previous tab if NULL |web_contents| + // Hide any visible find window from the previous tab if NULL |tab_contents| // is passed in or if the find UI is not active in the new tab. if (find_bar_->IsFindBarVisible() && - (!web_contents_ || !web_contents_->find_ui_active())) { + (!tab_contents_ || !tab_contents_->find_ui_active())) { find_bar_->Hide(false); } - if (web_contents_) { + if (tab_contents_) { NotificationService::current()->AddObserver( this, NotificationType::FIND_RESULT_AVAILABLE, - Source<TabContents>(web_contents_)); + Source<TabContents>(tab_contents_)); NotificationService::current()->AddObserver( this, NotificationType::NAV_ENTRY_COMMITTED, - Source<NavigationController>(&web_contents_->controller())); + Source<NavigationController>(&tab_contents_->controller())); // Find out what we should show in the find text box. Usually, this will be // the last search in this tab, but if no search has been issued in this tab // we use the last search string (from any tab). - string16 find_string = web_contents_->find_text(); + string16 find_string = tab_contents_->find_text(); if (find_string.empty()) - find_string = web_contents_->find_prepopulate_text(); + find_string = tab_contents_->find_prepopulate_text(); // Update the find bar with existing results and search text, regardless of // whether or not the find bar is visible, so that if it's subsequently @@ -90,7 +90,7 @@ void FindBarController::ChangeWebContents(WebContents* contents) { // clear the result count display when there's nothing in the box. find_bar_->SetFindText(find_string); - if (web_contents_->find_ui_active()) { + if (tab_contents_->find_ui_active()) { // A tab with a visible find bar just got selected and we need to show the // find bar but without animation since it was already animated into its // visible state. We also want to reset the window location so that @@ -104,8 +104,8 @@ void FindBarController::ChangeWebContents(WebContents* contents) { find_bar_->SetFocusAndSelection(); } - find_bar_->UpdateUIForFindResult(web_contents_->find_result(), - web_contents_->find_text()); + find_bar_->UpdateUIForFindResult(tab_contents_->find_result(), + tab_contents_->find_text()); } } @@ -118,14 +118,14 @@ void FindBarController::Observe(NotificationType type, if (type == NotificationType::FIND_RESULT_AVAILABLE) { // Don't update for notifications from TabContentses other than the one we // are actively tracking. - if (Source<TabContents>(source).ptr() == web_contents_) { - find_bar_->UpdateUIForFindResult(web_contents_->find_result(), - web_contents_->find_text()); + if (Source<TabContents>(source).ptr() == tab_contents_) { + find_bar_->UpdateUIForFindResult(tab_contents_->find_result(), + tab_contents_->find_text()); } } else if (type == NotificationType::NAV_ENTRY_COMMITTED) { NavigationController* source_controller = Source<NavigationController>(source).ptr(); - if (source_controller == &web_contents_->controller()) { + if (source_controller == &tab_contents_->controller()) { NavigationController::LoadCommittedDetails* commit_details = Details<NavigationController::LoadCommittedDetails>(details).ptr(); PageTransition::Type transition_type = @@ -139,7 +139,7 @@ void FindBarController::Observe(NotificationType type, } else { // On Reload we want to make sure FindNext is converted to a full Find // to make sure highlights for inactive matches are repainted. - web_contents_->set_find_op_aborted(true); + tab_contents_->set_find_op_aborted(true); } } } diff --git a/chrome/browser/find_bar_controller.h b/chrome/browser/find_bar_controller.h index 5cdabda..fc286ef 100644 --- a/chrome/browser/find_bar_controller.h +++ b/chrome/browser/find_bar_controller.h @@ -10,7 +10,7 @@ #include "chrome/common/notification_observer.h" class FindBar; -class WebContents; +class TabContents; class FindBarController : public NotificationObserver { public: @@ -25,12 +25,12 @@ class FindBarController : public NotificationObserver { // Ends the current session. void EndFindSession(); - // Accessor for the attached WebContents. - WebContents* web_contents() const { return web_contents_; } + // Accessor for the attached TabContents. + TabContents* tab_contents() const { return tab_contents_; } - // Changes the WebContents that this FindBar is attached to. This occurs when + // Changes the TabContents that this FindBar is attached to. This occurs when // the user switches tabs in the Browser window. |contents| can be NULL. - void ChangeWebContents(WebContents* contents); + void ChangeTabContents(TabContents* contents); // Overridden from NotificationObserver: virtual void Observe(NotificationType type, @@ -42,8 +42,8 @@ class FindBarController : public NotificationObserver { private: scoped_ptr<FindBar> find_bar_; - // The WebContents we are currently associated with. Can be NULL. - WebContents* web_contents_; + // The TabContents we are currently associated with. Can be NULL. + TabContents* tab_contents_; DISALLOW_COPY_AND_ASSIGN(FindBarController); }; diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index e240182..3c2e285 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -30,7 +30,7 @@ #include "chrome/browser/gtk/toolbar_star_toggle_gtk.h" #include "chrome/browser/location_bar.h" #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" @@ -574,10 +574,8 @@ void BrowserWindowGtk::TabSelectedAt(TabContents* old_contents, new_contents->DidBecomeSelected(); // TODO(estade): after we manage browser activation, add a check to make sure // we are the active browser before calling RestoreFocus(). - if (!browser_->tabstrip_model()->closing_all() && - new_contents->AsWebContents()) { - new_contents->AsWebContents()->view()->RestoreFocus(); - } + if (!browser_->tabstrip_model()->closing_all()) + new_contents->view()->RestoreFocus(); // Update all the UI bits. UpdateTitleBar(); diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc index b37d8e7..cbdd54c 100644 --- a/chrome/browser/gtk/find_bar_gtk.cc +++ b/chrome/browser/gtk/find_bar_gtk.cc @@ -14,7 +14,7 @@ #include "chrome/browser/gtk/nine_box.h" #include "chrome/browser/gtk/slide_animator_gtk.h" #include "chrome/browser/gtk/tab_contents_container_gtk.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/gtk_util.h" #include "chrome/common/l10n_util.h" #include "grit/generated_resources.h" @@ -117,7 +117,7 @@ void FindBarGtk::InitWidgets() { 0, false, NULL)); // |fixed_| has to be at least one pixel tall. We color this pixel the same - // color as the border that separates the toolbar from the web contents. + // color as the border that separates the toolbar from the tab contents. fixed_.Own(gtk_fixed_new()); border_ = gtk_event_box_new(); gtk_widget_set_size_request(border_, 1, 1); @@ -249,17 +249,17 @@ void FindBarGtk::AssureOnTop() { } void FindBarGtk::ContentsChanged() { - WebContents* web_contents = find_bar_controller_->web_contents(); - if (!web_contents) + TabContents* tab_contents = find_bar_controller_->tab_contents(); + if (!tab_contents) return; std::string new_contents(gtk_entry_get_text(GTK_ENTRY(find_text_))); if (new_contents.length() > 0) { - web_contents->StartFinding(UTF8ToUTF16(new_contents), true); + tab_contents->StartFinding(UTF8ToUTF16(new_contents), true); } else { // The textbox is empty so we reset. - web_contents->StopFinding(true); // true = clear selection on page. + tab_contents->StopFinding(true); // true = clear selection on page. } } @@ -275,7 +275,7 @@ void FindBarGtk::OnButtonPressed(GtkWidget* button, FindBarGtk* find_bar) { button == find_bar->find_next_button_->widget()) { std::string find_text_utf8( gtk_entry_get_text(GTK_ENTRY(find_bar->find_text_))); - find_bar->find_bar_controller_->web_contents()->StartFinding( + find_bar->find_bar_controller_->tab_contents()->StartFinding( UTF8ToUTF16(find_text_utf8), button == find_bar->find_next_button_->widget()); } else { diff --git a/chrome/browser/gtk/find_bar_gtk.h b/chrome/browser/gtk/find_bar_gtk.h index 90b0338..d1ec9ce 100644 --- a/chrome/browser/gtk/find_bar_gtk.h +++ b/chrome/browser/gtk/find_bar_gtk.h @@ -17,7 +17,6 @@ class CustomDrawButton; class FindBarController; class SlideAnimatorGtk; class TabContentsContainerGtk; -class WebContents; // Currently this class contains both a model and a view. We may want to // eventually pull out the model specific bits and share with Windows. diff --git a/chrome/browser/gtk/tab_contents_container_gtk.cc b/chrome/browser/gtk/tab_contents_container_gtk.cc index c4563bb..4c2ea19 100644 --- a/chrome/browser/gtk/tab_contents_container_gtk.cc +++ b/chrome/browser/gtk/tab_contents_container_gtk.cc @@ -6,7 +6,7 @@ #include "base/gfx/native_widget_types.h" #include "chrome/browser/gtk/find_bar_gtk.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" #include "chrome/common/notification_service.h" @@ -72,15 +72,15 @@ void TabContentsContainerGtk::Observe(NotificationType type, void TabContentsContainerGtk::AddObservers() { DCHECK(tab_contents_); - if (tab_contents_->AsWebContents()) { - // WebContents can change their RenderViewHost and hence the GtkWidget that - // is shown. I'm not entirely sure that we need to observe this event under - // GTK, but am putting a stub implementation and a comment saying that if - // we crash after that NOTIMPLEMENTED(), we'll need it. - NotificationService::current()->AddObserver( - this, NotificationType::RENDER_VIEW_HOST_CHANGED, - Source<NavigationController>(&tab_contents_->controller())); - } + + // TabContents can change their RenderViewHost and hence the GtkWidget that + // is shown. I'm not entirely sure that we need to observe this event under + // GTK, but am putting a stub implementation and a comment saying that if + // we crash after that NOTIMPLEMENTED(), we'll need it. + NotificationService::current()->AddObserver( + this, NotificationType::RENDER_VIEW_HOST_CHANGED, + Source<NavigationController>(&tab_contents_->controller())); + NotificationService::current()->AddObserver( this, NotificationType::TAB_CONTENTS_DESTROYED, @@ -89,12 +89,12 @@ void TabContentsContainerGtk::AddObservers() { void TabContentsContainerGtk::RemoveObservers() { DCHECK(tab_contents_); - if (tab_contents_->AsWebContents()) { - NotificationService::current()->RemoveObserver( - this, - NotificationType::RENDER_VIEW_HOST_CHANGED, - Source<NavigationController>(&tab_contents_->controller())); - } + + NotificationService::current()->RemoveObserver( + this, + NotificationType::RENDER_VIEW_HOST_CHANGED, + Source<NavigationController>(&tab_contents_->controller())); + NotificationService::current()->RemoveObserver( this, NotificationType::TAB_CONTENTS_DESTROYED, diff --git a/chrome/browser/gtk/tab_contents_container_gtk.h b/chrome/browser/gtk/tab_contents_container_gtk.h index d57adae..5ddad17 100644 --- a/chrome/browser/gtk/tab_contents_container_gtk.h +++ b/chrome/browser/gtk/tab_contents_container_gtk.h @@ -52,7 +52,7 @@ class TabContentsContainerGtk : public NotificationObserver { TabContents* tab_contents_; // We keep a GtkVBox which is inserted into this object's owner's GtkWidget - // hierarchy. We then insert and remove WebContents GtkWidgets into this + // hierarchy. We then insert and remove TabContents GtkWidgets into this // vbox_. GtkWidget* vbox_; diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h index 3804b8e..7505fd4 100644 --- a/chrome/browser/history/history.h +++ b/chrome/browser/history/history.h @@ -143,8 +143,8 @@ class HistoryService : public CancelableRequestProvider, // IDs are only unique inside a given render process, so we need that to // differentiate them. This pointer should not be dereferenced by the history // system. Since render view host pointers may be reused (if one gets deleted - // and a new one created at the same address), WebContents should notify - // us when they are being destroyed through NotifyWebContentsDestruction. + // and a new one created at the same address), TabContents should notify + // us when they are being destroyed through NotifyTabContentsDestruction. // // The scope/ids can be NULL if there is no meaningful tracking information // that can be performed on the given URL. The 'page_id' should be the ID of diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc index 51cc6a8..467a269 100644 --- a/chrome/browser/history/text_database_manager.cc +++ b/chrome/browser/history/text_database_manager.cc @@ -180,7 +180,7 @@ void TextDatabaseManager::AddPageTitle(const GURL& url, if (found == recent_changes_.end()) { // This page is not in our cache of recent pages. This is very much an edge // case as normally a title will come in <20 seconds after the page commits, - // and WebContents will avoid spamming us with >1 title per page. However, + // and TabContents will avoid spamming us with >1 title per page. However, // it could come up if your connection is unhappy, and we don't want to // miss anything. // diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc index e0e2637..71b7d3d 100644 --- a/chrome/browser/jsmessage_box_handler.cc +++ b/chrome/browser/jsmessage_box_handler.cc @@ -8,7 +8,7 @@ #include "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/message_box_flags.h" @@ -29,7 +29,7 @@ std::wstring MakeTextSafe(const std::wstring& text) { return text; } -std::wstring GetWindowTitle(WebContents* web_contents, const GURL& frame_url, +std::wstring GetWindowTitle(TabContents* tab_contents, const GURL& frame_url, int dialog_flags) { bool is_alert = (dialog_flags == MessageBoxFlags::kIsJavascriptAlert); if (!frame_url.has_host()) @@ -49,7 +49,7 @@ std::wstring GetWindowTitle(WebContents* web_contents, const GURL& frame_url, // TODO(brettw) it should be easier than this to do the correct language // handling without getting the accept language from the profile. std::wstring base_address = gfx::ElideUrl(clean_url, ChromeFont(), 0, - web_contents->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); + tab_contents->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); // Force URL to have LTR directionality. if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) l10n_util::WrapStringWithLTRFormatting(&base_address); @@ -60,27 +60,27 @@ std::wstring GetWindowTitle(WebContents* web_contents, const GURL& frame_url, } -void RunJavascriptMessageBox(WebContents* web_contents, +void RunJavascriptMessageBox(TabContents* tab_contents, const GURL& frame_url, int dialog_flags, const std::wstring& message_text, const std::wstring& default_prompt_text, bool display_suppress_checkbox, IPC::Message* reply_msg) { - std::wstring title = GetWindowTitle(web_contents, frame_url, dialog_flags); - AppModalDialogQueue::AddDialog(new AppModalDialog(web_contents, title, + std::wstring title = GetWindowTitle(tab_contents, frame_url, dialog_flags); + AppModalDialogQueue::AddDialog(new AppModalDialog(tab_contents, title, dialog_flags, MakeTextSafe(message_text), default_prompt_text, display_suppress_checkbox, false, reply_msg)); } -void RunBeforeUnloadDialog(WebContents* web_contents, +void RunBeforeUnloadDialog(TabContents* tab_contents, const std::wstring& message_text, IPC::Message* reply_msg) { std::wstring full_message = message_text + L"\n\n" + l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER); AppModalDialogQueue::AddDialog(new AppModalDialog( - web_contents, l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE), + tab_contents, l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE), MessageBoxFlags::kIsJavascriptConfirm, MakeTextSafe(message_text), std::wstring(), false, true, reply_msg)); } diff --git a/chrome/browser/jsmessage_box_handler.h b/chrome/browser/jsmessage_box_handler.h index 86e7b70..a4c0bdb 100644 --- a/chrome/browser/jsmessage_box_handler.h +++ b/chrome/browser/jsmessage_box_handler.h @@ -10,7 +10,7 @@ #include "chrome/common/ipc_message.h" class GURL; -class WebContents; +class TabContents; // Creates and runs a Javascript Message Box dialog. // The dialog type is specified within |dialog_flags|, the @@ -18,7 +18,7 @@ class WebContents; // a user input prompt() box, the default text for the text field is in // |default_prompt_text|. The result of the operation is returned using // |reply_msg|. -void RunJavascriptMessageBox(WebContents* web_contents, +void RunJavascriptMessageBox(TabContents* tab_contents, const GURL& frame_url, int dialog_flags, const std::wstring& message_text, @@ -30,7 +30,7 @@ void RunJavascriptMessageBox(WebContents* web_contents, // the user if they wish to navigate away from a page, with additional text // |message_text| between the header and footer. The users response is // returned to the renderer using |reply_msg|. -void RunBeforeUnloadDialog(WebContents* web_contents, +void RunBeforeUnloadDialog(TabContents* tab_contents, const std::wstring& message_text, IPC::Message* reply_msg); diff --git a/chrome/browser/login_prompt.cc b/chrome/browser/login_prompt.cc index fcf9696..8a52d5d 100644 --- a/chrome/browser/login_prompt.cc +++ b/chrome/browser/login_prompt.cc @@ -14,7 +14,7 @@ #include "chrome/browser/tab_contents/constrained_window.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/views/login_view.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/l10n_util.h" @@ -107,11 +107,11 @@ class LoginHandlerImpl : public LoginHandler, SendNotifications(); } - // Returns the WebContents that needs authentication. - WebContents* GetWebContentsForLogin() { + // Returns the TabContents that needs authentication. + TabContents* GetTabContentsForLogin() { DCHECK(MessageLoop::current() == ui_loop_); - return tab_util::GetWebContentsByID(render_process_host_id_, + return tab_util::GetTabContentsByID(render_process_host_id_, tab_contents_id_); } @@ -263,7 +263,7 @@ class LoginHandlerImpl : public LoginHandler, DCHECK(MessageLoop::current() == ui_loop_); NotificationService* service = NotificationService::current(); - WebContents* requesting_contents = GetWebContentsForLogin(); + TabContents* requesting_contents = GetTabContentsForLogin(); if (!requesting_contents) return; @@ -309,7 +309,7 @@ class LoginHandlerImpl : public LoginHandler, PasswordForm password_form_; // Points to the password manager owned by the TabContents requesting auth. - // Can be null if the TabContents is not a WebContents. + // Can be null if the TabContents is not a TabContents. // This should only be accessed on the ui_loop_. PasswordManager* password_manager_; @@ -336,7 +336,7 @@ class LoginDialogTask : public Task { } void Run() { - WebContents* parent_contents = handler_->GetWebContentsForLogin(); + TabContents* parent_contents = handler_->GetTabContentsForLogin(); if (!parent_contents) { // The request was probably cancelled. return; @@ -352,7 +352,7 @@ class LoginDialogTask : public Task { // Tell the password manager to look for saved passwords. PasswordManager* password_manager = - parent_contents->AsWebContents()->GetPasswordManager(); + parent_contents->GetPasswordManager(); // Set the model for the login view. The model (password manager) is owned // by the view's parent TabContents, so natural destruction order means we // don't have to worry about calling SetModel(NULL), because the view will diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 362bedc..eae7f73 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -11,7 +11,7 @@ #include "chrome/browser/chrome_thread.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/child_process_host.h" #include "chrome/common/url_constants.h" @@ -219,7 +219,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() { RenderViewHost* host = static_cast<RenderViewHost*>(widget); TabContents* contents = NULL; if (host->delegate()) - contents = host->delegate()->GetAsWebContents(); + contents = host->delegate()->GetAsTabContents(); if (!contents) continue; std::wstring title = UTF16ToWideHack(contents->GetTitle()); diff --git a/chrome/browser/modal_html_dialog_delegate.cc b/chrome/browser/modal_html_dialog_delegate.cc index 54be702..12cc713 100644 --- a/chrome/browser/modal_html_dialog_delegate.cc +++ b/chrome/browser/modal_html_dialog_delegate.cc @@ -6,18 +6,18 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" ModalHtmlDialogDelegate::ModalHtmlDialogDelegate( const GURL& url, int width, int height, const std::string& json_arguments, - IPC::Message* sync_result, WebContents* contents) + IPC::Message* sync_result, TabContents* contents) : contents_(contents), sync_response_(sync_result) { - // Listen for when the WebContents or its renderer dies. + // Listen for when the TabContents or its renderer dies. NotificationService::current()-> - AddObserver(this, NotificationType::WEB_CONTENTS_DISCONNECTED, - Source<WebContents>(contents_)); + AddObserver(this, NotificationType::TAB_CONTENTS_DISCONNECTED, + Source<TabContents>(contents_)); // This information is needed to show the dialog HTML content. params_.url = url; @@ -33,8 +33,8 @@ ModalHtmlDialogDelegate::~ModalHtmlDialogDelegate() { void ModalHtmlDialogDelegate::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::WEB_CONTENTS_DISCONNECTED); - DCHECK(Source<WebContents>(source).ptr() == contents_); + DCHECK(type == NotificationType::TAB_CONTENTS_DISCONNECTED); + DCHECK(Source<TabContents>(source).ptr() == contents_); RemoveObserver(); } @@ -56,7 +56,7 @@ std::string ModalHtmlDialogDelegate::GetDialogArgs() const { } void ModalHtmlDialogDelegate::OnDialogClosed(const std::string& json_retval) { - // Our WebContents may have died before this point. + // Our TabContents may have died before this point. if (contents_ && contents_->render_view_host()) { contents_->render_view_host()->ModalHTMLDialogClosed(sync_response_, json_retval); @@ -72,7 +72,7 @@ void ModalHtmlDialogDelegate::RemoveObserver() { NotificationService::current()->RemoveObserver( this, - NotificationType::WEB_CONTENTS_DISCONNECTED, - Source<WebContents>(contents_)); + NotificationType::TAB_CONTENTS_DISCONNECTED, + Source<TabContents>(contents_)); contents_ = NULL; // No longer safe to access. } diff --git a/chrome/browser/modal_html_dialog_delegate.h b/chrome/browser/modal_html_dialog_delegate.h index a17679f..f2822e3 100644 --- a/chrome/browser/modal_html_dialog_delegate.h +++ b/chrome/browser/modal_html_dialog_delegate.h @@ -21,7 +21,7 @@ class ModalHtmlDialogDelegate int width, int height, const std::string& json_arguments, IPC::Message* sync_result, - WebContents* contents); + TabContents* contents); ~ModalHtmlDialogDelegate(); // Notification service callback. @@ -39,12 +39,12 @@ class ModalHtmlDialogDelegate private: // Invoked from the destructor or when we receive notification the web - // contents has been disconnnected. Removes the observer from the WebContents + // contents has been disconnnected. Removes the observer from the TabContents // and NULLs out contents_. void RemoveObserver(); - // The WebContents that opened the dialog. - WebContents* contents_; + // The TabContents that opened the dialog. + TabContents* contents_; // The parameters needed to display a modal HTML dialog. HtmlDialogUI::HtmlDialogParams params_; diff --git a/chrome/browser/navigation_controller_unittest.cc b/chrome/browser/navigation_controller_unittest.cc index 419ad2f..3b25a56 100644 --- a/chrome/browser/navigation_controller_unittest.cc +++ b/chrome/browser/navigation_controller_unittest.cc @@ -1051,7 +1051,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { navigations.push_back(TabNavigation(0, url, GURL(), ASCIIToUTF16("Title"), "state", PageTransition::LINK)); - WebContents our_contents(profile(), NULL, MSG_ROUTING_NONE, NULL); + TabContents our_contents(profile(), NULL, MSG_ROUTING_NONE, NULL); NavigationController& our_controller = our_contents.controller(); our_controller.RestoreFromState(navigations, 0); our_controller.GoToIndex(0); diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h index f775297..217b304 100644 --- a/chrome/browser/printing/print_job.h +++ b/chrome/browser/printing/print_job.h @@ -122,7 +122,7 @@ class PrintJob : public base::RefCountedThreadSafe<PrintJob>, // thread. MessageLoop* const ui_message_loop_; - // Source that generates the PrintedPage's (i.e. a WebContents). It will be + // Source that generates the PrintedPage's (i.e. a TabContents). It will be // set back to NULL if the source is deleted before this object. PrintedPagesSource* source_; diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index 4bbc4ce..930c0be 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -11,7 +11,7 @@ #include "chrome/browser/printing/printer_query.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/gfx/emf.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" @@ -22,7 +22,7 @@ using base::TimeDelta; namespace printing { -PrintViewManager::PrintViewManager(WebContents& owner) +PrintViewManager::PrintViewManager(TabContents& owner) : owner_(owner), waiting_to_print_(false), inside_inner_message_loop_(false) { @@ -205,7 +205,7 @@ bool PrintViewManager::RenderAllMissingPagesNow() { return true; } - // WebContents is either dying or a second consecutive request to print + // TabContents is either dying or a second consecutive request to print // happened before the first had time to finish. We need to render all the // pages in an hurry if a print_job_ is still pending. No need to wait for it // to actually spool the pages, only to have the renderer generate them. Run @@ -303,7 +303,7 @@ void PrintViewManager::TerminatePrintJob(bool cancel) { DCHECK(!print_job_->document() || print_job_->document()->IsComplete() || !waiting_to_print_); - // WebContents is either dying or navigating elsewhere. We need to render + // TabContents is either dying or navigating elsewhere. We need to render // all the pages in an hurry if a print job is still pending. This does the // trick since it runs a blocking message loop: print_job_->Stop(); diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h index 918b99b..aec2601 100644 --- a/chrome/browser/printing/print_view_manager.h +++ b/chrome/browser/printing/print_view_manager.h @@ -10,7 +10,7 @@ #include "chrome/common/notification_observer.h" class RenderViewHost; -class WebContents; +class TabContents; struct ViewHostMsg_DidPrintPage_Params; namespace printing { @@ -19,12 +19,12 @@ class JobEventDetails; class PrintJob; class PrintJobWorkerOwner; -// Manages the print commands in relation to a WebContents. WebContents +// Manages the print commands in relation to a TabContents. TabContents // delegates a few printing related commands to this instance. class PrintViewManager : public NotificationObserver, public PrintedPagesSource { public: - PrintViewManager(WebContents& owner); + PrintViewManager(TabContents& owner); virtual ~PrintViewManager(); // Cancels the print job. @@ -119,7 +119,7 @@ class PrintViewManager : public NotificationObserver, // PrintViewManager is created as an extension of WebContent specialized for // printing-related behavior. Still, access to the renderer is needed so a // back reference is kept the the "parent object". - WebContents& owner_; + TabContents& owner_; DISALLOW_COPY_AND_ASSIGN(PrintViewManager); }; diff --git a/chrome/browser/printing/printed_document.h b/chrome/browser/printing/printed_document.h index 00d4c88..fadfbd6 100644 --- a/chrome/browser/printing/printed_document.h +++ b/chrome/browser/printing/printed_document.h @@ -112,7 +112,7 @@ class PrintedDocument : public base::RefCountedThreadSafe<PrintedDocument> { struct Mutable { Mutable(PrintedPagesSource* source); - // Source that generates the PrintedPage's (i.e. a WebContents). It will be + // Source that generates the PrintedPage's (i.e. a TabContents). It will be // set back to NULL if the source is deleted before this object. PrintedPagesSource* source_; diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h index b7e3631..d9e9fe4 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.h +++ b/chrome/browser/renderer_host/browser_render_process_host.h @@ -25,7 +25,7 @@ class CommandLine; class GURL; class RendererMainThread; class RenderWidgetHelper; -class WebContents; +class TabContents; namespace gfx { class Size; @@ -42,7 +42,7 @@ class Size; // // This object communicates back and forth with the RenderProcess object // running in the renderer process. Each RenderProcessHost and RenderProcess -// keeps a list of RenderView (renderer) and WebContents (browser) which +// keeps a list of RenderView (renderer) and TabContents (browser) which // are correlated with IDs. This way, the Views and the corresponding ViewHosts // communicate through the two process objects. class BrowserRenderProcessHost : public RenderProcessHost, diff --git a/chrome/browser/renderer_host/cross_site_resource_handler.cc b/chrome/browser/renderer_host/cross_site_resource_handler.cc index 1e25f17..5064a34 100644 --- a/chrome/browser/renderer_host/cross_site_resource_handler.cc +++ b/chrome/browser/renderer_host/cross_site_resource_handler.cc @@ -8,11 +8,11 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" namespace { -// Task to notify the WebContents that a cross-site response has begun, so that -// WebContents can tell the old page to run its onunload handler. +// Task to notify the TabContents that a cross-site response has begun, so that +// TabContents can tell the old page to run its onunload handler. class CrossSiteNotifyTabTask : public Task { public: CrossSiteNotifyTabTask(int render_process_host_id, @@ -48,10 +48,10 @@ class CancelPendingRenderViewTask : public Task { render_view_id_(render_view_id) {} void Run() { - WebContents* web_contents = - tab_util::GetWebContentsByID(render_process_host_id_, render_view_id_); - if (web_contents) - web_contents->CrossSiteNavigationCanceled(); + TabContents* tab_contents = + tab_util::GetTabContentsByID(render_process_host_id_, render_view_id_); + if (tab_contents) + tab_contents->CrossSiteNavigationCanceled(); } private: @@ -174,7 +174,7 @@ bool CrossSiteResourceHandler::OnResponseCompleted( } // We can now send the response to the new renderer, which will cause -// WebContents to swap in the new renderer and destroy the old one. +// TabContents to swap in the new renderer and destroy the old one. void CrossSiteResourceHandler::ResumeResponse() { DCHECK(request_id_ != -1); DCHECK(in_cross_site_transition_); diff --git a/chrome/browser/renderer_host/cross_site_resource_handler.h b/chrome/browser/renderer_host/cross_site_resource_handler.h index 2ae2c75..b741aa0 100644 --- a/chrome/browser/renderer_host/cross_site_resource_handler.h +++ b/chrome/browser/renderer_host/cross_site_resource_handler.h @@ -32,7 +32,7 @@ class CrossSiteResourceHandler : public ResourceHandler { const std::string& security_info); // We can now send the response to the new renderer, which will cause - // WebContents to swap in the new renderer and destroy the old one. + // TabContents to swap in the new renderer and destroy the old one. void ResumeResponse(); private: diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index c3d7aeb..5a0a0cf 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -25,7 +25,7 @@ #include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/site_instance.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/bindings_policy.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" @@ -219,7 +219,7 @@ void RenderViewHost::DoNavigate(ViewMsg_Navigate* nav_message) { if (navigations_suspended_) { // Shouldn't be possible to have a second navigation while suspended, since // navigations will only be suspended during a cross-site request. If a - // second navigation occurs, WebContents will cancel this pending RVH + // second navigation occurs, TabContents will cancel this pending RVH // create a new pending RVH. DCHECK(!suspended_nav_message_.get()); suspended_nav_message_.reset(nav_message); diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index b86b5f5..b43e3ce 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -60,16 +60,16 @@ struct WebApplicationInfo; // // The intent of this class is to provide a view-agnostic communication // conduit with a renderer. This is so we can build HTML views not only as -// TabContents (see WebContents for an example) but also as views, etc. +// TabContents (see TabContents for an example) but also as views, etc. // // The exact API of this object needs to be more thoroughly designed. Right -// now it mimics what WebContents exposed, which is a fairly large API and may +// now it mimics what TabContents exposed, which is a fairly large API and may // contain things that are not relevant to a common subset of views. See also // the comment in render_view_host_delegate.h about the size and scope of the // delegate API. // // Right now, the concept of page navigation (both top level and frame) exists -// in the WebContents still, so if you instantiate one of these elsewhere, you +// in the TabContents still, so if you instantiate one of these elsewhere, you // will not be able to traverse pages back and forward. We need to determine // if we want to bring that and other functionality down into this object so // it can be shared by others. @@ -599,8 +599,8 @@ class RenderViewHost : public RenderWidgetHost { bool navigations_suspended_; // We only buffer a suspended navigation message while we a pending RVH for a - // WebContents. There will only ever be one suspended navigation, because - // WebContents will destroy the pending RVH and create a new one if a second + // TabContents. There will only ever be one suspended navigation, because + // TabContents will destroy the pending RVH and create a new one if a second // navigation occurs. scoped_ptr<ViewMsg_Navigate> suspended_nav_message_; diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h index fe49c4d..a52196e 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -28,7 +28,7 @@ class Profile; class RenderProcessHost; class RenderViewHost; class SkBitmap; -class WebContents; +class TabContents; class WebKeyboardEvent; struct ThumbnailScore; struct ContextMenuParams; @@ -56,7 +56,7 @@ struct WebApplicationInfo; // of the RenderViewHost. // // This interface currently encompasses every type of message that was -// previously being sent by WebContents itself. Some of these notifications +// previously being sent by TabContents itself. Some of these notifications // may not be relevant to all users of RenderViewHost and we should consider // exposing a more generic Send function on RenderViewHost and a response // listener here to serve that need. @@ -158,8 +158,8 @@ class RenderViewHostDelegate { return NULL; } - // Return this object cast to a WebContents, if it is one. - virtual WebContents* GetAsWebContents() { return NULL; } + // Return this object cast to a TabContents, if it is one. + virtual TabContents* GetAsTabContents() { return NULL; } // The RenderView is being constructed (message sent to the renderer process // to construct a RenderView). Now is a good time to send other setup events diff --git a/chrome/browser/renderer_host/render_widget_helper.h b/chrome/browser/renderer_host/render_widget_helper.h index e1b306e..0e1641b 100644 --- a/chrome/browser/renderer_host/render_widget_helper.h +++ b/chrome/browser/renderer_host/render_widget_helper.h @@ -65,7 +65,7 @@ class ResourceDispatcherHost; // is restored, it can be momentarily without a backingstore. (Restoring a // RenderWidgetHost results in a WasRestored message being sent to the // RenderWidget, which triggers a full PaintRect message.) This can lead to -// an observed rendering glitch as the WebContents will just have to fill +// an observed rendering glitch as the TabContents will just have to fill // white overtop the RenderWidgetHost until the RenderWidgetHost receives a // PaintRect message to refresh its backingstore. // diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h index 861152a..27cb467 100644 --- a/chrome/browser/renderer_host/render_widget_host.h +++ b/chrome/browser/renderer_host/render_widget_host.h @@ -47,35 +47,35 @@ struct ViewHostMsg_ScrollRect_Params; // There are two situations in which this object, a RenderWidgetHost, can be // instantiated: // -// 1. By a WebContents as the communication conduit for a rendered web page. -// The WebContents instantiates a derived class: RenderViewHost. -// 2. By a WebContents as the communication conduit for a select widget. The -// WebContents instantiates the RenderWidgetHost directly. +// 1. By a TabContents as the communication conduit for a rendered web page. +// The TabContents instantiates a derived class: RenderViewHost. +// 2. By a TabContents as the communication conduit for a select widget. The +// TabContents instantiates the RenderWidgetHost directly. // -// For every WebContents there are several objects in play that need to be +// For every TabContents there are several objects in play that need to be // properly destroyed or cleaned up when certain events occur. // -// - WebContents - the TabContents itself, and its associated HWND. +// - TabContents - the TabContents itself, and its associated HWND. // - RenderViewHost - representing the communication conduit with the child // process. // - RenderWidgetHostView - the view of the web page content, message handler, // and plugin root. // -// Normally, the WebContents contains a child RenderWidgetHostView that renders +// Normally, the TabContents contains a child RenderWidgetHostView that renders // the contents of the loaded page. It has a WS_CLIPCHILDREN style so that it // does no painting of its own. // // The lifetime of the RenderWidgetHostView is tied to the render process. If // the render process dies, the RenderWidgetHostView goes away and all -// references to it must become NULL. If the WebContents finds itself without a +// references to it must become NULL. If the TabContents finds itself without a // RenderWidgetHostView, it paints Sad Tab instead. // // RenderViewHost (a RenderWidgetHost subclass) is the conduit used to -// communicate with the RenderView and is owned by the WebContents. If the +// communicate with the RenderView and is owned by the TabContents. If the // render process crashes, the RenderViewHost remains and restarts the render // process if needed to continue navigation. // -// The WebContents is itself owned by the NavigationController in which it +// The TabContents is itself owned by the NavigationController in which it // resides. // // Some examples of how shutdown works: @@ -84,7 +84,7 @@ struct ViewHostMsg_ScrollRect_Params; // etc) the TabStrip destroys the associated NavigationController, which calls // Destroy on each TabContents it owns. // -// For a WebContents, its Destroy method tells the RenderViewHost to +// For a TabContents, its Destroy method tells the RenderViewHost to // shut down the render process and die. // // When the render process is destroyed it destroys the View: the @@ -92,19 +92,19 @@ struct ViewHostMsg_ScrollRect_Params; // // For select popups, the situation is a little different. The RenderWidgetHost // associated with the select popup owns the view and itself (is responsible -// for destroying itself when the view is closed). The WebContents's only +// for destroying itself when the view is closed). The TabContents's only // responsibility is to select popups is to create them when it is told to. When // the View is destroyed via an IPC message (for when WebCore destroys the // popup, e.g. if the user selects one of the options), or because // WM_CANCELMODE is received by the view, the View schedules the destruction of -// the render process. However in this case since there's no WebContents +// the render process. However in this case since there's no TabContents // container, when the render process is destroyed, the RenderWidgetHost just // deletes itself, which is safe because no one else should have any references -// to it (the WebContents does not). +// to it (the TabContents does not). // // It should be noted that the RenderViewHost, not the RenderWidgetHost, // handles IPC messages relating to the render process going away, since the -// way a RenderViewHost (WebContents) handles the process dying is different to +// way a RenderViewHost (TabContents) handles the process dying is different to // the way a select popup does. As such the RenderWidgetHostView handles these // messages for select popups. This placement is more out of convenience than // anything else. When the view is live, these messages are forwarded to it by diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index d6f67fe..5058bec 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -115,7 +115,7 @@ void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { if (is_hidden_) return; - // TODO(avi): the WebContents object uses this method to size the newly + // TODO(avi): the TabContents object uses this method to size the newly // created widget to the correct size. At the time of this call, we're not yet // in the view hierarchy so |size| ends up being 0x0. However, this works for // us because we're using the Cocoa view struture and resizer flags to fix diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index d13fac4..9eb27d1 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -990,14 +990,14 @@ LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam, } // TODO(jcampan): I am not sure if we should forward the message to the - // WebContents first in the case of popups. If we do, we would need to - // convert the click from the popup window coordinates to the WebContents' + // TabContents first in the case of popups. If we do, we would need to + // convert the click from the popup window coordinates to the TabContents' // window coordinates. For now we don't forward the message in that case to // address bug #907474. // Note: GetParent() on popup windows returns the top window and not the // parent the window was created with (the parent and the owner of the popup // is the first non-child view of the view that was specified to the create - // call). So the WebContents window would have to be specified to the + // call). So the TabContents window would have to be specified to the // RenderViewHostHWND as there is no way to retrieve it from the HWND. if (!close_on_deactivate_) { // Don't forward if the container is a popup. if (message == WM_LBUTTONDOWN) { @@ -1020,7 +1020,7 @@ LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam, case WM_MOUSEMOVE: case WM_MOUSELEAVE: case WM_RBUTTONDOWN: { - // Give the WebContents first crack at the message. It may want to + // Give the TabContents first crack at the message. It may want to // prevent forwarding to the renderer if some higher level browser // functionality is invoked. if (SendMessage(GetParent(), message, wparam, lparam) != 0) @@ -1117,8 +1117,8 @@ LRESULT RenderWidgetHostViewWin::OnWheelEvent(UINT message, WPARAM wparam, } // This is a bit of a hack, but will work for now since we don't want to - // pollute this object with WebContents-specific functionality... - bool handled_by_webcontents = false; + // pollute this object with TabContents-specific functionality... + bool handled_by_TabContents = false; if (GetParent()) { // Use a special reflected message to break recursion. If we send // WM_MOUSEWHEEL, the focus manager subclass of web contents will @@ -1129,12 +1129,12 @@ LRESULT RenderWidgetHostViewWin::OnWheelEvent(UINT message, WPARAM wparam, new_message.wParam = wparam; new_message.lParam = lparam; - handled_by_webcontents = + handled_by_TabContents = !!::SendMessage(GetParent(), views::kReflectedMessage, 0, reinterpret_cast<LPARAM>(&new_message)); } - if (!handled_by_webcontents) { + if (!handled_by_TabContents) { render_widget_host_->ForwardWheelEvent( WebInputEventFactory::mouseWheelEvent(m_hWnd, message, wparam, lparam)); diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index 631ea6c..d78e79a 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -32,7 +32,7 @@ #include "chrome/browser/renderer_host/save_file_resource_handler.h" #include "chrome/browser/renderer_host/sync_resource_handler.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" #include "chrome/common/stl_util-inl.h" @@ -1289,7 +1289,7 @@ class NotificationTask : public Task { void Run() { // Find the tab associated with this request. TabContents* tab_contents = - tab_util::GetWebContentsByID(process_id_, tab_contents_id_); + tab_util::GetTabContentsByID(process_id_, tab_contents_id_); if (tab_contents) { // Issue the notification. diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc index 4c410e3..f3b5a07 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc @@ -291,7 +291,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) { // Check that renderer-initiated navigations still work. In a previous bug, // the ResourceDispatcherHost would think that such navigations were // cross-site, because we didn't clean up from the previous request. Since - // WebContents was in the NORMAL state, it would ignore the attempt to run + // TabContents was in the NORMAL state, it would ignore the attempt to run // the onunload handler, and the navigation would fail. // (Test by redirecting to javascript:window.location='someURL'.) GURL test_url(server->TestServerPageW(L"files/title2.html")); diff --git a/chrome/browser/renderer_host/test_render_view_host.cc b/chrome/browser/renderer_host/test_render_view_host.cc index 5117465..44001fd 100644 --- a/chrome/browser/renderer_host/test_render_view_host.cc +++ b/chrome/browser/renderer_host/test_render_view_host.cc @@ -79,16 +79,16 @@ void RenderViewHostTestHarness::SetUp() { if (!profile_.get()) profile_.reset(new TestingProfile()); - // This will be deleted when the WebContents goes away. + // This will be deleted when the TabContents goes away. SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); - contents_.reset(new TestWebContents(profile_.get(), instance)); + contents_.reset(new TestTabContents(profile_.get(), instance)); } void RenderViewHostTestHarness::TearDown() { contents_.reset(); - // Make sure that we flush any messages related to WebContents destruction + // Make sure that we flush any messages related to TabContents destruction // before we destroy the profile. MessageLoop::current()->RunAllPending(); } diff --git a/chrome/browser/renderer_host/test_render_view_host.h b/chrome/browser/renderer_host/test_render_view_host.h index 0e93526..51acf2d 100644 --- a/chrome/browser/renderer_host/test_render_view_host.h +++ b/chrome/browser/renderer_host/test_render_view_host.h @@ -23,10 +23,10 @@ #include "chrome/common/temp_scaffolding_stubs.h" #endif -class TestWebContents; +class TestTabContents; // This file provides a testing framework for mocking out the RenderProcessHost -// layer. It allows you to test RenderViewHost, WebContents, +// layer. It allows you to test RenderViewHost, TabContents, // NavigationController, and other layers above that without running an actual // renderer process. // @@ -87,8 +87,8 @@ class TestRenderWidgetHostView : public RenderWidgetHostView { // TestRenderViewHost ---------------------------------------------------------- -// TODO(brettw) this should use a TestWebContents which should be generalized -// from the WebContents test. We will probably also need that class' version of +// TODO(brettw) this should use a TestTabContents which should be generalized +// from the TabContents test. We will probably also need that class' version of // CreateRenderViewForRenderManager when more complicate tests start using this. class TestRenderViewHost : public RenderViewHost { public: @@ -193,7 +193,7 @@ class RenderViewHostTestHarness : public testing::Test { return contents_->controller(); } - TestWebContents* contents() { + TestTabContents* contents() { return contents_.get(); } @@ -234,7 +234,7 @@ class RenderViewHostTestHarness : public testing::Test { MockRenderProcessHostFactory rph_factory_; TestRenderViewHostFactory rvh_factory_; - scoped_ptr<TestWebContents> contents_; + scoped_ptr<TestTabContents> contents_; DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); }; diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index b285b05..e1a21e3 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -16,7 +16,7 @@ #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" @@ -75,9 +75,9 @@ class SafeBrowsingBlockingPageFactoryImpl public: SafeBrowsingBlockingPage* CreateSafeBrowsingPage( SafeBrowsingService* service, - WebContents* web_contents, + TabContents* tab_contents, const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) { - return new SafeBrowsingBlockingPage(service, web_contents, + return new SafeBrowsingBlockingPage(service, tab_contents, unsafe_resources); } @@ -91,9 +91,9 @@ class SafeBrowsingBlockingPageFactoryImpl SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( SafeBrowsingService* sb_service, - WebContents* web_contents, + TabContents* tab_contents, const UnsafeResourceList& unsafe_resources) - : InterstitialPage(web_contents, + : InterstitialPage(tab_contents, IsMainPage(unsafe_resources), unsafe_resources[0].url), sb_service_(sb_service), @@ -457,10 +457,10 @@ SafeBrowsingBlockingPage::UnsafeResourceMap* void SafeBrowsingBlockingPage::ShowBlockingPage( SafeBrowsingService* sb_service, const SafeBrowsingService::UnsafeResource& unsafe_resource) { - WebContents* web_contents = tab_util::GetWebContentsByID( + TabContents* tab_contents = tab_util::GetTabContentsByID( unsafe_resource.render_process_host_id, unsafe_resource.render_view_id); - if (!InterstitialPage::GetInterstitialPage(web_contents)) { + if (!InterstitialPage::GetInterstitialPage(tab_contents)) { // There are no interstitial currently showing in that tab, go ahead and // show this interstitial. std::vector<SafeBrowsingService::UnsafeResource> resources; @@ -470,7 +470,7 @@ void SafeBrowsingBlockingPage::ShowBlockingPage( if (!factory_) factory_ = Singleton<SafeBrowsingBlockingPageFactoryImpl>::get(); SafeBrowsingBlockingPage* blocking_page = - factory_->CreateSafeBrowsingPage(sb_service, web_contents, resources); + factory_->CreateSafeBrowsingPage(sb_service, tab_contents, resources); blocking_page->Show(); return; } @@ -479,7 +479,7 @@ void SafeBrowsingBlockingPage::ShowBlockingPage( // Note we only expect resources from the page at this point. DCHECK(unsafe_resource.resource_type != ResourceType::MAIN_FRAME); UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); - (*unsafe_resource_map)[web_contents].push_back(unsafe_resource); + (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); } // static diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h index be03a0f..280ffbb 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h @@ -39,7 +39,7 @@ class DictionaryValue; class MessageLoop; class NavigationController; class SafeBrowsingBlockingPageFactory; -class WebContents; +class TabContents; class SafeBrowsingBlockingPage : public InterstitialPage { public: @@ -73,7 +73,7 @@ class SafeBrowsingBlockingPage : public InterstitialPage { // Don't instanciate this class directly, use ShowBlockingPage instead. SafeBrowsingBlockingPage(SafeBrowsingService* service, - WebContents* web_contents, + TabContents* tab_contents, const UnsafeResourceList& unsafe_resources); private: @@ -96,7 +96,7 @@ class SafeBrowsingBlockingPage : public InterstitialPage { // A list of SafeBrowsingService::UnsafeResource for a tab that the user // should be warned about. They are queued when displaying more than one // interstitial at a time. - typedef std::map<WebContents*, UnsafeResourceList> UnsafeResourceMap; + typedef std::map<TabContents*, UnsafeResourceList> UnsafeResourceMap; static UnsafeResourceMap* GetUnsafeResourcesMap(); // Notifies the SafeBrowsingService on the IO thread whether to proceed or not @@ -140,7 +140,7 @@ class SafeBrowsingBlockingPageFactory { virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( SafeBrowsingService* service, - WebContents* web_contents, + TabContents* tab_contents, const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; }; diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index a7f8307..7f6390c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -36,9 +36,9 @@ static void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage { public: TestSafeBrowsingBlockingPage(SafeBrowsingService* service, - WebContents* web_contents, + TabContents* tab_contents, const UnsafeResourceList& unsafe_resources) - : SafeBrowsingBlockingPage(service, web_contents, unsafe_resources) { + : SafeBrowsingBlockingPage(service, tab_contents, unsafe_resources) { } // Overriden from InterstitialPage. Don't create a view. @@ -55,9 +55,9 @@ class TestSafeBrowsingBlockingPageFactory virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( SafeBrowsingService* service, - WebContents* web_contents, + TabContents* tab_contents, const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) { - return new TestSafeBrowsingBlockingPage(service, web_contents, + return new TestSafeBrowsingBlockingPage(service, tab_contents, unsafe_resources); } }; diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 6369b3d..bb04cbf 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -19,7 +19,7 @@ #include "chrome/browser/safe_browsing/safe_browsing_database.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" @@ -256,8 +256,8 @@ void SafeBrowsingService::DisplayBlockingPage(const GURL& url, void SafeBrowsingService::DoDisplayBlockingPage( const UnsafeResource& resource) { // The tab might have been closed. - WebContents* wc = - tab_util::GetWebContentsByID(resource.render_process_host_id, + TabContents* wc = + tab_util::GetTabContentsByID(resource.render_process_host_id, resource.render_view_id); if (!wc) { diff --git a/chrome/browser/search_engines/template_url_fetcher.h b/chrome/browser/search_engines/template_url_fetcher.h index dc042ba..f69be2d 100644 --- a/chrome/browser/search_engines/template_url_fetcher.h +++ b/chrome/browser/search_engines/template_url_fetcher.h @@ -11,7 +11,7 @@ class GURL; class Profile; class TemplateURL; -class WebContents; +class TabContents; // TemplateURLFetcher is responsible for downloading OpenSearch description // documents, creating a TemplateURL from the OSDD, and adding the TemplateURL diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index b37ecc9..e1319e9 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -14,7 +14,7 @@ #include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/session_types.h" #include "chrome/browser/tab_contents/navigation_controller.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" @@ -365,10 +365,7 @@ class SessionRestoreImpl : public NotificationObserver { browser->window()->Show(); // TODO(jcampan): http://crbug.com/8123 we should not need to set the // initial focus explicitly. - if (browser->GetSelectedTabContents()->AsWebContents()) { - browser->GetSelectedTabContents()->AsWebContents()->view()-> - SetInitialFocus(); - } + browser->GetSelectedTabContents()->view()->SetInitialFocus(); } void AppendURLsToBrowser(Browser* browser, const std::vector<GURL>& urls) { diff --git a/chrome/browser/sessions/session_types.cc b/chrome/browser/sessions/session_types.cc index 3483228..14caf79 100644 --- a/chrome/browser/sessions/session_types.cc +++ b/chrome/browser/sessions/session_types.cc @@ -13,7 +13,7 @@ NavigationEntry* TabNavigation::ToNavigationEntry(int page_id) const { NavigationEntry* entry = new NavigationEntry( NULL, // The site instance for restored tabs is sent on navigation - // (WebContents::GetSiteInstanceForEntry). + // (TabContents::GetSiteInstanceForEntry). page_id, url_, referrer_, diff --git a/chrome/browser/site_instance_unittest.cc b/chrome/browser/site_instance_unittest.cc index 7dd850f..d0068d6 100644 --- a/chrome/browser/site_instance_unittest.cc +++ b/chrome/browser/site_instance_unittest.cc @@ -7,7 +7,7 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/test_render_view_host.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/render_messages.h" #include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" @@ -69,7 +69,7 @@ class TestSiteInstance : public SiteInstance { // Test to ensure no memory leaks for SiteInstance objects. TEST_F(SiteInstanceTest, SiteInstanceDestructor) { - // The existance of these factories will cause WebContents to create our test + // The existance of these factories will cause TabContents to create our test // one instead of the real one. MockRenderProcessHostFactory rph_factory; TestRenderViewHostFactory rvh_factory(&rph_factory); @@ -113,12 +113,12 @@ TEST_F(SiteInstanceTest, SiteInstanceDestructor) { &siteDeleteCounter, &browsingDeleteCounter); { - WebContents contents(profile.get(), instance, MSG_ROUTING_NONE, NULL); + TabContents contents(profile.get(), instance, MSG_ROUTING_NONE, NULL); EXPECT_EQ(1, siteDeleteCounter); EXPECT_EQ(1, browsingDeleteCounter); } - // Make sure that we flush any messages related to the above WebContents + // Make sure that we flush any messages related to the above TabContents // destruction. MessageLoop::current()->RunAllPending(); diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 5e1e2fd..5d60cb8 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -13,7 +13,7 @@ #include "chrome/browser/ssl/ssl_error_info.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" @@ -43,7 +43,7 @@ void RecordSSLBlockingPageStats(SSLBlockingPageEvent event) { // No error happening loading a sub-resource triggers an interstitial so far. SSLBlockingPage::SSLBlockingPage(SSLManager::CertError* error, Delegate* delegate) - : InterstitialPage(error->GetWebContents(), true, error->request_url()), + : InterstitialPage(error->GetTabContents(), true, error->request_url()), error_(error), delegate_(delegate), delegate_has_been_notified_(false) { @@ -88,10 +88,9 @@ std::string SSLBlockingPage::GetHTMLContents() { } void SSLBlockingPage::UpdateEntry(NavigationEntry* entry) { - WebContents* web = tab()->AsWebContents(); const net::SSLInfo& ssl_info = error_->ssl_info(); int cert_id = CertStore::GetSharedInstance()->StoreCert( - ssl_info.cert, web->render_view_host()->process()->pid()); + ssl_info.cert, tab()->render_view_host()->process()->pid()); entry->ssl().set_security_style(SECURITY_STYLE_AUTHENTICATION_BROKEN); entry->ssl().set_cert_id(cert_id); @@ -99,7 +98,7 @@ void SSLBlockingPage::UpdateEntry(NavigationEntry* entry) { entry->ssl().set_security_bits(ssl_info.security_bits); NotificationService::current()->Notify( NotificationType::SSL_VISIBLE_STATE_CHANGED, - Source<NavigationController>(&web->controller()), + Source<NavigationController>(&tab()->controller()), NotificationService::NoDetails()); } diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 5b513d2..a6d5772 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -6,7 +6,6 @@ #include "chrome/browser/tab_contents/interstitial_page.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/test/in_process_browser_test.h" diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc index 3ff1385..7b54186 100644 --- a/chrome/browser/ssl/ssl_manager.cc +++ b/chrome/browser/ssl/ssl_manager.cc @@ -19,7 +19,6 @@ #include "chrome/browser/tab_contents/provisional_load_details.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" @@ -178,12 +177,7 @@ bool SSLManager::SetMaxSecurityStyle(SecurityStyle style) { // Delegate API method. void SSLManager::AddMessageToConsole(const string16& message, const WebConsoleMessage::Level& level) { - TabContents* tab_contents = controller_->tab_contents(); - WebContents* web_contents = tab_contents->AsWebContents(); - if (!web_contents) - return; - - web_contents->render_view_host()->AddMessageToConsole( + controller_->tab_contents()->render_view_host()->AddMessageToConsole( string16(), message, level); } @@ -279,10 +273,10 @@ SSLManager::ErrorHandler::ErrorHandler(ResourceDispatcherHost* rdh, void SSLManager::ErrorHandler::Dispatch() { DCHECK(MessageLoop::current() == ui_loop_); - TabContents* web_contents = - tab_util::GetWebContentsByID(render_process_host_id_, tab_contents_id_); + TabContents* tab_contents = + tab_util::GetTabContentsByID(render_process_host_id_, tab_contents_id_); - if (!web_contents) { + if (!tab_contents) { // We arrived on the UI thread, but the tab we're looking for is no longer // here. OnDispatchFailed(); @@ -290,12 +284,12 @@ void SSLManager::ErrorHandler::Dispatch() { } // Hand ourselves off to the SSLManager. - manager_ = web_contents->controller().ssl_manager(); + manager_ = tab_contents->controller().ssl_manager(); OnDispatched(); } -WebContents* SSLManager::ErrorHandler::GetWebContents() { - return tab_util::GetWebContentsByID(render_process_host_id_, +TabContents* SSLManager::ErrorHandler::GetTabContents() { + return tab_util::GetTabContentsByID(render_process_host_id_, tab_contents_id_); } diff --git a/chrome/browser/ssl/ssl_manager.h b/chrome/browser/ssl/ssl_manager.h index 8ad8a6a..0c940a4 100644 --- a/chrome/browser/ssl/ssl_manager.h +++ b/chrome/browser/ssl/ssl_manager.h @@ -36,7 +36,7 @@ class SSLErrorInfo; class SSLHostState; class Task; class URLRequest; -class WebContents; +class TabContents; // The SSLManager SSLManager controls the SSL UI elements in a TabContents. It // listens for various events that influence when these elements should or @@ -87,9 +87,9 @@ class SSLManager : public NotificationObserver { // Call on the UI thread. SSLManager* manager() const { return manager_; } - // Returns the WebContents this object is associated with. Should be + // Returns the TabContents this object is associated with. Should be // called from the UI thread. - WebContents* GetWebContents(); + TabContents* GetTabContents(); // Cancels the associated URLRequest. // This method can be called from OnDispatchFailed and OnDispatched. diff --git a/chrome/browser/ssl/ssl_policy.cc b/chrome/browser/ssl/ssl_policy.cc index ebe5e60..e921d42 100644 --- a/chrome/browser/ssl/ssl_policy.cc +++ b/chrome/browser/ssl/ssl_policy.cc @@ -10,9 +10,8 @@ #include "chrome/browser/cert_store.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/ssl/ssl_error_info.h" -#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" @@ -125,7 +124,7 @@ static void ShowErrorPage(SSLPolicy* policy, SSLManager::CertError* error) { std::string html_text(jstemplate_builder::GetTemplateHtml(html, &strings, "template_root")); - WebContents* tab = error->GetWebContents(); + TabContents* tab = error->GetTabContents(); int cert_id = CertStore::GetSharedInstance()->StoreCert( error->ssl_info().cert, tab->render_view_host()->process()->pid()); std::string security_info = @@ -217,7 +216,7 @@ void SSLPolicy::OnCertError(SSLManager::CertError* error) { void SSLPolicy::OnMixedContent(SSLManager::MixedContentHandler* handler) { // Get the user's mixed content preference. - PrefService* prefs = handler->GetWebContents()->profile()->GetPrefs(); + PrefService* prefs = handler->GetTabContents()->profile()->GetPrefs(); FilterPolicy::Type filter_policy = FilterPolicy::FromInt(prefs->GetInteger(prefs::kMixedContentFiltering)); diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index ca9be04..9384988 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -13,7 +13,7 @@ #include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/notification_service.h" #include "chrome/views/window/window_delegate.h" @@ -100,7 +100,7 @@ class InterstitialPage::InterstitialPageRVHViewDelegate InterstitialPage::InterstitialPageMap* InterstitialPage::tab_to_interstitial_page_ = NULL; -InterstitialPage::InterstitialPage(WebContents* tab, +InterstitialPage::InterstitialPage(TabContents* tab, bool new_navigation, const GURL& url) : tab_(tab), @@ -446,10 +446,10 @@ void InterstitialPage::InitInterstitialPageMap() { // static InterstitialPage* InterstitialPage::GetInterstitialPage( - WebContents* web_contents) { + TabContents* tab_contents) { InitInterstitialPageMap(); InterstitialPageMap::const_iterator iter = - tab_to_interstitial_page_->find(web_contents); + tab_to_interstitial_page_->find(tab_contents); if (iter == tab_to_interstitial_page_->end()) return NULL; diff --git a/chrome/browser/tab_contents/interstitial_page.h b/chrome/browser/tab_contents/interstitial_page.h index 1e35ea4..40cf6a1 100644 --- a/chrome/browser/tab_contents/interstitial_page.h +++ b/chrome/browser/tab_contents/interstitial_page.h @@ -15,7 +15,7 @@ class MessageLoop; class NavigationEntry; -class WebContents; +class TabContents; class TabContentsView; // This class is a base class for interstitial pages, pages that show some @@ -27,7 +27,7 @@ class TabContentsView; // that when the interstitial shows, the current entry is the target URL. // // InterstitialPage instances take care of deleting themselves when closed -// through a navigation, the WebContents closing them or the tab containing them +// through a navigation, the TabContents closing them or the tab containing them // being closed. enum ResourceRequestAction { @@ -45,7 +45,7 @@ class InterstitialPage : public NotificationObserver, // added to the navigation controller (so the interstitial page appears as a // new navigation entry). |new_navigation| should be false when the // interstitial was triggered by a loading a sub-resource in a page. - InterstitialPage(WebContents* tab, bool new_navigation, const GURL& url); + InterstitialPage(TabContents* tab, bool new_navigation, const GURL& url); virtual ~InterstitialPage(); // Shows the interstitial page in the tab. @@ -56,7 +56,7 @@ class InterstitialPage : public NotificationObserver, // Retrieves the InterstitialPage if any associated with the specified // |tab_contents| (used by ui tests). - static InterstitialPage* GetInterstitialPage(WebContents* web_contents); + static InterstitialPage* GetInterstitialPage(TabContents* tab_contents); // Sub-classes should return the HTML that should be displayed in the page. virtual std::string GetHTMLContents() { return std::string(); } @@ -108,7 +108,7 @@ class InterstitialPage : public NotificationObserver, // |create_navigation_entry| set to true. virtual void UpdateEntry(NavigationEntry* entry) { } - WebContents* tab() const { return tab_; } + TabContents* tab() const { return tab_; } const GURL& url() const { return url_; } RenderViewHost* render_view_host() const { return render_view_host_; } @@ -142,7 +142,7 @@ class InterstitialPage : public NotificationObserver, void TakeActionOnResourceDispatcher(ResourceRequestAction action); // The tab in which we are displayed. - WebContents* tab_; + TabContents* tab_; // The URL that is shown when the interstitial is showing. GURL url_; @@ -192,7 +192,7 @@ class InterstitialPage : public NotificationObserver, // We keep a map of the various blocking pages shown as the UI tests need to // be able to retrieve them. - typedef std::map<WebContents*,InterstitialPage*> InterstitialPageMap; + typedef std::map<TabContents*,InterstitialPage*> InterstitialPageMap; static InterstitialPageMap* tab_to_interstitial_page_; DISALLOW_COPY_AND_ASSIGN(InterstitialPage); diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index d8aca75..30dabe3 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -746,7 +746,7 @@ void NavigationController::CommitPendingEntry() { // it new again, since InsertEntry expects to take ownership and also // discard the pending entry. We also need to synthesize a page ID. We can // only do this because this function will only be called by our custom - // TabContents types. For WebContents, the IDs are generated by the + // TabContents types. For TabContents, the IDs are generated by the // renderer, so we can't do this. details.type = NavigationType::NEW_PAGE; pending_entry_->set_page_id(tab_contents_->GetMaxPageID() + 1); diff --git a/chrome/browser/tab_contents/navigation_controller.h b/chrome/browser/tab_contents/navigation_controller.h index e42f4ad..015bdaa 100644 --- a/chrome/browser/tab_contents/navigation_controller.h +++ b/chrome/browser/tab_contents/navigation_controller.h @@ -23,7 +23,7 @@ class Profile; class TabContents; class SiteInstance; class SkBitmap; -class WebContents; +class TabContents; class TabContentsCollector; class TabNavigation; struct ViewHostMsg_FrameNavigate_Params; @@ -293,7 +293,7 @@ class NavigationController { // For use by TabContents ---------------------------------------------------- // Handles updating the navigation state after the renderer has navigated. - // This is used by the WebContents. Simpler tab contents types can use + // This is used by the TabContents. Simpler tab contents types can use // CommitPendingEntry below. // // If a new entry is created, it will return true and will have filled the @@ -471,7 +471,7 @@ class NavigationController { TabContents* tab_contents_; // The max restored page ID in this controller, if it was restored. We must - // store this so that WebContents can tell any renderer in charge of one of + // store this so that TabContents can tell any renderer in charge of one of // the restored entries to update its max page ID. int max_restored_page_id_; diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index c77d8d5..228efc7 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -15,7 +15,7 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/spellchecker.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/clipboard_service.h" #include "chrome/common/l10n_util.h" @@ -31,11 +31,11 @@ #endif RenderViewContextMenu::RenderViewContextMenu( - WebContents* web_contents, + TabContents* tab_contents, const ContextMenuParams& params) : params_(params), - source_web_contents_(web_contents), - profile_(web_contents->profile()) { + source_tab_contents_(tab_contents), + profile_(tab_contents->profile()) { } RenderViewContextMenu::~RenderViewContextMenu() { @@ -203,16 +203,16 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const { // Allow Spell Check language items on sub menu for text area context menu. if ((id >= IDC_SPELLCHECK_LANGUAGES_FIRST) && (id < IDC_SPELLCHECK_LANGUAGES_LAST)) { - return source_web_contents_->profile()->GetPrefs()->GetBoolean( + return source_tab_contents_->profile()->GetPrefs()->GetBoolean( prefs::kEnableSpellCheck); } switch (id) { case IDS_CONTENT_CONTEXT_BACK: - return source_web_contents_->controller().CanGoBack(); + return source_tab_contents_->controller().CanGoBack(); case IDS_CONTENT_CONTEXT_FORWARD: - return source_web_contents_->controller().CanGoForward(); + return source_tab_contents_->controller().CanGoForward(); case IDS_CONTENT_CONTEXT_VIEWPAGESOURCE: case IDS_CONTENT_CONTEXT_VIEWFRAMESOURCE: @@ -247,7 +247,7 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const { return params_.image_url.is_valid(); case IDS_CONTENT_CONTEXT_SAVEPAGEAS: - return SavePackage::IsSavableURL(source_web_contents_->GetURL()); + return SavePackage::IsSavableURL(source_tab_contents_->GetURL()); case IDS_CONTENT_CONTEXT_OPENFRAMENEWTAB: case IDS_CONTENT_CONTEXT_OPENFRAMENEWWINDOW: @@ -275,18 +275,18 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const { return !!(params_.edit_flags & ContextNode::CAN_SELECT_ALL); case IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: - return !source_web_contents_->profile()->IsOffTheRecord() && + return !source_tab_contents_->profile()->IsOffTheRecord() && params_.link_url.is_valid(); case IDS_CONTENT_CONTEXT_OPENFRAMEOFFTHERECORD: - return !source_web_contents_->profile()->IsOffTheRecord() && + return !source_tab_contents_->profile()->IsOffTheRecord() && params_.frame_url.is_valid(); case IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY: return !params_.misspelled_word.empty(); case IDS_CONTENT_CONTEXT_VIEWPAGEINFO: - return (source_web_contents_->controller().GetActiveEntry() != NULL); + return (source_tab_contents_->controller().GetActiveEntry() != NULL); case IDS_CONTENT_CONTEXT_RELOAD: case IDS_CONTENT_CONTEXT_COPYIMAGE: @@ -303,7 +303,7 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const { return true; case IDC_CHECK_SPELLING_OF_THIS_FIELD: - return source_web_contents_->profile()->GetPrefs()->GetBoolean( + return source_tab_contents_->profile()->GetPrefs()->GetBoolean( prefs::kEnableSpellCheck); case IDS_CONTENT_CONTEXT_SAVEFRAMEAS: @@ -317,7 +317,7 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const { bool RenderViewContextMenu::ItemIsChecked(int id) const { // Check box for 'Check the Spelling of this field'. if (id == IDC_CHECK_SPELLING_OF_THIS_FIELD) { - PrefService* prefs = source_web_contents_->profile()->GetPrefs(); + PrefService* prefs = source_tab_contents_->profile()->GetPrefs(); return (params_.spellcheck_enabled && prefs->GetBoolean(prefs::kEnableSpellCheck)); } @@ -330,7 +330,7 @@ bool RenderViewContextMenu::ItemIsChecked(int id) const { SpellChecker::Languages languages; return SpellChecker::GetSpellCheckLanguages( - source_web_contents_->profile(), &languages) == + source_tab_contents_->profile(), &languages) == (id - IDC_SPELLCHECK_LANGUAGES_FIRST); } @@ -341,11 +341,11 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) { const size_t language_number = id - IDC_SPELLCHECK_LANGUAGES_FIRST; SpellChecker::Languages languages; SpellChecker::GetSpellCheckLanguages( - source_web_contents_->profile(), &languages); + source_tab_contents_->profile(), &languages); if (language_number < languages.size()) { StringPrefMember dictionary_language; dictionary_language.Init(prefs::kSpellCheckDictionary, - source_web_contents_->profile()->GetPrefs(), NULL); + source_tab_contents_->profile()->GetPrefs(), NULL); dictionary_language.SetValue(ASCIIToWide(languages[language_number])); } @@ -374,9 +374,9 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) { (id == IDS_CONTENT_CONTEXT_SAVELINKAS ? params_.link_url : params_.image_url); DownloadManager* dlm = - source_web_contents_->profile()->GetDownloadManager(); + source_tab_contents_->profile()->GetDownloadManager(); dlm->DownloadUrl(url, referrer, params_.frame_charset, - source_web_contents_); + source_tab_contents_); break; } @@ -397,23 +397,23 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) { break; case IDS_CONTENT_CONTEXT_BACK: - source_web_contents_->controller().GoBack(); + source_tab_contents_->controller().GoBack(); break; case IDS_CONTENT_CONTEXT_FORWARD: - source_web_contents_->controller().GoForward(); + source_tab_contents_->controller().GoForward(); break; case IDS_CONTENT_CONTEXT_SAVEPAGEAS: - source_web_contents_->OnSavePage(); + source_tab_contents_->OnSavePage(); break; case IDS_CONTENT_CONTEXT_RELOAD: - source_web_contents_->controller().Reload(true); + source_tab_contents_->controller().Reload(true); break; case IDS_CONTENT_CONTEXT_PRINT: - source_web_contents_->PrintPreview(); + source_tab_contents_->PrintPreview(); break; case IDS_CONTENT_CONTEXT_VIEWPAGESOURCE: @@ -428,11 +428,11 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) { case IDS_CONTENT_CONTEXT_VIEWPAGEINFO: { #if defined(OS_WIN) NavigationEntry* nav_entry = - source_web_contents_->controller().GetActiveEntry(); + source_tab_contents_->controller().GetActiveEntry(); PageInfoWindow::CreatePageInfo( - source_web_contents_->profile(), + source_tab_contents_->profile(), nav_entry, - source_web_contents_->GetContentNativeView(), + source_tab_contents_->GetContentNativeView(), PageInfoWindow::SECURITY); #else // TODO(port): port PageInfoWindow. @@ -492,44 +492,44 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) { ssl.set_security_bits(security_bits); } PageInfoWindow::CreateFrameInfo( - source_web_contents_->profile(), + source_tab_contents_->profile(), params_.frame_url, ssl, - source_web_contents_->GetContentNativeView(), + source_tab_contents_->GetContentNativeView(), PageInfoWindow::SECURITY); break; } case IDS_CONTENT_CONTEXT_UNDO: - source_web_contents_->render_view_host()->Undo(); + source_tab_contents_->render_view_host()->Undo(); break; case IDS_CONTENT_CONTEXT_REDO: - source_web_contents_->render_view_host()->Redo(); + source_tab_contents_->render_view_host()->Redo(); break; case IDS_CONTENT_CONTEXT_CUT: - source_web_contents_->render_view_host()->Cut(); + source_tab_contents_->render_view_host()->Cut(); break; case IDS_CONTENT_CONTEXT_COPY: - source_web_contents_->render_view_host()->Copy(); + source_tab_contents_->render_view_host()->Copy(); break; case IDS_CONTENT_CONTEXT_PASTE: - source_web_contents_->render_view_host()->Paste(); + source_tab_contents_->render_view_host()->Paste(); break; case IDS_CONTENT_CONTEXT_DELETE: - source_web_contents_->render_view_host()->Delete(); + source_tab_contents_->render_view_host()->Delete(); break; case IDS_CONTENT_CONTEXT_SELECTALL: - source_web_contents_->render_view_host()->SelectAll(); + source_tab_contents_->render_view_host()->SelectAll(); break; case IDS_CONTENT_CONTEXT_SEARCHWEBFOR: { - const TemplateURL* const default_provider = source_web_contents_-> + const TemplateURL* const default_provider = source_tab_contents_-> profile()->GetTemplateURLModel()->GetDefaultSearchProvider(); DCHECK(default_provider); // The context menu should not contain this // item when there is no provider. @@ -546,15 +546,15 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) { case IDC_SPELLCHECK_SUGGESTION_2: case IDC_SPELLCHECK_SUGGESTION_3: case IDC_SPELLCHECK_SUGGESTION_4: - source_web_contents_->render_view_host()->Replace( + source_tab_contents_->render_view_host()->Replace( params_.dictionary_suggestions[id - IDC_SPELLCHECK_SUGGESTION_0]); break; case IDC_CHECK_SPELLING_OF_THIS_FIELD: - source_web_contents_->render_view_host()->ToggleSpellCheck(); + source_tab_contents_->render_view_host()->ToggleSpellCheck(); break; case IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY: - source_web_contents_->render_view_host()->AddToDictionary( + source_tab_contents_->render_view_host()->AddToDictionary( params_.misspelled_word); break; @@ -563,10 +563,10 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) { // TODO(yusukes): This should be moved to some shared place of commands // for the options stuff so that we don't have to do all this work here. FontsLanguagesWindowView* window_ = new FontsLanguagesWindowView( - source_web_contents_->profile()); + source_tab_contents_->profile()); views::Window::CreateChromeWindow( platform_util::GetTopLevel( - source_web_contents_->GetContentNativeView()), + source_tab_contents_->GetContentNativeView()), gfx::Rect(), window_)->Show(); window_->SelectLanguagesTab(); #else @@ -588,7 +588,7 @@ bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { return true; NavigationEntry *active_entry = - source_web_contents_->controller().GetActiveEntry(); + source_tab_contents_->controller().GetActiveEntry(); if (!active_entry) return false; @@ -613,7 +613,7 @@ bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { // Don't enable the web inspector if JavaScript is disabled if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { - PrefService* prefs = source_web_contents_->profile()->GetPrefs(); + PrefService* prefs = source_tab_contents_->profile()->GetPrefs(); if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || command_line.HasSwitch(switches::kDisableJavaScript)) return false; @@ -628,20 +628,20 @@ void RenderViewContextMenu::OpenURL( const GURL& url, WindowOpenDisposition disposition, PageTransition::Type transition) { - source_web_contents_->OpenURL(url, GURL(), disposition, transition); + source_tab_contents_->OpenURL(url, GURL(), disposition, transition); } void RenderViewContextMenu::CopyImageAt(int x, int y) { - source_web_contents_->render_view_host()->CopyImageAt(x, y); + source_tab_contents_->render_view_host()->CopyImageAt(x, y); } void RenderViewContextMenu::Inspect(int x, int y) { if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableOutOfProcessDevTools)) { g_browser_process->devtools_manager()->InspectElement( - source_web_contents_, x, y); + source_tab_contents_, x, y); } else { - source_web_contents_->render_view_host()->InspectElementAt(x, y); + source_tab_contents_->render_view_host()->InspectElementAt(x, y); } } diff --git a/chrome/browser/tab_contents/render_view_context_menu.h b/chrome/browser/tab_contents/render_view_context_menu.h index d6dfaf1..54c611f 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.h +++ b/chrome/browser/tab_contents/render_view_context_menu.h @@ -11,12 +11,12 @@ #include "webkit/glue/window_open_disposition.h" class Profile; -class WebContents; +class TabContents; class RenderViewContextMenu { public: RenderViewContextMenu( - WebContents* web_contents, + TabContents* tab_contents, const ContextMenuParams& params); virtual ~RenderViewContextMenu(); @@ -86,7 +86,7 @@ class RenderViewContextMenu { bool IsDevCommandEnabled(int id) const; ContextMenuParams params_; - WebContents* source_web_contents_; + TabContents* source_tab_contents_; Profile* profile_; DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenu); diff --git a/chrome/browser/tab_contents/render_view_context_menu_gtk.cc b/chrome/browser/tab_contents/render_view_context_menu_gtk.cc index 1ccb4c0..0362366 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_gtk.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_gtk.cc @@ -8,7 +8,7 @@ #include "webkit/glue/context_menu.h" RenderViewContextMenuGtk::RenderViewContextMenuGtk( - WebContents* web_contents, + TabContents* web_contents, const ContextMenuParams& params, guint32 triggering_event_time) : RenderViewContextMenu(web_contents, params), diff --git a/chrome/browser/tab_contents/render_view_context_menu_gtk.h b/chrome/browser/tab_contents/render_view_context_menu_gtk.h index 5563dc5..b6855f2 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_gtk.h +++ b/chrome/browser/tab_contents/render_view_context_menu_gtk.h @@ -19,7 +19,7 @@ class ContextMenuParams; class RenderViewContextMenuGtk : public RenderViewContextMenu, public MenuGtk::Delegate { public: - RenderViewContextMenuGtk(WebContents* web_contents, + RenderViewContextMenuGtk(TabContents* web_contents, const ContextMenuParams& params, uint32_t triggering_event_time); diff --git a/chrome/browser/tab_contents/render_view_context_menu_mac.h b/chrome/browser/tab_contents/render_view_context_menu_mac.h index 9a4f60e..4b39b56 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_mac.h +++ b/chrome/browser/tab_contents/render_view_context_menu_mac.h @@ -17,7 +17,7 @@ class RenderViewContextMenuMac : public RenderViewContextMenu { public: - RenderViewContextMenuMac(WebContents* web_contents, + RenderViewContextMenuMac(TabContents* web_contents, const ContextMenuParams& params, NSView* parent_view); virtual ~RenderViewContextMenuMac(); diff --git a/chrome/browser/tab_contents/render_view_context_menu_mac.mm b/chrome/browser/tab_contents/render_view_context_menu_mac.mm index fc614ff..b2cc94f 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_mac.mm +++ b/chrome/browser/tab_contents/render_view_context_menu_mac.mm @@ -40,7 +40,7 @@ @end RenderViewContextMenuMac::RenderViewContextMenuMac( - WebContents* web_contents, + TabContents* web_contents, const ContextMenuParams& params, NSView* parent_view) : RenderViewContextMenu(web_contents, params), diff --git a/chrome/browser/tab_contents/render_view_context_menu_win.cc b/chrome/browser/tab_contents/render_view_context_menu_win.cc index 0adcf72..ea2a2d0 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_win.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_win.cc @@ -10,10 +10,10 @@ #include "grit/generated_resources.h" RenderViewContextMenuWin::RenderViewContextMenuWin( - WebContents* web_contents, + TabContents* tab_contents, const ContextMenuParams& params, HWND owner) - : RenderViewContextMenu(web_contents, params), + : RenderViewContextMenu(tab_contents, params), ALLOW_THIS_IN_INITIALIZER_LIST(menu_(this, Menu::TOPLEFT, owner)), sub_menu_(NULL) { InitMenu(params.node); diff --git a/chrome/browser/tab_contents/render_view_context_menu_win.h b/chrome/browser/tab_contents/render_view_context_menu_win.h index db74b5e..32426b4 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_win.h +++ b/chrome/browser/tab_contents/render_view_context_menu_win.h @@ -12,7 +12,7 @@ class RenderViewContextMenuWin : public RenderViewContextMenu, public Menu::Delegate{ public: - RenderViewContextMenuWin(WebContents* web_contents, + RenderViewContextMenuWin(TabContents* tab_contents, const ContextMenuParams& params, HWND window); diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index 49fe017..8390d6e 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -13,7 +13,7 @@ #include "chrome/browser/renderer_host/render_widget_host.h" #include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/tab_contents/site_instance.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" @@ -24,8 +24,8 @@ void RenderViewHostDelegateViewHelper::CreateNewWindow(int route_id, SiteInstance* site) { // Create the new web contents. This will automatically create the new // TabContentsView. In the future, we may want to create the view separately. - WebContents* new_contents = - new WebContents(profile, + TabContents* new_contents = + new TabContents(profile, site, route_id, modal_dialog_event); @@ -51,26 +51,26 @@ RenderWidgetHostView* RenderViewHostDelegateViewHelper::CreateNewWidget( return widget_view; } -WebContents* RenderViewHostDelegateViewHelper::GetCreatedWindow(int route_id) { +TabContents* RenderViewHostDelegateViewHelper::GetCreatedWindow(int route_id) { PendingContents::iterator iter = pending_contents_.find(route_id); if (iter == pending_contents_.end()) { DCHECK(false); return NULL; } - WebContents* new_web_contents = iter->second; + TabContents* new_tab_contents = iter->second; pending_contents_.erase(route_id); - if (!new_web_contents->render_view_host()->view() || - !new_web_contents->process()->channel()) { + if (!new_tab_contents->render_view_host()->view() || + !new_tab_contents->process()->channel()) { // The view has gone away or the renderer crashed. Nothing to do. return NULL; } // TODO(brettw) this seems bogus to reach into here and initialize the host. - new_web_contents->render_view_host()->Init(); + new_tab_contents->render_view_host()->Init(); - return new_web_contents; + return new_tab_contents; } RenderWidgetHostView* RenderViewHostDelegateViewHelper::GetCreatedWidget( diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.h b/chrome/browser/tab_contents/render_view_host_delegate_helper.h index 2263829..4f9e600 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.h @@ -21,7 +21,7 @@ class RenderViewHost; class RenderWidgetHost; class RenderWidgetHostView; class SiteInstance; -class WebContents; +class TabContents; // Provides helper methods that provide common implementations of some // RenderViewHostDelegate::View methods. @@ -34,14 +34,14 @@ class RenderViewHostDelegateViewHelper { Profile* profile, SiteInstance* site); virtual RenderWidgetHostView* CreateNewWidget(int route_id, bool activatable, RenderProcessHost* process); - virtual WebContents* GetCreatedWindow(int route_id); + virtual TabContents* GetCreatedWindow(int route_id); virtual RenderWidgetHostView* GetCreatedWidget(int route_id); void RenderWidgetHostDestroyed(RenderWidgetHost* host); private: - // Tracks created WebContents objects that have not been shown yet. They are + // Tracks created TabContents objects that have not been shown yet. They are // identified by the route ID passed to CreateNewWindow. - typedef std::map<int, WebContents*> PendingContents; + typedef std::map<int, TabContents*> PendingContents; PendingContents pending_contents_; // These maps hold on to the widgets that we created on behalf of the diff --git a/chrome/browser/tab_contents/render_view_host_manager.h b/chrome/browser/tab_contents/render_view_host_manager.h index a91d488..d77e649 100644 --- a/chrome/browser/tab_contents/render_view_host_manager.h +++ b/chrome/browser/tab_contents/render_view_host_manager.h @@ -20,23 +20,23 @@ class RenderViewHostDelegate; class RenderWidgetHostView; class SiteInstance; -// Manages RenderViewHosts for a WebContents. Normally there is only one and +// Manages RenderViewHosts for a TabContents. Normally there is only one and // it is easy to do. But we can also have transitions of processes (and hence // RenderViewHosts) that can get complex. class RenderViewHostManager : public NotificationObserver { public: // Functions implemented by our owner that we need. // - // TODO(brettw) Clean this up! These are all the functions in WebContents that + // TODO(brettw) Clean this up! These are all the functions in TabContents that // are required to run this class. The design should probably be better such // that these are more clear. // // There is additional complexity that some of the functions we need in - // WebContents are inherited and non-virtual. These are named with + // TabContents are inherited and non-virtual. These are named with // "RenderManager" so that the duplicate implementation of them will be clear. class Delegate { public: - // See web_contents.h's implementation for more. + // See tab_contents.h's implementation for more. virtual bool CreateRenderViewForRenderManager( RenderViewHost* render_view_host) = 0; virtual void BeforeUnloadFiredFromRenderManager( @@ -69,7 +69,7 @@ class RenderViewHostManager : public NotificationObserver { Delegate* delegate); ~RenderViewHostManager(); - // For arguments, see WebContents constructor. + // For arguments, see TabContents constructor. void Init(Profile* profile, SiteInstance* site_instance, int routing_id, @@ -126,7 +126,7 @@ class RenderViewHostManager : public NotificationObserver { // Called when a renderer's main frame navigates. void DidNavigateMainFrame(RenderViewHost* render_view_host); - // Allows the WebContents to react when a cross-site response is ready to be + // Allows the TabContents to react when a cross-site response is ready to be // delivered to a pending RenderViewHost. We must first run the onunload // handler of the old RenderViewHost before we can allow it to proceed. void OnCrossSiteResponse(int new_render_process_host_id, @@ -140,7 +140,7 @@ class RenderViewHostManager : public NotificationObserver { void RendererAbortedProvisionalLoad(RenderViewHost* render_view_host); // Actually implements this RenderViewHostDelegate function for the - // WebContents. + // TabContents. void ShouldClosePage(bool proceed); // Forwards the message to the RenderViewHost, which is the original one. @@ -174,7 +174,7 @@ class RenderViewHostManager : public NotificationObserver { const NotificationDetails& details); private: - friend class TestWebContents; + friend class TestTabContents; // Returns whether this tab should transition to a new renderer for // cross-site URLs. Enabled unless we see the --process-per-tab command line diff --git a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc index f0caccd..324c547 100644 --- a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc +++ b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc @@ -23,7 +23,7 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { NavigateAndCommit(dest); // Make a second tab. - TestWebContents contents2(profile_.get(), NULL); + TestTabContents contents2(profile_.get(), NULL); // Load the two URLs in the second tab. Note that the first navigation creates // a RVH that's not pending (since there is no cross-site transition), so diff --git a/chrome/browser/tab_contents/site_instance.h b/chrome/browser/tab_contents/site_instance.h index 2e6a51b..18cebbd 100644 --- a/chrome/browser/tab_contents/site_instance.h +++ b/chrome/browser/tab_contents/site_instance.h @@ -21,8 +21,8 @@ // to the other). We represent instances using the BrowsingInstance class. // // In --process-per-tab, one SiteInstance is created for each tab (i.e., in the -// WebContents constructor), unless the tab is created by script (i.e., in -// WebContents::CreateNewView). This corresponds to one process per +// TabContents constructor), unless the tab is created by script (i.e., in +// TabContents::CreateNewView). This corresponds to one process per // BrowsingInstance. // // In process-per-site-instance (the current default process model), @@ -36,7 +36,7 @@ // throughout the entire profile. This ensures that only one process will be // dedicated to each site. // -// Each NavigationEntry for a WebContents points to the SiteInstance that +// Each NavigationEntry for a TabContents points to the SiteInstance that // rendered it. Each RenderViewHost also points to the SiteInstance that it is // associated with. A SiteInstance keeps track of the number of these // references and deletes itself when the count goes to zero. This means that diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 37b370c..035203e 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -30,9 +30,9 @@ #include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/renderer_host/web_cache_manager.h" #include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/browser/tab_contents/tab_contents_view.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/browser/search_engines/template_url_fetcher.h" #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/common/chrome_switches.h" @@ -86,12 +86,12 @@ // it is a download. If so, it sends a message to the new renderer causing // it to cancel the request, and the download proceeds in the download // thread. For now, we stay in a PENDING state (with a pending RVH) until -// the next DidNavigate event for this WebContents. This isn't ideal, but it +// the next DidNavigate event for this TabContents. This isn't ideal, but it // doesn't affect any functionality. // - After RDH receives a response and determines that it is safe and not a // download, it pauses the response to first run the old page's onunload // handler. It does this by asynchronously calling the OnCrossSiteResponse -// method of WebContents on the UI thread, which sends a ClosePage message +// method of TabContents on the UI thread, which sends a ClosePage message // to the current RVH. // - Once the onunload handler is finished, a ClosePage_ACK message is sent to // the ResourceDispatcherHost, who unpauses the response. Data is then sent @@ -167,9 +167,9 @@ BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { } #endif -// TODO(brettw) WebContents should be removed, then this hack is unnecessary. -WebContents* AsWC(TabContents* tc) { - return static_cast<WebContents*>(tc); +// TODO(brettw) TabContents should be removed, then this hack is unnecessary. +TabContents* AsWC(TabContents* tc) { + return static_cast<TabContents*>(tc); } } // namespace @@ -197,8 +197,8 @@ class TabContents::GearsCreateShortcutCallbackFunctor { TabContents* contents_; }; -// TODO(brettw) many of the data members here have casts to WebContents. -// This object is the same as WebContents and is currently being merged. +// TODO(brettw) many of the data members here have casts to TabContents. +// This object is the same as TabContents and is currently being merged. // When this merge is done, the casts can be removed. TabContents::TabContents(Profile* profile, SiteInstance* site_instance, @@ -206,20 +206,20 @@ TabContents::TabContents(Profile* profile, base::WaitableEvent* modal_dialog_event) : delegate_(NULL), controller_(this, profile), - view_(TabContentsView::Create(static_cast<WebContents*>(this))), + view_(TabContentsView::Create(static_cast<TabContents*>(this))), ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_( - static_cast<WebContents*>(this), - static_cast<WebContents*>(this))), + static_cast<TabContents*>(this), + static_cast<TabContents*>(this))), property_bag_(), registrar_(), - printing_(*static_cast<WebContents*>(this)), + printing_(*static_cast<TabContents*>(this)), save_package_(), cancelable_consumer_(), autofill_manager_(), password_manager_(), plugin_installer_(), ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_( - static_cast<WebContents*>(this))), + static_cast<TabContents*>(this))), select_file_dialog_(), pending_install_(), is_loading_(false), @@ -298,7 +298,7 @@ TabContents::~TabContents() { view_->OnContentsDestroy(); NotifyDisconnected(); - HungRendererWarning::HideForWebContents(AsWC(this)); + HungRendererWarning::HideForTabContents(AsWC(this)); if (pending_install_.callback_functor) pending_install_.callback_functor->Cancel(); @@ -396,11 +396,6 @@ void TabContents::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kBlockPopups, false); } - // TODO(brettw) Remove WebContents. -WebContents* TabContents::AsWebContents() { - return AsWC(this); -} - bool TabContents::SupportsURL(GURL* url) { // TODO(brettw) remove this function. return true; @@ -471,15 +466,11 @@ int32 TabContents::GetMaxPageID() { void TabContents::UpdateMaxPageID(int32 page_id) { // Ensure both the SiteInstance and RenderProcessHost update their max page - // IDs in sync. Only WebContents will also have site instances, except during + // IDs in sync. Only TabContents will also have site instances, except during // testing. if (GetSiteInstance()) GetSiteInstance()->UpdateMaxPageID(page_id); - - if (AsWebContents()) - AsWebContents()->process()->UpdateMaxPageID(page_id); - else - max_page_id_ = std::max(max_page_id_, page_id); + process()->UpdateMaxPageID(page_id); } SiteInstance* TabContents::GetSiteInstance() const { @@ -657,7 +648,7 @@ void TabContents::HideContents() { // about the order in which these get called. In addition to making the code // here practically impossible to understand, this also means we end up // calling TabContents::WasHidden() twice if callers call both versions of - // HideContents() on a WebContents. + // HideContents() on a TabContents. WasHidden(); } @@ -1488,16 +1479,16 @@ void TabContents::NotifySwapped() { // pointer. See Bug 1230284. notify_disconnection_ = true; NotificationService::current()->Notify( - NotificationType::WEB_CONTENTS_SWAPPED, - Source<WebContents>(AsWC(this)), + NotificationType::TAB_CONTENTS_SWAPPED, + Source<TabContents>(AsWC(this)), NotificationService::NoDetails()); } void TabContents::NotifyConnected() { notify_disconnection_ = true; NotificationService::current()->Notify( - NotificationType::WEB_CONTENTS_CONNECTED, - Source<WebContents>(AsWC(this)), + NotificationType::TAB_CONTENTS_CONNECTED, + Source<TabContents>(AsWC(this)), NotificationService::NoDetails()); } @@ -1507,8 +1498,8 @@ void TabContents::NotifyDisconnected() { notify_disconnection_ = false; NotificationService::current()->Notify( - NotificationType::WEB_CONTENTS_DISCONNECTED, - Source<WebContents>(AsWC(this)), + NotificationType::TAB_CONTENTS_DISCONNECTED, + Source<TabContents>(AsWC(this)), NotificationService::NoDetails()); } @@ -1598,10 +1589,6 @@ Profile* TabContents::GetProfile() const { return profile(); } -WebContents* TabContents::GetAsWebContents() { - return AsWC(this); -} - ExtensionFunctionDispatcher* TabContents::CreateExtensionFunctionDispatcher( RenderViewHost* render_view_host, const std::string& extension_id) { @@ -1609,6 +1596,10 @@ ExtensionFunctionDispatcher* TabContents::CreateExtensionFunctionDispatcher( extension_id); } +TabContents* TabContents::GetAsTabContents() { + return this; +} + void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { NavigationEntry* entry = controller_.GetActiveEntry(); if (!entry) @@ -1656,7 +1647,7 @@ void TabContents::RenderViewGone(RenderViewHost* rvh) { view_->Invalidate(); // Hide any visible hung renderer warning for this web contents' process. - HungRendererWarning::HideForWebContents(AsWC(this)); + HungRendererWarning::HideForTabContents(AsWC(this)); } void TabContents::DidNavigate(RenderViewHost* rvh, @@ -1959,7 +1950,7 @@ void TabContents::DomOperationResponse(const std::string& json_string, int automation_id) { DomOperationNotificationDetails details(json_string, automation_id); NotificationService::current()->Notify( - NotificationType::DOM_OPERATION_RESPONSE, Source<WebContents>(AsWC(this)), + NotificationType::DOM_OPERATION_RESPONSE, Source<TabContents>(AsWC(this)), Details<DomOperationNotificationDetails>(&details)); } @@ -2157,7 +2148,7 @@ void TabContents::InspectElementReply(int num_resources) { // We have received reply from inspect element request. Notify the // automation provider in case we need to notify automation client. NotificationService::current()->Notify( - NotificationType::DOM_INSPECT_ELEMENT_RESPONSE, Source<WebContents>(AsWC(this)), + NotificationType::DOM_INSPECT_ELEMENT_RESPONSE, Source<TabContents>(AsWC(this)), Details<int>(&num_resources)); } @@ -2233,7 +2224,7 @@ void TabContents::ShouldClosePage(bool proceed) { void TabContents::OnCrossSiteResponse(int new_render_process_host_id, int new_request_id) { - // Allows the WebContents to react when a cross-site response is ready to be + // Allows the TabContents to react when a cross-site response is ready to be // delivered to a pending RenderViewHost. We must first run the onunload // handler of the old RenderViewHost before we can allow it to proceed. render_manager_.OnCrossSiteResponse(new_render_process_host_id, @@ -2269,11 +2260,11 @@ void TabContents::RendererUnresponsive(RenderViewHost* rvh, } if (render_view_host() && render_view_host()->IsRenderViewLive()) - HungRendererWarning::ShowForWebContents(AsWC(this)); + HungRendererWarning::ShowForTabContents(AsWC(this)); } void TabContents::RendererResponsive(RenderViewHost* render_view_host) { - HungRendererWarning::HideForWebContents(AsWC(this)); + HungRendererWarning::HideForTabContents(AsWC(this)); } void TabContents::LoadStateChanged(const GURL& url, diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 4ce03c5..eadc025 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -79,9 +79,9 @@ class TabContentsView; struct ThumbnailScore; struct ViewHostMsg_FrameNavigate_Params; struct ViewHostMsg_DidPrintPage_Params; -class WebContents; +class TabContents; -// Describes what goes in the main content area of a tab. WebContents is +// Describes what goes in the main content area of a tab. TabContents is // the only type of TabContents, and these should be merged together. class TabContents : public PageNavigator, public NotificationObserver, @@ -118,15 +118,6 @@ class TabContents : public PageNavigator, const PropertyBag* property_bag() const { return &property_bag_; } PropertyBag* property_bag() { return &property_bag_; } - // Returns this object as a WebContents if it is one, and NULL otherwise. - // TODO(brettw) this should not be necessary. - WebContents* AsWebContents(); - - // Const version of above for situations where const TabContents*'s are used. - WebContents* AsWebContents() const { - return const_cast<TabContents*>(this)->AsWebContents(); - } - // Returns this object as a DOMUIContents if it is one, and NULL otherwise. virtual DOMUIContents* AsDOMUIContents() { return NULL; } @@ -187,7 +178,7 @@ class TabContents : public PageNavigator, // The max PageID of any page that this TabContents has loaded. PageIDs // increase with each new page that is loaded by a tab. If this is a - // WebContents, then the max PageID is kept separately on each SiteInstance. + // TabContents, then the max PageID is kept separately on each SiteInstance. // Returns -1 if no PageIDs have yet been seen. int32 GetMaxPageID(); @@ -195,7 +186,7 @@ class TabContents : public PageNavigator, void UpdateMaxPageID(int32 page_id); // Returns the site instance associated with the current page. By default, - // there is no site instance. WebContents overrides this to provide proper + // there is no site instance. TabContents overrides this to provide proper // access to its site instance. virtual SiteInstance* GetSiteInstance() const; @@ -500,7 +491,7 @@ class TabContents : public PageNavigator, current_find_request_id_ = current_find_request_id; } - // Accessor for find_text_. Used to determine if this WebContents has any + // Accessor for find_text_. Used to determine if this TabContents has any // active searches. string16 find_text() const { return find_text_; } @@ -552,7 +543,7 @@ class TabContents : public PageNavigator, return contents_mime_type_; } - // Returns true if this WebContents will notify about disconnection. + // Returns true if this TabContents will notify about disconnection. bool notify_disconnection() const { return notify_disconnection_; } // Override the encoding and reload the page by sending down @@ -579,7 +570,7 @@ class TabContents : public PageNavigator, // automation purposes. friend class AutomationProvider; - FRIEND_TEST(WebContentsTest, UpdateTitle); + FRIEND_TEST(TabContentsTest, UpdateTitle); // Temporary until the view/contents separation is complete. friend class TabContentsView; @@ -605,12 +596,12 @@ class TabContents : public PageNavigator, std::wstring title; GURL url; // This object receives the GearsCreateShortcutCallback and routes the - // message back to the WebContents, if we haven't been deleted. + // message back to the TabContents, if we haven't been deleted. GearsCreateShortcutCallbackFunctor* callback_functor; }; - // TODO(brettw) TestWebContents shouldn't exist! - friend class TestWebContents; + // TODO(brettw) TestTabContents shouldn't exist! + friend class TestTabContents; RenderWidgetHostView* render_widget_host_view() const { return render_manager_.current_view(); @@ -730,9 +721,9 @@ class TabContents : public PageNavigator, virtual RenderViewHostDelegate::Save* GetSaveDelegate() const; virtual Profile* GetProfile() const; virtual ExtensionFunctionDispatcher *CreateExtensionFunctionDispatcher( - RenderViewHost* render_view_host, - const std::string& extension_id); - virtual WebContents* GetAsWebContents(); + RenderViewHost* render_view_host, + const std::string& extension_id); + virtual TabContents* GetAsTabContents(); virtual void RenderViewCreated(RenderViewHost* render_view_host); virtual void RenderViewReady(RenderViewHost* render_view_host); virtual void RenderViewGone(RenderViewHost* render_view_host); @@ -875,7 +866,7 @@ class TabContents : public PageNavigator, // Initializes the given renderer if necessary and creates the view ID // corresponding to this view host. If this method is not called and the - // process is not shared, then the WebContents will act as though the renderer + // process is not shared, then the TabContents will act as though the renderer // is not running (i.e., it will render "sad tab"). This method is // automatically called from LoadURL. // @@ -953,7 +944,7 @@ class TabContents : public PageNavigator, bool waiting_for_response_; // Indicates the largest PageID we've seen. This field is ignored if we are - // a WebContents, in which case the max page ID is stored separately with + // a TabContents, in which case the max page ID is stored separately with // each SiteInstance. // TODO(brettw) this seems like it can be removed according to the comment. int32 max_page_id_; diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h index 01e7369..6eff8d26 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.h +++ b/chrome/browser/tab_contents/tab_contents_delegate.h @@ -94,7 +94,7 @@ class TabContentsDelegate { virtual bool IsApplication() { return false; } // Detach the given tab and convert it to a "webapp" view. The tab must be - // a WebContents with a valid WebApp set. + // a TabContents with a valid WebApp set. virtual void ConvertContentsToApplication(TabContents* source) { } // Informs the TabContentsDelegate that some of our state has changed diff --git a/chrome/browser/tab_contents/tab_contents_view.cc b/chrome/browser/tab_contents/tab_contents_view.cc index 326e20f..da6c894 100644 --- a/chrome/browser/tab_contents/tab_contents_view.cc +++ b/chrome/browser/tab_contents/tab_contents_view.cc @@ -7,11 +7,11 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_widget_host.h" #include "chrome/browser/renderer_host/render_widget_host_view.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" -#include "chrome/browser/tab_contents/web_contents.h" -TabContentsView::TabContentsView(WebContents* web_contents) - : web_contents_(web_contents) { +TabContentsView::TabContentsView(TabContents* tab_contents) + : tab_contents_(tab_contents) { } void TabContentsView::CreateView() { @@ -24,8 +24,8 @@ void TabContentsView::RenderWidgetHostDestroyed(RenderWidgetHost* host) { void TabContentsView::CreateNewWindow(int route_id, base::WaitableEvent* modal_dialog_event) { delegate_view_helper_.CreateNewWindow(route_id, modal_dialog_event, - web_contents_->profile(), - web_contents_->GetSiteInstance()); + tab_contents_->profile(), + tab_contents_->GetSiteInstance()); } void TabContentsView::CreateNewWidget(int route_id, bool activatable) { @@ -36,9 +36,9 @@ void TabContentsView::ShowCreatedWindow(int route_id, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { - WebContents* contents = delegate_view_helper_.GetCreatedWindow(route_id); + TabContents* contents = delegate_view_helper_.GetCreatedWindow(route_id); if (contents) { - web_contents()->AddNewContents(contents, disposition, initial_pos, + tab_contents()->AddNewContents(contents, disposition, initial_pos, user_gesture); } } @@ -53,15 +53,15 @@ void TabContentsView::ShowCreatedWidget(int route_id, RenderWidgetHostView* TabContentsView::CreateNewWidgetInternal( int route_id, bool activatable) { return delegate_view_helper_.CreateNewWidget(route_id, activatable, - web_contents()->render_view_host()->process()); + tab_contents()->render_view_host()->process()); } void TabContentsView::ShowCreatedWidgetInternal( RenderWidgetHostView* widget_host_view, const gfx::Rect& initial_pos) { - if (web_contents_->delegate()) - web_contents_->delegate()->RenderWidgetShowing(); + if (tab_contents_->delegate()) + tab_contents_->delegate()->RenderWidgetShowing(); - widget_host_view->InitAsPopup(web_contents_->render_widget_host_view(), + widget_host_view->InitAsPopup(tab_contents_->render_widget_host_view(), initial_pos); widget_host_view->GetRenderWidgetHost()->Init(); } diff --git a/chrome/browser/tab_contents/tab_contents_view.h b/chrome/browser/tab_contents/tab_contents_view.h index 7095bf8..1887f13 100644 --- a/chrome/browser/tab_contents/tab_contents_view.h +++ b/chrome/browser/tab_contents/tab_contents_view.h @@ -19,7 +19,7 @@ class Browser; class RenderViewHost; class RenderWidgetHost; class RenderWidgetHostView; -class WebContents; +class TabContents; class WebKeyboardEvent; namespace base { @@ -27,7 +27,7 @@ class WaitableEvent; } // The TabContentsView is an interface that is implemented by the platform- -// dependent web contents views. The WebContents uses this interface to talk to +// dependent web contents views. The TabContents uses this interface to talk to // them. View-related messages will also get forwarded directly to this class // from RenderViewHost via RenderViewHostDelegate::View. // @@ -35,21 +35,21 @@ class WaitableEvent; // that should be the same for all platforms. class TabContentsView : public RenderViewHostDelegate::View { public: - explicit TabContentsView(WebContents* web_contents); + explicit TabContentsView(TabContents* tab_contents); virtual ~TabContentsView() {} // Creates the appropriate type of TabContentsView for the current system. // The return value is a new heap allocated view with ownership passing to // the caller. - static TabContentsView* Create(WebContents* web_contents); + static TabContentsView* Create(TabContents* tab_contents); - WebContents* web_contents() const { return web_contents_; } + TabContents* tab_contents() const { return tab_contents_; } virtual void CreateView() = 0; // Sets up the View that holds the rendered web page, receives messages for // it and contains page plugins. The host view should be sized to the current - // size of the WebContents. + // size of the TabContents. virtual RenderWidgetHostView* CreateViewForWidget( RenderWidgetHost* render_widget_host) = 0; @@ -77,11 +77,11 @@ class TabContentsView : public RenderViewHostDelegate::View { return gfx::Size(rc.width(), rc.height()); } - // Called when the WebContents is being destroyed. This should clean up child + // Called when the TabContents is being destroyed. This should clean up child // windows that are part of the view. // // TODO(brettw) It seems like this might be able to be done internally as the - // window is being torn down without input from the WebContents. Try to + // window is being torn down without input from the TabContents. Try to // implement functions that way rather than adding stuff here. virtual void OnContentsDestroy() = 0; @@ -157,12 +157,12 @@ class TabContentsView : public RenderViewHostDelegate::View { bool user_gesture); virtual void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos); - // The WebContents whose contents we display. - WebContents* web_contents_; + // The TabContents whose contents we display. + TabContents* tab_contents_; - // Tracks created WebContents objects that have not been shown yet. They are + // Tracks created TabContents objects that have not been shown yet. They are // identified by the route ID passed to CreateNewWindow. - typedef std::map<int, WebContents*> PendingContents; + typedef std::map<int, TabContents*> PendingContents; PendingContents pending_contents_; // These maps hold on to the widgets that we created on behalf of the diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc index 35304d9..9c82b47 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc @@ -15,8 +15,8 @@ #include "chrome/browser/renderer_host/render_view_host_factory.h" #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" #include "chrome/browser/tab_contents/render_view_context_menu_gtk.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/gtk_util.h" namespace { @@ -24,8 +24,8 @@ namespace { // Called when the content view gtk widget is tabbed to. We always return true // and grab focus if we don't have it. The call to SetInitialFocus(bool) // forwards the tab to webkit. We leave focus via TakeFocus(). -// We cast the WebContents to a TabContents because SetInitialFocus is public -// in TabContents and protected in WebContents. +// We cast the TabContents to a TabContents because SetInitialFocus is public +// in TabContents and protected in TabContents. gboolean OnFocus(GtkWidget* widget, GtkDirectionType focus, TabContents* tab_contents) { if (GTK_WIDGET_HAS_FOCUS(widget)) @@ -39,29 +39,29 @@ gboolean OnFocus(GtkWidget* widget, GtkDirectionType focus, // Called when the mouse leaves the widget. We notify our delegate. gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event, - WebContents* web_contents) { - if (web_contents->delegate()) - web_contents->delegate()->ContentsMouseEvent(web_contents, false); + TabContents* tab_contents) { + if (tab_contents->delegate()) + tab_contents->delegate()->ContentsMouseEvent(tab_contents, false); return FALSE; } // Called when the mouse moves within the widget. We notify our delegate. gboolean OnMouseMove(GtkWidget* widget, GdkEventMotion* event, - WebContents* web_contents) { - if (web_contents->delegate()) - web_contents->delegate()->ContentsMouseEvent(web_contents, true); + TabContents* tab_contents) { + if (tab_contents->delegate()) + tab_contents->delegate()->ContentsMouseEvent(tab_contents, true); return FALSE; } } // namespace // static -TabContentsView* TabContentsView::Create(WebContents* web_contents) { - return new TabContentsViewGtk(web_contents); +TabContentsView* TabContentsView::Create(TabContents* tab_contents) { + return new TabContentsViewGtk(tab_contents); } -TabContentsViewGtk::TabContentsViewGtk(WebContents* web_contents) - : TabContentsView(web_contents), +TabContentsViewGtk::TabContentsViewGtk(TabContents* tab_contents) + : TabContentsView(tab_contents), vbox_(gtk_vbox_new(FALSE, 0)), content_view_(NULL) { } @@ -91,11 +91,11 @@ RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget( view->InitAsChild(); content_view_ = view->native_view(); g_signal_connect(content_view_, "focus", - G_CALLBACK(OnFocus), web_contents()); + G_CALLBACK(OnFocus), tab_contents()); g_signal_connect(view->native_view(), "leave-notify-event", - G_CALLBACK(OnLeaveNotify), web_contents()); + G_CALLBACK(OnLeaveNotify), tab_contents()); g_signal_connect(view->native_view(), "motion-notify-event", - G_CALLBACK(OnMouseMove), web_contents()); + G_CALLBACK(OnMouseMove), tab_contents()); gtk_widget_add_events(view->native_view(), GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK); g_signal_connect(view->native_view(), "button-press-event", @@ -170,8 +170,8 @@ void TabContentsViewGtk::Focus() { } void TabContentsViewGtk::SetInitialFocus() { - if (web_contents()->FocusLocationBarByDefault()) - web_contents()->delegate()->SetFocusToLocationBar(); + if (tab_contents()->FocusLocationBarByDefault()) + tab_contents()->delegate()->SetFocusToLocationBar(); else gtk_widget_grab_focus(content_view_); } @@ -192,7 +192,7 @@ void TabContentsViewGtk::UpdateDragCursor(bool is_drop_target) { // This is called when we the renderer asks us to take focus back (i.e., it has // iterated past the last focusable element on the page). void TabContentsViewGtk::TakeFocus(bool reverse) { - web_contents()->delegate()->SetFocusToLocationBar(); + tab_contents()->delegate()->SetFocusToLocationBar(); } void TabContentsViewGtk::HandleKeyboardEvent( @@ -225,7 +225,7 @@ void TabContentsViewGtk::OnFindReply(int request_id, } void TabContentsViewGtk::ShowContextMenu(const ContextMenuParams& params) { - context_menu_.reset(new RenderViewContextMenuGtk(web_contents(), params, + context_menu_.reset(new RenderViewContextMenuGtk(tab_contents(), params, last_mouse_down_time_)); context_menu_->Popup(); } @@ -237,8 +237,8 @@ void TabContentsViewGtk::StartDragging(const WebDropData& drop_data) { // already done with the drag and drop so we don't get stuck // thinking we're in mid-drag. // TODO(port): remove me when the above NOTIMPLEMENTED is fixed. - if (web_contents()->render_view_host()) - web_contents()->render_view_host()->DragSourceSystemDragEnded(); + if (tab_contents()->render_view_host()) + tab_contents()->render_view_host()->DragSourceSystemDragEnded(); } gboolean TabContentsViewGtk::OnMouseDown(GtkWidget* widget, diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.h b/chrome/browser/tab_contents/tab_contents_view_gtk.h index 08c4388..6d24598 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.h +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.h @@ -13,10 +13,10 @@ class RenderViewContextMenuGtk; class TabContentsViewGtk : public TabContentsView { public: - // The corresponding WebContents is passed in the constructor, and manages our + // The corresponding TabContents is passed in the constructor, and manages our // lifetime. This doesn't need to be the case, but is this way currently // because that's what was easiest when they were split. - explicit TabContentsViewGtk(WebContents* web_contents); + explicit TabContentsViewGtk(TabContents* tab_contents); virtual ~TabContentsViewGtk(); // TabContentsView implementation -------------------------------------------- diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.h b/chrome/browser/tab_contents/tab_contents_view_mac.h index afd95bb1..0fd3c89 100644 --- a/chrome/browser/tab_contents/tab_contents_view_mac.h +++ b/chrome/browser/tab_contents/tab_contents_view_mac.h @@ -30,10 +30,10 @@ class TabContentsViewMac; class TabContentsViewMac : public TabContentsView, public NotificationObserver { public: - // The corresponding WebContents is passed in the constructor, and manages our + // The corresponding TabContents is passed in the constructor, and manages our // lifetime. This doesn't need to be the case, but is this way currently // because that's what was easiest when they were split. - explicit TabContentsViewMac(WebContents* web_contents); + explicit TabContentsViewMac(TabContents* web_contents); virtual ~TabContentsViewMac(); // TabContentsView implementation -------------------------------------------- diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm index cb4d8924..97cbf68 100644 --- a/chrome/browser/tab_contents/tab_contents_view_mac.mm +++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm @@ -9,7 +9,7 @@ #include "chrome/browser/renderer_host/render_widget_host.h" #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_type.h" #include "chrome/common/notification_service.h" @@ -21,16 +21,16 @@ @end // static -TabContentsView* TabContentsView::Create(WebContents* web_contents) { - return new TabContentsViewMac(web_contents); +TabContentsView* TabContentsView::Create(TabContents* tab_contents) { + return new TabContentsViewMac(tab_contents); } -TabContentsViewMac::TabContentsViewMac(WebContents* web_contents) - : TabContentsView(web_contents) { - registrar_.Add(this, NotificationType::WEB_CONTENTS_CONNECTED, - Source<WebContents>(web_contents)); - registrar_.Add(this, NotificationType::WEB_CONTENTS_DISCONNECTED, - Source<WebContents>(web_contents)); +TabContentsViewMac::TabContentsViewMac(TabContents* tab_contents) + : TabContentsView(tab_contents) { + registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED, + Source<TabContents>(tab_contents)); + registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED, + Source<TabContents>(tab_contents)); } TabContentsViewMac::~TabContentsViewMac() { @@ -63,9 +63,9 @@ gfx::NativeView TabContentsViewMac::GetNativeView() const { } gfx::NativeView TabContentsViewMac::GetContentNativeView() const { - if (!web_contents()->render_widget_host_view()) + if (!tab_contents()->render_widget_host_view()) return NULL; - return web_contents()->render_widget_host_view()->GetPluginNativeView(); + return tab_contents()->render_widget_host_view()->GetPluginNativeView(); } gfx::NativeWindow TabContentsViewMac::GetTopLevelNativeWindow() const { @@ -83,8 +83,8 @@ void TabContentsViewMac::StartDragging(const WebDropData& drop_data) { // already done with the drag and drop so we don't get stuck // thinking we're in mid-drag. // TODO(port): remove me when the above NOTIMPLEMENTED is fixed. - if (web_contents()->render_view_host()) - web_contents()->render_view_host()->DragSourceSystemDragEnded(); + if (tab_contents()->render_view_host()) + tab_contents()->render_view_host()->DragSourceSystemDragEnded(); } void TabContentsViewMac::OnContentsDestroy() { @@ -107,8 +107,8 @@ void TabContentsViewMac::Focus() { } void TabContentsViewMac::SetInitialFocus() { - if (web_contents()->FocusLocationBarByDefault()) - web_contents()->delegate()->SetFocusToLocationBar(); + if (tab_contents()->FocusLocationBarByDefault()) + tab_contents()->delegate()->SetFocusToLocationBar(); else [[cocoa_view_.get() window] makeFirstResponder:GetContentNativeView()]; } @@ -143,7 +143,7 @@ void TabContentsViewMac::HandleKeyboardEvent( } void TabContentsViewMac::ShowContextMenu(const ContextMenuParams& params) { - RenderViewContextMenuMac menu(web_contents(), + RenderViewContextMenuMac menu(tab_contents(), params, GetNativeView()); } @@ -182,14 +182,14 @@ void TabContentsViewMac::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { switch (type.value) { - case NotificationType::WEB_CONTENTS_CONNECTED: { + case NotificationType::tab_contents_CONNECTED: { if (sad_tab_.get()) { [sad_tab_.get() removeFromSuperview]; sad_tab_.reset(); } break; } - case NotificationType::WEB_CONTENTS_DISCONNECTED: { + case NotificationType::tab_contents_DISCONNECTED: { SadTabView* view = [[SadTabView alloc] initWithFrame:NSZeroRect]; sad_tab_.reset(view); @@ -222,13 +222,13 @@ void TabContentsViewMac::Observe(NotificationType type, } - (void)mouseEvent:(NSEvent *)theEvent { - if (TabContentsView_->web_contents()->delegate()) { + if (TabContentsView_->tab_contents()->delegate()) { if ([theEvent type] == NSMouseMoved) - TabContentsView_->web_contents()->delegate()-> - ContentsMouseEvent(TabContentsView_->web_contents(), true); + TabContentsView_->tab_contents()->delegate()-> + ContentsMouseEvent(TabContentsView_->tab_contents(), true); if ([theEvent type] == NSMouseExited) - TabContentsView_->web_contents()->delegate()-> - ContentsMouseEvent(TabContentsView_->web_contents(), false); + TabContentsView_->tab_contents()->delegate()-> + ContentsMouseEvent(TabContentsView_->tab_contents(), false); } } @@ -237,15 +237,15 @@ void TabContentsViewMac::Observe(NotificationType type, // WebCore. - (void)cut:(id)sender { - TabContentsView_->web_contents()->Cut(); + TabContentsView_->tab_contents()->Cut(); } - (void)copy:(id)sender { - TabContentsView_->web_contents()->Copy(); + TabContentsView_->tab_contents()->Copy(); } - (void)paste:(id)sender { - TabContentsView_->web_contents()->Paste(); + TabContentsView_->tab_contents()->Paste(); } // Tons of stuff goes here, where we grab events going on in Cocoaland and send diff --git a/chrome/browser/tab_contents/tab_contents_view_win.cc b/chrome/browser/tab_contents/tab_contents_view_win.cc index 6fee9c3..a1805a1 100644 --- a/chrome/browser/tab_contents/tab_contents_view_win.cc +++ b/chrome/browser/tab_contents/tab_contents_view_win.cc @@ -16,8 +16,8 @@ #include "chrome/browser/renderer_host/render_widget_host_view_win.h" #include "chrome/browser/tab_contents/render_view_context_menu_win.h" #include "chrome/browser/tab_contents/interstitial_page.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/browser/tab_contents/web_drag_source.h" #include "chrome/browser/tab_contents/web_drop_target.h" #include "chrome/browser/views/sad_tab_view.h" @@ -47,12 +47,12 @@ BOOL CALLBACK DetachPluginWindowsCallback(HWND window, LPARAM param) { } // namespace // static -TabContentsView* TabContentsView::Create(WebContents* web_contents) { - return new TabContentsViewWin(web_contents); +TabContentsView* TabContentsView::Create(TabContents* tab_contents) { + return new TabContentsViewWin(tab_contents); } -TabContentsViewWin::TabContentsViewWin(WebContents* web_contents) - : TabContentsView(web_contents), +TabContentsViewWin::TabContentsViewWin(TabContents* tab_contents) + : TabContentsView(tab_contents), ignore_next_char_event_(false) { last_focused_view_storage_id_ = views::ViewStorage::GetSharedInstance()->CreateStorageID(); @@ -77,7 +77,7 @@ void TabContentsViewWin::CreateView() { // Remove the root view drop target so we can register our own. RevokeDragDrop(GetNativeView()); - drop_target_ = new WebDropTarget(GetNativeView(), web_contents()); + drop_target_ = new WebDropTarget(GetNativeView(), tab_contents()); } RenderWidgetHostView* TabContentsViewWin::CreateViewForWidget( @@ -104,9 +104,9 @@ gfx::NativeView TabContentsViewWin::GetNativeView() const { } gfx::NativeView TabContentsViewWin::GetContentNativeView() const { - if (!web_contents()->render_widget_host_view()) + if (!tab_contents()->render_widget_host_view()) return NULL; - return web_contents()->render_widget_host_view()->GetPluginNativeView(); + return tab_contents()->render_widget_host_view()->GetPluginNativeView(); } gfx::NativeWindow TabContentsViewWin::GetTopLevelNativeWindow() const { @@ -153,7 +153,7 @@ void TabContentsViewWin::StartDragging(const WebDropData& drop_data) { BookmarkDragData bm_drag_data; bm_drag_data.elements.push_back(bm_elt); - bm_drag_data.Write(web_contents()->profile(), data); + bm_drag_data.Write(tab_contents()->profile(), data); } else { data->SetURL(drop_data.url, drop_data.url_title); } @@ -162,7 +162,7 @@ void TabContentsViewWin::StartDragging(const WebDropData& drop_data) { data->SetString(drop_data.plain_text); scoped_refptr<WebDragSource> drag_source( - new WebDragSource(GetNativeView(), web_contents()->render_view_host())); + new WebDragSource(GetNativeView(), tab_contents()->render_view_host())); DWORD effects; @@ -173,8 +173,8 @@ void TabContentsViewWin::StartDragging(const WebDropData& drop_data) { DoDragDrop(data, drag_source, DROPEFFECT_COPY | DROPEFFECT_LINK, &effects); MessageLoop::current()->SetNestableTasksAllowed(old_state); - if (web_contents()->render_view_host()) - web_contents()->render_view_host()->DragSourceSystemDragEnded(); + if (tab_contents()->render_view_host()) + tab_contents()->render_view_host()->DragSourceSystemDragEnded(); } void TabContentsViewWin::OnContentsDestroy() { @@ -213,7 +213,7 @@ void TabContentsViewWin::SetPageTitle(const std::wstring& title) { // TODO(brettw) this call seems messy the way it reaches into the widget // view, and I'm not sure it's necessary. Maybe we should just remove it. ::SetWindowText( - web_contents()->render_widget_host_view()->GetPluginNativeView(), + tab_contents()->render_widget_host_view()->GetPluginNativeView(), title.c_str()); } } @@ -245,8 +245,8 @@ void TabContentsViewWin::Focus() { } void TabContentsViewWin::SetInitialFocus() { - if (web_contents()->FocusLocationBarByDefault()) - web_contents()->delegate()->SetFocusToLocationBar(); + if (tab_contents()->FocusLocationBarByDefault()) + tab_contents()->delegate()->SetFocusToLocationBar(); else ::SetFocus(GetNativeView()); } @@ -315,7 +315,7 @@ void TabContentsViewWin::UpdateDragCursor(bool is_drop_target) { } void TabContentsViewWin::TakeFocus(bool reverse) { - if (!web_contents()->delegate()->TakeFocus(reverse)) { + if (!tab_contents()->delegate()->TakeFocus(reverse)) { views::FocusManager* focus_manager = views::FocusManager::GetFocusManager(GetNativeView()); @@ -378,7 +378,7 @@ void TabContentsViewWin::HandleKeyboardEvent( } void TabContentsViewWin::ShowContextMenu(const ContextMenuParams& params) { - RenderViewContextMenuWin menu(web_contents(), + RenderViewContextMenuWin menu(tab_contents(), params, GetNativeView()); @@ -401,8 +401,8 @@ void TabContentsViewWin::OnHScroll(int scroll_type, short position, void TabContentsViewWin::OnMouseLeave() { // Let our delegate know that the mouse moved (useful for resetting status // bubble state). - if (web_contents()->delegate()) - web_contents()->delegate()->ContentsMouseEvent(web_contents(), false); + if (tab_contents()->delegate()) + tab_contents()->delegate()->ContentsMouseEvent(tab_contents(), false); SetMsgHandled(FALSE); } @@ -413,19 +413,19 @@ LRESULT TabContentsViewWin::OnMouseRange(UINT msg, case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: { // Make sure this TabContents is activated when it is clicked on. - if (web_contents()->delegate()) - web_contents()->delegate()->ActivateContents(web_contents()); + if (tab_contents()->delegate()) + tab_contents()->delegate()->ActivateContents(tab_contents()); DownloadRequestManager* drm = g_browser_process->download_request_manager(); if (drm) - drm->OnUserGesture(web_contents()); + drm->OnUserGesture(tab_contents()); break; } case WM_MOUSEMOVE: // Let our delegate know that the mouse moved (useful for resetting status // bubble state). - if (web_contents()->delegate()) { - web_contents()->delegate()->ContentsMouseEvent(web_contents(), true); + if (tab_contents()->delegate()) { + tab_contents()->delegate()->ContentsMouseEvent(tab_contents(), true); } break; default: @@ -436,8 +436,8 @@ LRESULT TabContentsViewWin::OnMouseRange(UINT msg, } void TabContentsViewWin::OnPaint(HDC junk_dc) { - if (web_contents()->render_view_host() && - !web_contents()->render_view_host()->IsRenderViewLive()) { + if (tab_contents()->render_view_host() && + !tab_contents()->render_view_host()->IsRenderViewLive()) { if (!sad_tab_.get()) sad_tab_.reset(new SadTabView); CRect cr; @@ -485,9 +485,9 @@ void TabContentsViewWin::OnSetFocus(HWND window) { // background from properly taking focus. // We NULL-check the render_view_host_ here because Windows can send us // messages during the destruction process after it has been destroyed. - if (web_contents()->render_widget_host_view()) { + if (tab_contents()->render_widget_host_view()) { HWND inner_hwnd = - web_contents()->render_widget_host_view()->GetPluginNativeView(); + tab_contents()->render_widget_host_view()->GetPluginNativeView(); if (::IsWindow(inner_hwnd)) ::SetFocus(inner_hwnd); } @@ -502,7 +502,7 @@ void TabContentsViewWin::OnWindowPosChanged(WINDOWPOS* window_pos) { if (window_pos->flags & SWP_HIDEWINDOW) { WasHidden(); } else { - // The WebContents was shown by a means other than the user selecting a + // The TabContents was shown by a means other than the user selecting a // Tab, e.g. the window was minimized then restored. if (window_pos->flags & SWP_SHOWWINDOW) WasShown(); @@ -560,21 +560,21 @@ void TabContentsViewWin::ScrollCommon(UINT message, int scroll_type, } void TabContentsViewWin::WasHidden() { - web_contents()->HideContents(); + tab_contents()->HideContents(); } void TabContentsViewWin::WasShown() { - web_contents()->ShowContents(); + tab_contents()->ShowContents(); } void TabContentsViewWin::WasSized(const gfx::Size& size) { - if (web_contents()->interstitial_page()) - web_contents()->interstitial_page()->SetSize(size); - if (web_contents()->render_widget_host_view()) - web_contents()->render_widget_host_view()->SetSize(size); + if (tab_contents()->interstitial_page()) + tab_contents()->interstitial_page()->SetSize(size); + if (tab_contents()->render_widget_host_view()) + tab_contents()->render_widget_host_view()->SetSize(size); // TODO(brettw) this function can probably be moved to this class. - web_contents()->RepositionSupressedPopupsToFit(size); + tab_contents()->RepositionSupressedPopupsToFit(size); } bool TabContentsViewWin::ScrollZoom(int scroll_type) { @@ -609,8 +609,8 @@ bool TabContentsViewWin::ScrollZoom(int scroll_type) { } void TabContentsViewWin::WheelZoom(int distance) { - if (web_contents()->delegate()) { + if (tab_contents()->delegate()) { bool zoom_in = distance > 0; - web_contents()->delegate()->ContentsZoomChange(zoom_in); + tab_contents()->delegate()->ContentsZoomChange(zoom_in); } } diff --git a/chrome/browser/tab_contents/tab_contents_view_win.h b/chrome/browser/tab_contents/tab_contents_view_win.h index 8ef2765..001b770 100644 --- a/chrome/browser/tab_contents/tab_contents_view_win.h +++ b/chrome/browser/tab_contents/tab_contents_view_win.h @@ -20,10 +20,10 @@ class WebDropTarget; class TabContentsViewWin : public TabContentsView, public views::WidgetWin { public: - // The corresponding WebContents is passed in the constructor, and manages our + // The corresponding TabContents is passed in the constructor, and manages our // lifetime. This doesn't need to be the case, but is this way currently // because that's what was easiest when they were split. - explicit TabContentsViewWin(WebContents* web_contents); + explicit TabContentsViewWin(TabContents* tab_contents); virtual ~TabContentsViewWin(); // TabContentsView implementation -------------------------------------------- @@ -73,7 +73,7 @@ class TabContentsViewWin : public TabContentsView, void ScrollCommon(UINT message, int scroll_type, short position, HWND scrollbar); - // Handles notifying the WebContents and other operations when the window was + // Handles notifying the TabContents and other operations when the window was // shown or hidden. void WasHidden(); void WasShown(); @@ -88,7 +88,7 @@ class TabContentsViewWin : public TabContentsView, // --------------------------------------------------------------------------- - // A drop target object that handles drags over this WebContents. + // A drop target object that handles drags over this TabContents. scoped_refptr<WebDropTarget> drop_target_; // Used to render the sad tab. This will be non-NULL only when the sad tab is diff --git a/chrome/browser/tab_contents/tab_util.cc b/chrome/browser/tab_contents/tab_util.cc index 5c53ddb..93b75fc 100644 --- a/chrome/browser/tab_contents/tab_util.cc +++ b/chrome/browser/tab_contents/tab_util.cc @@ -7,7 +7,7 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "net/url_request/url_request.h" bool tab_util::GetTabContentsID(URLRequest* request, @@ -27,12 +27,12 @@ bool tab_util::GetTabContentsID(URLRequest* request, return true; } -WebContents* tab_util::GetWebContentsByID(int render_process_id, +TabContents* tab_util::GetTabContentsByID(int render_process_id, int render_view_id) { RenderViewHost* render_view_host = RenderViewHost::FromID(render_process_id, render_view_id); if (!render_view_host) return NULL; - return render_view_host->delegate()->GetAsWebContents(); + return render_view_host->delegate()->GetAsTabContents(); } diff --git a/chrome/browser/tab_contents/tab_util.h b/chrome/browser/tab_contents/tab_util.h index 0745cf7..cbe9acd 100644 --- a/chrome/browser/tab_contents/tab_util.h +++ b/chrome/browser/tab_contents/tab_util.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_TAB_CONTENTS_TAB_UTIL_H_ class URLRequest; -class WebContents; +class TabContents; namespace tab_util { @@ -15,10 +15,10 @@ namespace tab_util { bool GetTabContentsID(URLRequest* request, int* render_process_host_id, int* routing_id); -// Helper to find the WebContents that originated the given request. Can be +// Helper to find the TabContents that originated the given request. Can be // NULL if the tab has been closed or some other error occurs. // Should only be called from the UI thread, since it accesses TabContent. -WebContents* GetWebContentsByID(int render_process_host_id, int routing_id); +TabContents* GetTabContentsByID(int render_process_host_id, int routing_id); } // namespace tab_util diff --git a/chrome/browser/tab_contents/test_web_contents.cc b/chrome/browser/tab_contents/test_web_contents.cc index 6aa4c6a..bb5f4d06 100644 --- a/chrome/browser/tab_contents/test_web_contents.cc +++ b/chrome/browser/tab_contents/test_web_contents.cc @@ -6,12 +6,12 @@ #include "chrome/browser/renderer_host/test_render_view_host.h" -TestWebContents::TestWebContents(Profile* profile, SiteInstance* instance) - : WebContents(profile, instance, MSG_ROUTING_NONE, NULL), +TestTabContents::TestTabContents(Profile* profile, SiteInstance* instance) + : TabContents(profile, instance, MSG_ROUTING_NONE, NULL), transition_cross_site(false) { } -TestRenderViewHost* TestWebContents::pending_rvh() { +TestRenderViewHost* TestTabContents::pending_rvh() { return static_cast<TestRenderViewHost*>( render_manager_.pending_render_view_host_); } diff --git a/chrome/browser/tab_contents/test_web_contents.h b/chrome/browser/tab_contents/test_web_contents.h index dea7d6d..ea572a1 100644 --- a/chrome/browser/tab_contents/test_web_contents.h +++ b/chrome/browser/tab_contents/test_web_contents.h @@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_ -#define CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_ +#ifndef CHROME_BROWSER_TAB_CONTENTS_TEST_tab_contents_H_ +#define CHROME_BROWSER_TAB_CONTENTS_TEST_tab_contents_H_ -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" class RenderViewHostFactory; class TestRenderViewHost; -// Subclass WebContents to ensure it creates TestRenderViewHosts and does +// Subclass TabContents to ensure it creates TestRenderViewHosts and does // not do anything involving views. -class TestWebContents : public WebContents { +class TestTabContents : public TabContents { public: // The render view host factory will be passed on to the - TestWebContents(Profile* profile, SiteInstance* instance); + TestTabContents(Profile* profile, SiteInstance* instance); TestRenderViewHost* pending_rvh(); @@ -24,7 +24,7 @@ class TestWebContents : public WebContents { return render_manager_.cross_navigation_pending_; } - // Overrides WebContents::ShouldTransitionCrossSite so that we can test both + // Overrides TabContents::ShouldTransitionCrossSite so that we can test both // alternatives without using command-line switches. bool ShouldTransitionCrossSite() { return transition_cross_site; } @@ -51,4 +51,4 @@ class TestWebContents : public WebContents { bool transition_cross_site; }; -#endif // CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_ +#endif // CHROME_BROWSER_TAB_CONTENTS_TEST_tab_contents_H_ diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc deleted file mode 100644 index 255d605..0000000 --- a/chrome/browser/tab_contents/web_contents.cc +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/tab_contents/web_contents.h" - -#include "base/command_line.h" -#include "base/compiler_specific.h" -#include "base/file_version_info.h" -#include "base/string_util.h" -#include "chrome/browser/autofill_manager.h" -#include "chrome/browser/browser.h" -#include "chrome/browser/character_encoding.h" -#include "chrome/browser/debugger/devtools_manager.h" -#include "chrome/browser/dom_operation_notification_details.h" -#include "chrome/browser/dom_ui/dom_ui.h" -#include "chrome/browser/dom_ui/dom_ui_factory.h" -#include "chrome/browser/load_from_memory_cache_details.h" -#include "chrome/browser/password_manager/password_manager.h" -#include "chrome/browser/plugin_installer.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/renderer_host/render_process_host.h" -#include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/renderer_host/render_widget_host_view.h" -#include "chrome/browser/renderer_host/web_cache_manager.h" -#include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/provisional_load_details.h" -#include "chrome/browser/tab_contents/tab_contents_view.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/common/l10n_util.h" -#include "chrome/common/notification_service.h" -#include "chrome/common/pref_names.h" -#include "chrome/common/pref_service.h" -#include "chrome/common/url_constants.h" -#include "webkit/glue/feed.h" -#include "webkit/glue/webkit_glue.h" - -#if defined(OS_WIN) -// TODO(port): fill these in as we flesh out the implementation of this class -#include "chrome/browser/plugin_service.h" -#include "chrome/browser/printing/print_job.h" -#include "chrome/browser/views/hung_renderer_view.h" // TODO(brettw) delete me. -#include "chrome/common/resource_bundle.h" -#endif - -#include "grit/generated_resources.h" diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h deleted file mode 100644 index c0e3600..0000000 --- a/chrome/browser/tab_contents/web_contents.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_H_ -#define CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_H_ - -#include "chrome/browser/tab_contents/tab_contents.h" - -// TODO(brettw) this class is a placeholder until I can remove all references -// to WebContents. -class WebContents : public TabContents { - public: - WebContents(Profile* profile, - SiteInstance* site_instance, - int routing_id, - base::WaitableEvent* modal_dialog_event) - : TabContents(profile, - site_instance, - routing_id, - modal_dialog_event) { - } - - virtual ~WebContents() {} - - private: - DISALLOW_COPY_AND_ASSIGN(WebContents); -}; - -#endif // CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_H_ diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index 1a95044..a2fd641 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -36,9 +36,9 @@ static void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, } // Subclass the TestingProfile so that it can return certain services we need. -class WebContentsTestingProfile : public TestingProfile { +class TabContentsTestingProfile : public TestingProfile { public: - WebContentsTestingProfile() : TestingProfile() { } + TabContentsTestingProfile() : TestingProfile() { } virtual PrefService* GetPrefs() { if (!prefs_.get()) { @@ -78,7 +78,7 @@ class TestInterstitialPage : public InterstitialPage { // interstitial, as in such a case it will be destroyed in the test TearDown // method and will dereference the |deleted| local variable which by then is // out of scope. - TestInterstitialPage(WebContents* tab, + TestInterstitialPage(TabContents* tab, bool new_navigation, const GURL& url, InterstitialState* state, @@ -186,22 +186,22 @@ class TestInterstitialPageStateGuard : public TestInterstitialPage::Delegate { TestInterstitialPage* interstitial_page_; }; -class WebContentsTest : public RenderViewHostTestHarness { +class TabContentsTest : public RenderViewHostTestHarness { public: - WebContentsTest() : RenderViewHostTestHarness() { + TabContentsTest() : RenderViewHostTestHarness() { } private: // Supply our own profile so we use the correct profile data. The test harness // is not supposed to overwrite a profile if it's already created. virtual void SetUp() { - profile_.reset(new WebContentsTestingProfile()); + profile_.reset(new TabContentsTestingProfile()); RenderViewHostTestHarness::SetUp(); } }; // Test to make sure that title updates get stripped of whitespace. -TEST_F(WebContentsTest, UpdateTitle) { +TEST_F(TabContentsTest, UpdateTitle) { ViewHostMsg_FrameNavigate_Params params; InitNavigateParams(¶ms, 0, GURL("about:blank")); @@ -213,7 +213,7 @@ TEST_F(WebContentsTest, UpdateTitle) { } // Test view source mode for the new tabs page. -TEST_F(WebContentsTest, NTPViewSource) { +TEST_F(TabContentsTest, NTPViewSource) { const char kUrl[] = "view-source:chrome-ui://newtab/"; const GURL kGURL(kUrl); @@ -234,7 +234,7 @@ TEST_F(WebContentsTest, NTPViewSource) { } // Test simple same-SiteInstance navigation. -TEST_F(WebContentsTest, SimpleNavigation) { +TEST_F(TabContentsTest, SimpleNavigation) { TestRenderViewHost* orig_rvh = rvh(); SiteInstance* instance1 = contents()->GetSiteInstance(); EXPECT_TRUE(contents()->pending_rvh() == NULL); @@ -262,7 +262,7 @@ TEST_F(WebContentsTest, SimpleNavigation) { // Test that navigating across a site boundary creates a new RenderViewHost // with a new SiteInstance. Going back should do the same. -TEST_F(WebContentsTest, CrossSiteBoundaries) { +TEST_F(TabContentsTest, CrossSiteBoundaries) { contents()->transition_cross_site = true; TestRenderViewHost* orig_rvh = rvh(); int orig_rvh_delete_count = 0; @@ -315,7 +315,7 @@ TEST_F(WebContentsTest, CrossSiteBoundaries) { // Test that navigating across a site boundary after a crash creates a new // RVH without requiring a cross-site transition (i.e., PENDING state). -TEST_F(WebContentsTest, CrossSiteBoundariesAfterCrash) { +TEST_F(TabContentsTest, CrossSiteBoundariesAfterCrash) { contents()->transition_cross_site = true; TestRenderViewHost* orig_rvh = rvh(); int orig_rvh_delete_count = 0; @@ -358,7 +358,7 @@ TEST_F(WebContentsTest, CrossSiteBoundariesAfterCrash) { // Test that opening a new tab in the same SiteInstance and then navigating // both tabs to a new site will place both tabs in a single SiteInstance. -TEST_F(WebContentsTest, NavigateTwoTabsCrossSite) { +TEST_F(TabContentsTest, NavigateTwoTabsCrossSite) { contents()->transition_cross_site = true; TestRenderViewHost* orig_rvh = rvh(); SiteInstance* instance1 = contents()->GetSiteInstance(); @@ -371,7 +371,7 @@ TEST_F(WebContentsTest, NavigateTwoTabsCrossSite) { contents()->TestDidNavigate(orig_rvh, params1); // Open a new tab with the same SiteInstance, navigated to the same site. - TestWebContents contents2(profile(), instance1); + TestTabContents contents2(profile(), instance1); params1.page_id = 2; // Need this since the site instance is the same (which // is the scope of page IDs) and we want to consider // this a new page. @@ -410,9 +410,9 @@ TEST_F(WebContentsTest, NavigateTwoTabsCrossSite) { EXPECT_EQ(instance2a, instance2b); } -// Tests that WebContents uses the current URL, not the SiteInstance's site, to +// Tests that TabContents uses the current URL, not the SiteInstance's site, to // determine whether a navigation is cross-site. -TEST_F(WebContentsTest, CrossSiteComparesAgainstCurrentPage) { +TEST_F(TabContentsTest, CrossSiteComparesAgainstCurrentPage) { contents()->transition_cross_site = true; TestRenderViewHost* orig_rvh = rvh(); SiteInstance* instance1 = contents()->GetSiteInstance(); @@ -425,7 +425,7 @@ TEST_F(WebContentsTest, CrossSiteComparesAgainstCurrentPage) { contents()->TestDidNavigate(orig_rvh, params1); // Open a related tab to a second site. - TestWebContents contents2(profile(), instance1); + TestTabContents contents2(profile(), instance1); contents2.transition_cross_site = true; const GURL url2("http://www.yahoo.com"); contents2.controller().LoadURL(url2, GURL(), PageTransition::TYPED); @@ -464,7 +464,7 @@ TEST_F(WebContentsTest, CrossSiteComparesAgainstCurrentPage) { // Test that the onbeforeunload and onunload handlers run when navigating // across site boundaries. -TEST_F(WebContentsTest, CrossSiteUnloadHandlers) { +TEST_F(TabContentsTest, CrossSiteUnloadHandlers) { contents()->transition_cross_site = true; TestRenderViewHost* orig_rvh = rvh(); SiteInstance* instance1 = contents()->GetSiteInstance(); @@ -494,7 +494,7 @@ TEST_F(WebContentsTest, CrossSiteUnloadHandlers) { // We won't hear DidNavigate until the onunload handler has finished running. // (No way to simulate that here, but it involves a call from RDH to - // WebContents::OnCrossSiteResponse.) + // TabContents::OnCrossSiteResponse.) // DidNavigate from the pending page ViewHostMsg_FrameNavigate_Params params2; @@ -509,7 +509,7 @@ TEST_F(WebContentsTest, CrossSiteUnloadHandlers) { // Test that NavigationEntries have the correct content state after going // forward and back. Prevents regression for bug 1116137. -TEST_F(WebContentsTest, NavigationEntryContentState) { +TEST_F(TabContentsTest, NavigationEntryContentState) { TestRenderViewHost* orig_rvh = rvh(); // Navigate to URL. There should be no committed entry yet. @@ -547,7 +547,7 @@ TEST_F(WebContentsTest, NavigationEntryContentState) { // Test that NavigationEntries have the correct content state after opening // a new window to about:blank. Prevents regression for bug 1116137. -TEST_F(WebContentsTest, NavigationEntryContentStateNewWindow) { +TEST_F(TabContentsTest, NavigationEntryContentStateNewWindow) { TestRenderViewHost* orig_rvh = rvh(); // When opening a new window, it is navigated to about:blank internally. @@ -565,7 +565,7 @@ TEST_F(WebContentsTest, NavigationEntryContentStateNewWindow) { // Tests to see that webkit preferences are properly loaded and copied over // to a WebPreferences object. -TEST_F(WebContentsTest, WebKitPrefs) { +TEST_F(TabContentsTest, WebKitPrefs) { WebPreferences webkit_prefs = contents()->TestGetWebkitPrefs(); // These values have been overridden by the profile preferences. @@ -586,7 +586,7 @@ TEST_F(WebContentsTest, WebKitPrefs) { // Test navigating to a page (with the navigation initiated from the browser, // as when a URL is typed in the location bar) that shows an interstitial and // creates a new navigation entry, then hiding it without proceeding. -TEST_F(WebContentsTest, +TEST_F(TabContentsTest, ShowInterstitialFromBrowserWithNewNavigationDontProceed) { // Navigate to a page. GURL url1("http://www.google.com"); @@ -634,7 +634,7 @@ TEST_F(WebContentsTest, // Test navigating to a page (with the navigation initiated from the renderer, // as when clicking on a link in the page) that shows an interstitial and // creates a new navigation entry, then hiding it without proceeding. -TEST_F(WebContentsTest, +TEST_F(TabContentsTest, ShowInterstitiaFromRendererlWithNewNavigationDontProceed) { // Navigate to a page. GURL url1("http://www.google.com"); @@ -679,7 +679,7 @@ TEST_F(WebContentsTest, // Test navigating to a page that shows an interstitial without creating a new // navigation entry (this happens when the interstitial is triggered by a // sub-resource in the page), then hiding it without proceeding. -TEST_F(WebContentsTest, ShowInterstitialNoNewNavigationDontProceed) { +TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationDontProceed) { // Navigate to a page. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); @@ -723,7 +723,7 @@ TEST_F(WebContentsTest, ShowInterstitialNoNewNavigationDontProceed) { // Test navigating to a page (with the navigation initiated from the browser, // as when a URL is typed in the location bar) that shows an interstitial and // creates a new navigation entry, then proceeding. -TEST_F(WebContentsTest, +TEST_F(TabContentsTest, ShowInterstitialFromBrowserNewNavigationProceed) { // Navigate to a page. GURL url1("http://www.google.com"); @@ -782,7 +782,7 @@ TEST_F(WebContentsTest, // Test navigating to a page (with the navigation initiated from the renderer, // as when clicking on a link in the page) that shows an interstitial and // creates a new navigation entry, then proceeding. -TEST_F(WebContentsTest, +TEST_F(TabContentsTest, ShowInterstitialFromRendererNewNavigationProceed) { // Navigate to a page. GURL url1("http://www.google.com"); @@ -837,7 +837,7 @@ TEST_F(WebContentsTest, // Test navigating to a page that shows an interstitial without creating a new // navigation entry (this happens when the interstitial is triggered by a // sub-resource in the page), then proceeding. -TEST_F(WebContentsTest, ShowInterstitialNoNewNavigationProceed) { +TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationProceed) { // Navigate to a page so we have a navigation entry in the controller. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); @@ -882,7 +882,7 @@ TEST_F(WebContentsTest, ShowInterstitialNoNewNavigationProceed) { } // Test navigating to a page that shows an interstitial, then navigating away. -TEST_F(WebContentsTest, ShowInterstitialThenNavigate) { +TEST_F(TabContentsTest, ShowInterstitialThenNavigate) { // Show interstitial. TestInterstitialPage::InterstitialState state = TestInterstitialPage::UNDECIDED; @@ -903,7 +903,7 @@ TEST_F(WebContentsTest, ShowInterstitialThenNavigate) { } // Test navigating to a page that shows an interstitial, then close the tab. -TEST_F(WebContentsTest, ShowInterstitialThenCloseTab) { +TEST_F(TabContentsTest, ShowInterstitialThenCloseTab) { // Show interstitial. TestInterstitialPage::InterstitialState state = TestInterstitialPage::UNDECIDED; @@ -923,7 +923,7 @@ TEST_F(WebContentsTest, ShowInterstitialThenCloseTab) { // Test that after Proceed is called and an interstitial is still shown, no more // commands get executed. -TEST_F(WebContentsTest, ShowInterstitialProceedMultipleCommands) { +TEST_F(TabContentsTest, ShowInterstitialProceedMultipleCommands) { // Navigate to a page so we have a navigation entry in the controller. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); @@ -957,7 +957,7 @@ TEST_F(WebContentsTest, ShowInterstitialProceedMultipleCommands) { } // Test showing an interstitial while another interstitial is already showing. -TEST_F(WebContentsTest, ShowInterstitialOnInterstitial) { +TEST_F(TabContentsTest, ShowInterstitialOnInterstitial) { // Navigate to a page so we have a navigation entry in the controller. GURL start_url("http://www.google.com"); rvh()->SendNavigate(1, start_url); @@ -1007,7 +1007,7 @@ TEST_F(WebContentsTest, ShowInterstitialOnInterstitial) { // Test showing an interstitial, proceeding and then navigating to another // interstitial. -TEST_F(WebContentsTest, ShowInterstitialProceedShowInterstitial) { +TEST_F(TabContentsTest, ShowInterstitialProceedShowInterstitial) { // Navigate to a page so we have a navigation entry in the controller. GURL start_url("http://www.google.com"); rvh()->SendNavigate(1, start_url); @@ -1062,7 +1062,7 @@ TEST_F(WebContentsTest, ShowInterstitialProceedShowInterstitial) { // Test that navigating away from an interstitial while it's loading cause it // not to show. -TEST_F(WebContentsTest, NavigateBeforeInterstitialShows) { +TEST_F(TabContentsTest, NavigateBeforeInterstitialShows) { // Show an interstitial. TestInterstitialPage::InterstitialState state = TestInterstitialPage::UNDECIDED; @@ -1090,7 +1090,7 @@ TEST_F(WebContentsTest, NavigateBeforeInterstitialShows) { } // Test showing an interstitial and have its renderer crash. -TEST_F(WebContentsTest, InterstitialCrasher) { +TEST_F(TabContentsTest, InterstitialCrasher) { // Show an interstitial. TestInterstitialPage::InterstitialState state = TestInterstitialPage::UNDECIDED; diff --git a/chrome/browser/tab_contents/web_drag_source.h b/chrome/browser/tab_contents/web_drag_source.h index dc45792..9ba5bf9 100644 --- a/chrome/browser/tab_contents/web_drag_source.h +++ b/chrome/browser/tab_contents/web_drag_source.h @@ -22,7 +22,7 @@ class RenderViewHost; // // WebDragSource // -// An IDropSource implementation for a WebContents. Handles notifications sent +// An IDropSource implementation for a TabContents. Handles notifications sent // by an active drag-drop operation as the user mouses over other drop targets // on their system. This object tells Windows whether or not the drag should // continue, and supplies the appropriate cursors. diff --git a/chrome/browser/tab_contents/web_drop_target.cc b/chrome/browser/tab_contents/web_drop_target.cc index f934f62..7f9cbf7 100644 --- a/chrome/browser/tab_contents/web_drop_target.cc +++ b/chrome/browser/tab_contents/web_drop_target.cc @@ -10,7 +10,7 @@ #include "base/clipboard_util.h" #include "base/gfx/point.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/os_exchange_data.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" @@ -38,8 +38,8 @@ DWORD GetPreferredDropEffect(DWORD effect) { // in the drop data and handle links as navigations. class InterstitialDropTarget { public: - explicit InterstitialDropTarget(WebContents* web_contents) - : web_contents_(web_contents) {} + explicit InterstitialDropTarget(TabContents* tab_contents) + : tab_contents_(tab_contents) {} DWORD OnDragEnter(IDataObject* data_object, DWORD effect) { return ClipboardUtil::HasUrl(data_object) ? GetPreferredDropEffect(effect) @@ -59,7 +59,7 @@ class InterstitialDropTarget { std::wstring url; std::wstring title; ClipboardUtil::GetUrl(data_object, &url, &title); - web_contents_->OpenURL(GURL(url), GURL(), CURRENT_TAB, + tab_contents_->OpenURL(GURL(url), GURL(), CURRENT_TAB, PageTransition::AUTO_BOOKMARK); return GetPreferredDropEffect(effect); } @@ -67,7 +67,7 @@ class InterstitialDropTarget { } private: - WebContents* web_contents_; + TabContents* tab_contents_; DISALLOW_EVIL_CONSTRUCTORS(InterstitialDropTarget); }; @@ -75,12 +75,12 @@ class InterstitialDropTarget { /////////////////////////////////////////////////////////////////////////////// // WebDropTarget, public: -WebDropTarget::WebDropTarget(HWND source_hwnd, WebContents* web_contents) +WebDropTarget::WebDropTarget(HWND source_hwnd, TabContents* tab_contents) : BaseDropTarget(source_hwnd), - web_contents_(web_contents), + tab_contents_(tab_contents), current_rvh_(NULL), is_drop_target_(false), - interstitial_drop_target_(new InterstitialDropTarget(web_contents)) { + interstitial_drop_target_(new InterstitialDropTarget(tab_contents)) { } WebDropTarget::~WebDropTarget() { @@ -90,12 +90,12 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object, DWORD key_state, POINT cursor_position, DWORD effect) { - current_rvh_ = web_contents_->render_view_host(); + current_rvh_ = tab_contents_->render_view_host(); // Don't pass messages to the renderer if an interstitial page is showing // because we don't want the interstitial page to navigate. Instead, // pass the messages on to a separate interstitial DropTarget handler. - if (web_contents_->showing_interstitial_page()) + if (tab_contents_->showing_interstitial_page()) return interstitial_drop_target_->OnDragEnter(data_object, effect); // TODO(tc): PopulateWebDropData can be slow depending on what is in the @@ -110,7 +110,7 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object, POINT client_pt = cursor_position; ScreenToClient(GetHWND(), &client_pt); - web_contents_->render_view_host()->DragTargetDragEnter(drop_data, + tab_contents_->render_view_host()->DragTargetDragEnter(drop_data, gfx::Point(client_pt.x, client_pt.y), gfx::Point(cursor_position.x, cursor_position.y)); @@ -124,15 +124,15 @@ DWORD WebDropTarget::OnDragOver(IDataObject* data_object, POINT cursor_position, DWORD effect) { DCHECK(current_rvh_); - if (current_rvh_ != web_contents_->render_view_host()) + if (current_rvh_ != tab_contents_->render_view_host()) OnDragEnter(data_object, key_state, cursor_position, effect); - if (web_contents_->showing_interstitial_page()) + if (tab_contents_->showing_interstitial_page()) return interstitial_drop_target_->OnDragOver(data_object, effect); POINT client_pt = cursor_position; ScreenToClient(GetHWND(), &client_pt); - web_contents_->render_view_host()->DragTargetDragOver( + tab_contents_->render_view_host()->DragTargetDragOver( gfx::Point(client_pt.x, client_pt.y), gfx::Point(cursor_position.x, cursor_position.y)); @@ -144,13 +144,13 @@ DWORD WebDropTarget::OnDragOver(IDataObject* data_object, void WebDropTarget::OnDragLeave(IDataObject* data_object) { DCHECK(current_rvh_); - if (current_rvh_ != web_contents_->render_view_host()) + if (current_rvh_ != tab_contents_->render_view_host()) return; - if (web_contents_->showing_interstitial_page()) { + if (tab_contents_->showing_interstitial_page()) { interstitial_drop_target_->OnDragLeave(data_object); } else { - web_contents_->render_view_host()->DragTargetDragLeave(); + tab_contents_->render_view_host()->DragTargetDragLeave(); } } @@ -159,18 +159,18 @@ DWORD WebDropTarget::OnDrop(IDataObject* data_object, POINT cursor_position, DWORD effect) { DCHECK(current_rvh_); - if (current_rvh_ != web_contents_->render_view_host()) + if (current_rvh_ != tab_contents_->render_view_host()) OnDragEnter(data_object, key_state, cursor_position, effect); - if (web_contents_->showing_interstitial_page()) + if (tab_contents_->showing_interstitial_page()) interstitial_drop_target_->OnDragOver(data_object, effect); - if (web_contents_->showing_interstitial_page()) + if (tab_contents_->showing_interstitial_page()) return interstitial_drop_target_->OnDrop(data_object, effect); POINT client_pt = cursor_position; ScreenToClient(GetHWND(), &client_pt); - web_contents_->render_view_host()->DragTargetDrop( + tab_contents_->render_view_host()->DragTargetDrop( gfx::Point(client_pt.x, client_pt.y), gfx::Point(cursor_position.x, cursor_position.y)); diff --git a/chrome/browser/tab_contents/web_drop_target.h b/chrome/browser/tab_contents/web_drop_target.h index 9a25b77..36894c8 100644 --- a/chrome/browser/tab_contents/web_drop_target.h +++ b/chrome/browser/tab_contents/web_drop_target.h @@ -10,21 +10,21 @@ class InterstitialDropTarget; class RenderViewHost; -class WebContents; +class TabContents; /////////////////////////////////////////////////////////////////////////////// // // WebDropTarget // -// A helper object that provides drop capabilities to a WebContents. The -// DropTarget handles drags that enter the region of the WebContents by +// A helper object that provides drop capabilities to a TabContents. The +// DropTarget handles drags that enter the region of the TabContents by // passing on the events to the renderer. // class WebDropTarget : public BaseDropTarget { public: // Create a new WebDropTarget associating it with the given HWND and - // WebContents. - WebDropTarget(HWND source_hwnd, WebContents* contents); + // TabContents. + WebDropTarget(HWND source_hwnd, TabContents* contents); virtual ~WebDropTarget(); void set_is_drop_target(bool is_drop_target) { @@ -50,8 +50,8 @@ class WebDropTarget : public BaseDropTarget { DWORD effect); private: - // Our associated WebContents. - WebContents* web_contents_; + // Our associated TabContents. + TabContents* tab_contents_; // We keep track of the render view host we're dragging over. If it changes // during a drag, we need to re-send the DragEnter message. WARNING: diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h index fac1dbe..6f35d47 100644 --- a/chrome/browser/tabs/tab_strip_model.h +++ b/chrome/browser/tabs/tab_strip_model.h @@ -256,7 +256,7 @@ class TabStripModel : public NotificationObserver { // Closes the TabContents at the specified index. This causes the TabContents // to be destroyed, but it may not happen immediately (e.g. if it's a - // WebContents). + // TabContents). // Returns true if the TabContents was closed immediately, false if it was not // closed (we may be waiting for a response from an onunload handler, or // waiting for the user to confirm closure). @@ -446,7 +446,7 @@ class TabStripModel : public NotificationObserver { // Closes the TabContents at the specified index. This causes the TabContents // to be destroyed, but it may not happen immediately (e.g. if it's a - // WebContents). If the page in question has an unload event the TabContents + // TabContents). If the page in question has an unload event the TabContents // will not be destroyed until after the event has completed, which will then // call back into this method. // diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc index 3036ddc..dc54096 100644 --- a/chrome/browser/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/tabs/tab_strip_model_unittest.cc @@ -74,7 +74,7 @@ class TabStripDummyDelegate : public TabStripModelDelegate { class TabStripModelTest : public RenderViewHostTestHarness { public: TabContents* CreateTabContents() { - return new WebContents(profile(), NULL, 0, NULL); + return new TabContents(profile(), NULL, 0, NULL); } // Forwards a URL "load" request through to our dummy TabContents @@ -957,7 +957,7 @@ TEST_F(TabStripModelTest, AddTabContents_ForgetOpeners) { // Added for http://b/issue?id=958960 TEST_F(TabStripModelTest, AppendContentsReselectionTest) { - WebContents fake_destinations_tab(profile(), NULL, 0, NULL); + TabContents fake_destinations_tab(profile(), NULL, 0, NULL); TabStripDummyDelegate delegate(&fake_destinations_tab); TabStripModel tabstrip(&delegate, profile()); EXPECT_TRUE(tabstrip.empty()); diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index 7e882d0..3c42090 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -70,8 +70,8 @@ TaskManagerTableModel::TaskManagerTableModel(TaskManager* task_manager) new TaskManagerBrowserProcessResourceProvider(task_manager); browser_provider->AddRef(); providers_.push_back(browser_provider); - TaskManagerWebContentsResourceProvider* wc_provider = - new TaskManagerWebContentsResourceProvider(task_manager); + TaskManagerTabContentsResourceProvider* wc_provider = + new TaskManagerTabContentsResourceProvider(task_manager); wc_provider->AddRef(); providers_.push_back(wc_provider); TaskManagerChildProcessResourceProvider* child_process_provider = diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc index 5f0cc42..7635896 100644 --- a/chrome/browser/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager_resource_providers.cc @@ -15,7 +15,7 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/child_process_host.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" @@ -28,26 +28,26 @@ #include "grit/theme_resources.h" //////////////////////////////////////////////////////////////////////////////// -// TaskManagerWebContentsResource class +// TaskManagerTabContentsResource class //////////////////////////////////////////////////////////////////////////////// -TaskManagerWebContentsResource::TaskManagerWebContentsResource( - WebContents* web_contents) - : web_contents_(web_contents) { - // We cache the process as when the WebContents is closed the process +TaskManagerTabContentsResource::TaskManagerTabContentsResource( + TabContents* tab_contents) + : tab_contents_(tab_contents) { + // We cache the process as when the TabContents is closed the process // becomes NULL and the TaskManager still needs it. - process_ = web_contents_->process()->process().handle(); + process_ = tab_contents_->process()->process().handle(); pid_ = base::GetProcId(process_); } -TaskManagerWebContentsResource::~TaskManagerWebContentsResource() { +TaskManagerTabContentsResource::~TaskManagerTabContentsResource() { } -std::wstring TaskManagerWebContentsResource::GetTitle() const { +std::wstring TaskManagerTabContentsResource::GetTitle() const { // Fall back on the URL if there's no title. - std::wstring tab_title(UTF16ToWideHack(web_contents_->GetTitle())); + std::wstring tab_title(UTF16ToWideHack(tab_contents_->GetTitle())); if (tab_title.empty()) { - tab_title = UTF8ToWide(web_contents_->GetURL().spec()); + tab_title = UTF8ToWide(tab_contents_->GetURL().spec()); // Force URL to be LTR. if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) l10n_util::WrapStringWithLTRFormatting(&tab_title); @@ -67,55 +67,55 @@ std::wstring TaskManagerWebContentsResource::GetTitle() const { return l10n_util::GetStringF(IDS_TASK_MANAGER_TAB_PREFIX, tab_title); } -SkBitmap TaskManagerWebContentsResource::GetIcon() const { - return web_contents_->GetFavIcon(); +SkBitmap TaskManagerTabContentsResource::GetIcon() const { + return tab_contents_->GetFavIcon(); } -base::ProcessHandle TaskManagerWebContentsResource::GetProcess() const { +base::ProcessHandle TaskManagerTabContentsResource::GetProcess() const { return process_; } -TabContents* TaskManagerWebContentsResource::GetTabContents() const { - return static_cast<TabContents*>(web_contents_); +TabContents* TaskManagerTabContentsResource::GetTabContents() const { + return static_cast<TabContents*>(tab_contents_); } //////////////////////////////////////////////////////////////////////////////// -// TaskManagerWebContentsResourceProvider class +// TaskManagerTabContentsResourceProvider class //////////////////////////////////////////////////////////////////////////////// -TaskManagerWebContentsResourceProvider:: - TaskManagerWebContentsResourceProvider(TaskManager* task_manager) +TaskManagerTabContentsResourceProvider:: + TaskManagerTabContentsResourceProvider(TaskManager* task_manager) : updating_(false), task_manager_(task_manager) { } -TaskManagerWebContentsResourceProvider:: - ~TaskManagerWebContentsResourceProvider() { +TaskManagerTabContentsResourceProvider:: + ~TaskManagerTabContentsResourceProvider() { } -TaskManager::Resource* TaskManagerWebContentsResourceProvider::GetResource( +TaskManager::Resource* TaskManagerTabContentsResourceProvider::GetResource( int origin_pid, int render_process_host_id, int routing_id) { - WebContents* web_contents = - tab_util::GetWebContentsByID(render_process_host_id, routing_id); - if (!web_contents) // Not one of our resource. + TabContents* tab_contents = + tab_util::GetTabContentsByID(render_process_host_id, routing_id); + if (!tab_contents) // Not one of our resource. return NULL; - if (!web_contents->process()->process().handle()) { + if (!tab_contents->process()->process().handle()) { // We should not be holding on to a dead tab (it should have been removed - // through the NOTIFY_WEB_CONTENTS_DISCONNECTED notification. + // through the NOTIFY_TAB_CONTENTS_DISCONNECTED notification. NOTREACHED(); return NULL; } - int pid = web_contents->process()->process().pid(); + int pid = tab_contents->process()->process().pid(); if (pid != origin_pid) return NULL; - std::map<WebContents*, TaskManagerWebContentsResource*>::iterator - res_iter = resources_.find(web_contents); + std::map<TabContents*, TaskManagerTabContentsResource*>::iterator + res_iter = resources_.find(tab_contents); if (res_iter == resources_.end()) // Can happen if the tab was closed while a network request was being // performed. @@ -124,43 +124,43 @@ TaskManager::Resource* TaskManagerWebContentsResourceProvider::GetResource( return res_iter->second; } -void TaskManagerWebContentsResourceProvider::StartUpdating() { +void TaskManagerTabContentsResourceProvider::StartUpdating() { DCHECK(!updating_); updating_ = true; - // Add all the existing WebContents. - for (WebContentsIterator iterator; !iterator.done(); iterator++) { - WebContents* web_contents = *iterator; + // Add all the existing TabContents. + for (TabContentsIterator iterator; !iterator.done(); iterator++) { + TabContents* tab_contents = *iterator; // Don't add dead tabs or tabs that haven't yet connected. - if (web_contents->process()->process().handle() && - web_contents->notify_disconnection()) - AddToTaskManager(web_contents); + if (tab_contents->process()->process().handle() && + tab_contents->notify_disconnection()) + AddToTaskManager(tab_contents); } // Then we register for notifications to get new tabs. - registrar_.Add(this, NotificationType::WEB_CONTENTS_CONNECTED, + registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::WEB_CONTENTS_SWAPPED, + registrar_.Add(this, NotificationType::TAB_CONTENTS_SWAPPED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::WEB_CONTENTS_DISCONNECTED, + registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED, NotificationService::AllSources()); - // WEB_CONTENTS_DISCONNECTED should be enough to know when to remove a + // TAB_CONTENTS_DISCONNECTED should be enough to know when to remove a // resource. This is an attempt at mitigating a crasher that seem to - // indicate a resource is still referencing a deleted WebContents + // indicate a resource is still referencing a deleted TabContents // (http://crbug.com/7321). registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, NotificationService::AllSources()); } -void TaskManagerWebContentsResourceProvider::StopUpdating() { +void TaskManagerTabContentsResourceProvider::StopUpdating() { DCHECK(updating_); updating_ = false; // Then we unregister for notifications to get new tabs. - registrar_.Remove(this, NotificationType::WEB_CONTENTS_CONNECTED, + registrar_.Remove(this, NotificationType::TAB_CONTENTS_CONNECTED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::WEB_CONTENTS_SWAPPED, + registrar_.Remove(this, NotificationType::TAB_CONTENTS_SWAPPED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::WEB_CONTENTS_DISCONNECTED, + registrar_.Remove(this, NotificationType::TAB_CONTENTS_DISCONNECTED, NotificationService::AllSources()); registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, NotificationService::AllSources()); @@ -171,41 +171,41 @@ void TaskManagerWebContentsResourceProvider::StopUpdating() { resources_.clear(); } -void TaskManagerWebContentsResourceProvider::AddToTaskManager( - WebContents* web_contents) { - TaskManagerWebContentsResource* resource = - new TaskManagerWebContentsResource(web_contents); - resources_[web_contents] = resource; +void TaskManagerTabContentsResourceProvider::AddToTaskManager( + TabContents* tab_contents) { + TaskManagerTabContentsResource* resource = + new TaskManagerTabContentsResource(tab_contents); + resources_[tab_contents] = resource; task_manager_->AddResource(resource); } -void TaskManagerWebContentsResourceProvider::Add(WebContents* web_contents) { +void TaskManagerTabContentsResourceProvider::Add(TabContents* tab_contents) { if (!updating_) return; - if (!web_contents->process()->process().handle()) { + if (!tab_contents->process()->process().handle()) { // Don't add sad tabs, we would have no information to show for them since // they have no associated process. return; } - std::map<WebContents*, TaskManagerWebContentsResource*>::const_iterator - iter = resources_.find(web_contents); + std::map<TabContents*, TaskManagerTabContentsResource*>::const_iterator + iter = resources_.find(tab_contents); if (iter != resources_.end()) { - // The case may happen that we have added a WebContents as part of the + // The case may happen that we have added a TabContents as part of the // iteration performed during StartUpdating() call but the notification that // it has connected was not fired yet. So when the notification happens, we // already know about this tab and just ignore it. return; } - AddToTaskManager(web_contents); + AddToTaskManager(tab_contents); } -void TaskManagerWebContentsResourceProvider::Remove(WebContents* web_contents) { +void TaskManagerTabContentsResourceProvider::Remove(TabContents* tab_contents) { if (!updating_) return; - std::map<WebContents*, TaskManagerWebContentsResource*>::iterator - iter = resources_.find(web_contents); + std::map<TabContents*, TaskManagerTabContentsResource*>::iterator + iter = resources_.find(tab_contents); if (iter == resources_.end()) { // Since TabContents are destroyed asynchronously (see TabContentsCollector // in navigation_controller.cc), we can be notified of a tab being removed @@ -215,7 +215,7 @@ void TaskManagerWebContentsResourceProvider::Remove(WebContents* web_contents) { } // Remove the resource from the Task Manager. - TaskManagerWebContentsResource* resource = iter->second; + TaskManagerTabContentsResource* resource = iter->second; task_manager_->RemoveResource(resource); // And from the provider. resources_.erase(iter); @@ -223,25 +223,25 @@ void TaskManagerWebContentsResourceProvider::Remove(WebContents* web_contents) { delete resource; } -void TaskManagerWebContentsResourceProvider::Observe(NotificationType type, +void TaskManagerTabContentsResourceProvider::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { switch (type.value) { - case NotificationType::WEB_CONTENTS_CONNECTED: - Add(Source<WebContents>(source).ptr()); + case NotificationType::TAB_CONTENTS_CONNECTED: + Add(Source<TabContents>(source).ptr()); break; - case NotificationType::WEB_CONTENTS_SWAPPED: - Remove(Source<WebContents>(source).ptr()); - Add(Source<WebContents>(source).ptr()); + case NotificationType::TAB_CONTENTS_SWAPPED: + Remove(Source<TabContents>(source).ptr()); + Add(Source<TabContents>(source).ptr()); break; case NotificationType::TAB_CONTENTS_DESTROYED: // If this DCHECK is triggered, it could explain http://crbug.com/7321. - DCHECK(resources_.find(Source<WebContents>(source).ptr()) == + DCHECK(resources_.find(Source<TabContents>(source).ptr()) == resources_.end()) << "TAB_CONTENTS_DESTROYED with no associated " - "WEB_CONTENTS_DISCONNECTED"; + "TAB_CONTENTS_DISCONNECTED"; // Fall through. - case NotificationType::WEB_CONTENTS_DISCONNECTED: - Remove(Source<WebContents>(source).ptr()); + case NotificationType::TAB_CONTENTS_DISCONNECTED: + Remove(Source<TabContents>(source).ptr()); break; default: NOTREACHED() << "Unexpected notification."; diff --git a/chrome/browser/task_manager_resource_providers.h b/chrome/browser/task_manager_resource_providers.h index 9181543..0d336a0 100644 --- a/chrome/browser/task_manager_resource_providers.h +++ b/chrome/browser/task_manager_resource_providers.h @@ -11,14 +11,14 @@ #include "chrome/common/child_process_info.h" #include "chrome/common/notification_observer.h" -class WebContents; +class TabContents; // These file contains the resource providers used in the task manager. -class TaskManagerWebContentsResource : public TaskManager::Resource { +class TaskManagerTabContentsResource : public TaskManager::Resource { public: - explicit TaskManagerWebContentsResource(WebContents* web_contents); - ~TaskManagerWebContentsResource(); + explicit TaskManagerTabContentsResource(TabContents* tab_contents); + ~TaskManagerTabContentsResource(); // TaskManagerResource methods: std::wstring GetTitle() const; @@ -26,24 +26,24 @@ class TaskManagerWebContentsResource : public TaskManager::Resource { base::ProcessHandle GetProcess() const; TabContents* GetTabContents() const; - // WebContents always provide the network usage. + // TabContents always provide the network usage. bool SupportNetworkUsage() const { return true; } void SetSupportNetworkUsage() { }; private: - WebContents* web_contents_; + TabContents* tab_contents_; base::ProcessHandle process_; int pid_; - DISALLOW_COPY_AND_ASSIGN(TaskManagerWebContentsResource); + DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResource); }; -class TaskManagerWebContentsResourceProvider +class TaskManagerTabContentsResourceProvider : public TaskManager::ResourceProvider, public NotificationObserver { public: - explicit TaskManagerWebContentsResourceProvider(TaskManager* task_manager); - virtual ~TaskManagerWebContentsResourceProvider(); + explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager); + virtual ~TaskManagerTabContentsResourceProvider(); virtual TaskManager::Resource* GetResource(int origin_pid, int render_process_host_id, @@ -57,10 +57,10 @@ class TaskManagerWebContentsResourceProvider const NotificationDetails& details); private: - void Add(WebContents* web_contents); - void Remove(WebContents* web_contents); + void Add(TabContents* tab_contents); + void Remove(TabContents* tab_contents); - void AddToTaskManager(WebContents* web_contents); + void AddToTaskManager(TabContents* tab_contents); // Whether we are currently reporting to the task manager. Used to ignore // notifications sent after StopUpdating(). @@ -68,14 +68,14 @@ class TaskManagerWebContentsResourceProvider TaskManager* task_manager_; - // Maps the actual resources (the WebContents) to the Task Manager + // Maps the actual resources (the TabContents) to the Task Manager // resources. - std::map<WebContents*, TaskManagerWebContentsResource*> resources_; + std::map<TabContents*, TaskManagerTabContentsResource*> resources_; // A scoped container for notification registries. NotificationRegistrar registrar_; - DISALLOW_COPY_AND_ASSIGN(TaskManagerWebContentsResourceProvider); + DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider); }; class TaskManagerChildProcessResource : public TaskManager::Resource { diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index bd58c47..e049630 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -9,7 +9,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/browser/toolbar_model.h" #include "chrome/browser/views/frame/browser_view.h" @@ -618,7 +618,7 @@ void ConstrainedWindowImpl::ActivateConstrainedWindow() { // We could not have a parent focus manager if the ConstrainedWindow is // displayed in a tab that is not currently selected. // TODO(jcampan): we should store the ConstrainedWindow active events in - // that case and replay them when the WebContents becomes selected. + // that case and replay them when the TabContents becomes selected. focus_manager->StoreFocusedView(); // Give our window the focus so we get keyboard messages. diff --git a/chrome/browser/views/dom_view.cc b/chrome/browser/views/dom_view.cc index ffa9c1d..fbbd2f5 100644 --- a/chrome/browser/views/dom_view.cc +++ b/chrome/browser/views/dom_view.cc @@ -4,14 +4,14 @@ #include "chrome/browser/views/dom_view.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" -DOMView::DOMView() : initialized_(false), web_contents_(NULL) { +DOMView::DOMView() : initialized_(false), tab_contents_(NULL) { SetFocusable(true); } DOMView::~DOMView() { - if (web_contents_.get()) + if (tab_contents_.get()) Detach(); } @@ -20,13 +20,13 @@ bool DOMView::Init(Profile* profile, SiteInstance* instance) { return true; initialized_ = true; - web_contents_.reset(new WebContents(profile, instance, + tab_contents_.reset(new TabContents(profile, instance, MSG_ROUTING_NONE, NULL)); - views::HWNDView::Attach(web_contents_->GetNativeView()); + views::HWNDView::Attach(tab_contents_->GetNativeView()); return true; } void DOMView::LoadURL(const GURL& url) { DCHECK(initialized_); - web_contents_->controller().LoadURL(url, GURL(), PageTransition::START_PAGE); + tab_contents_->controller().LoadURL(url, GURL(), PageTransition::START_PAGE); } diff --git a/chrome/browser/views/dom_view.h b/chrome/browser/views/dom_view.h index 132a444..cf60430 100644 --- a/chrome/browser/views/dom_view.h +++ b/chrome/browser/views/dom_view.h @@ -14,7 +14,7 @@ class Profile; class SiteInstance; -class WebContents; +class TabContents; class DOMView : public views::HWNDView { public: @@ -35,7 +35,7 @@ class DOMView : public views::HWNDView { protected: virtual bool CanProcessTabKeyEvents() { return true; } - scoped_ptr<WebContents> web_contents_; + scoped_ptr<TabContents> tab_contents_; private: bool initialized_; diff --git a/chrome/browser/views/external_protocol_dialog.cc b/chrome/browser/views/external_protocol_dialog.cc index 24f004c..2dca539 100644 --- a/chrome/browser/views/external_protocol_dialog.cc +++ b/chrome/browser/views/external_protocol_dialog.cc @@ -11,7 +11,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/external_protocol_handler.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" #include "chrome/common/message_box_flags.h" #include "chrome/views/controls/message_box_view.h" @@ -32,10 +32,10 @@ const int kMessageWidth = 400; void ExternalProtocolDialog::RunExternalProtocolDialog( const GURL& url, const std::wstring& command, int render_process_host_id, int routing_id) { - WebContents* web_contents = tab_util::GetWebContentsByID( + TabContents* tab_contents = tab_util::GetTabContentsByID( render_process_host_id, routing_id); ExternalProtocolDialog* handler = - new ExternalProtocolDialog(web_contents, url, command); + new ExternalProtocolDialog(tab_contents, url, command); } ExternalProtocolDialog::~ExternalProtocolDialog() { diff --git a/chrome/browser/views/external_protocol_dialog.h b/chrome/browser/views/external_protocol_dialog.h index 860178f..548c54e 100644 --- a/chrome/browser/views/external_protocol_dialog.h +++ b/chrome/browser/views/external_protocol_dialog.h @@ -18,7 +18,7 @@ class ExternalProtocolDialog : public views::DialogDelegate { // |url| - The url of the request. // |command| - the command that ShellExecute will run. // |render_process_host_id| and |routing_id| are used by - // tab_util::GetWebContentsByID to aquire the tab contents associated with + // tab_util::GetTabContentsByID to aquire the tab contents associated with // this dialog. // NOTE: There is a race between the Time of Check and the Time Of Use for // the command line. Since the caller (web page) does not have access diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc index f348c29..cecf4e8 100644 --- a/chrome/browser/views/find_bar_view.cc +++ b/chrome/browser/views/find_bar_view.cc @@ -8,7 +8,7 @@ #include "base/string_util.h" #include "chrome/browser/find_bar_controller.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/views/find_bar_win.h" #include "chrome/browser/view_ids.h" #include "chrome/common/l10n_util.h" @@ -429,7 +429,7 @@ void FindBarView::ButtonPressed(views::Button* sender) { case FIND_PREVIOUS_TAG: case FIND_NEXT_TAG: if (find_text_->GetText().length() > 0) { - container_->GetFindBarController()->web_contents()->StartFinding( + container_->GetFindBarController()->tab_contents()->StartFinding( find_text_->GetText(), sender->tag() == FIND_NEXT_TAG); } @@ -455,21 +455,21 @@ void FindBarView::ContentsChanged(views::TextField* sender, const std::wstring& new_contents) { FindBarController* controller = container_->GetFindBarController(); DCHECK(controller); - // We must guard against a NULL web_contents, which can happen if the text + // We must guard against a NULL tab_contents, which can happen if the text // in the Find box is changed right after the tab is destroyed. Otherwise, it // can lead to crashes, as exposed by automation testing in issue 8048. - if (!controller->web_contents()) + if (!controller->tab_contents()) return; // When the user changes something in the text box we check the contents and // if the textbox contains something we set it as the new search string and // initiate search (even though old searches might be in progress). if (new_contents.length() > 0) { - controller->web_contents()->StartFinding(new_contents, true); + controller->tab_contents()->StartFinding(new_contents, true); } else { // The textbox is empty so we reset. true = clear selection on page. - controller->web_contents()->StopFinding(true); - UpdateForResult(controller->web_contents()->find_result(), std::wstring()); + controller->tab_contents()->StopFinding(true); + UpdateForResult(controller->tab_contents()->find_result(), std::wstring()); } } @@ -491,7 +491,7 @@ bool FindBarView::HandleKeystroke(views::TextField* sender, UINT message, std::wstring find_string = find_text_->GetText(); if (find_string.length() > 0) { // Search forwards for enter, backwards for shift-enter. - container_->GetFindBarController()->web_contents()->StartFinding( + container_->GetFindBarController()->tab_contents()->StartFinding( find_string, GetKeyState(VK_SHIFT) >= 0); } diff --git a/chrome/browser/views/find_bar_win.cc b/chrome/browser/views/find_bar_win.cc index c60e998..5c4d7e75 100644 --- a/chrome/browser/views/find_bar_win.cc +++ b/chrome/browser/views/find_bar_win.cc @@ -12,7 +12,7 @@ #include "chrome/browser/views/bookmark_bar_view.h" #include "chrome/browser/views/find_bar_view.h" #include "chrome/browser/views/frame/browser_view.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/views/focus/external_focus_tracker.h" #include "chrome/views/focus/view_storage.h" @@ -39,7 +39,7 @@ FindBarWin::FindBarWin(BrowserView* browser_view) SetFocusChangeListener(parent_hwnd); // Don't let WidgetWin manage our lifetime. We want our lifetime to - // coincide with WebContents. + // coincide with TabContents. WidgetWin::set_delete_on_destroy(false); view_ = new FindBarView(this); @@ -217,11 +217,11 @@ bool FindBarWin::IsFindBarVisible() { void FindBarWin::MoveWindowIfNecessary(const gfx::Rect& selection_rect, bool no_redraw) { - // We only move the window if one is active for the current WebContents. If we + // We only move the window if one is active for the current TabContents. If we // don't check this, then SetDialogPosition below will end up making the Find // Bar visible. - if (!find_bar_controller_->web_contents() || - !find_bar_controller_->web_contents()->find_ui_active()) { + if (!find_bar_controller_->tab_contents() || + !find_bar_controller_->tab_contents()->find_ui_active()) { return; } @@ -253,7 +253,7 @@ bool FindBarWin::MaybeForwardKeystrokeToWebpage( return false; } - WebContents* contents = find_bar_controller_->web_contents(); + TabContents* contents = find_bar_controller_->tab_contents(); if (!contents) return false; @@ -425,7 +425,7 @@ gfx::Rect FindBarWin::GetDialogPosition(gfx::Rect avoid_overlapping_rect) { RECT frame_rect = {0}, webcontents_rect = {0}; ::GetWindowRect(GetParent(), &frame_rect); ::GetWindowRect( - find_bar_controller_->web_contents()->view()->GetNativeView(), + find_bar_controller_->tab_contents()->view()->GetNativeView(), &webcontents_rect); avoid_overlapping_rect.Offset(0, webcontents_rect.top - frame_rect.top); } @@ -503,7 +503,7 @@ void FindBarWin::SetFocusChangeListener(HWND parent_hwnd) { void FindBarWin::RestoreSavedFocus() { if (focus_tracker_.get() == NULL) { // TODO(brettw) Focus() should be on TabContentsView. - find_bar_controller_->web_contents()->Focus(); + find_bar_controller_->tab_contents()->Focus(); } else { focus_tracker_->FocusLastFocusedExternalView(); } diff --git a/chrome/browser/views/find_bar_win_browsertest.cc b/chrome/browser/views/find_bar_win_browsertest.cc index 744560a..3f93af5 100644 --- a/chrome/browser/views/find_bar_win_browsertest.cc +++ b/chrome/browser/views/find_bar_win_browsertest.cc @@ -8,7 +8,6 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/browser/views/find_bar_win.h" #include "chrome/common/notification_service.h" #include "chrome/test/in_process_browser_test.h" @@ -89,18 +88,14 @@ class FindInPageControllerTest : public InProcessBrowserTest { FindInPageDirection forward, FindInPageCase match_case, bool find_next) { - WebContents* web_contents = - browser()->GetSelectedTabContents()->AsWebContents(); - if (web_contents) { - web_contents->set_current_find_request_id( - FindInPageNotificationObserver::kFindInPageRequestId); - web_contents->render_view_host()->StartFinding( - FindInPageNotificationObserver::kFindInPageRequestId, - search_string, forward == FWD, match_case == CASE_SENSITIVE, - find_next); - return FindInPageNotificationObserver(web_contents).number_of_matches(); - } - return 0; + TabContents* tab_contents = browser()->GetSelectedTabContents(); + tab_contents->set_current_find_request_id( + FindInPageNotificationObserver::kFindInPageRequestId); + tab_contents->render_view_host()->StartFinding( + FindInPageNotificationObserver::kFindInPageRequestId, + search_string, forward == FWD, match_case == CASE_SENSITIVE, + find_next); + return FindInPageNotificationObserver(tab_contents).number_of_matches(); } }; @@ -148,10 +143,10 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFrames) { EXPECT_EQ(0, FindInPage(L"hreggvi\u00F0ur", FWD, CASE_SENSITIVE, false)); } -std::string FocusedOnPage(WebContents* web_contents) { +std::string FocusedOnPage(TabContents* tab_contents) { std::string result; ui_test_utils::ExecuteJavaScriptAndExtractString( - web_contents, + tab_contents, L"", L"window.domAutomationController.send(getFocusedElement());", &result); @@ -168,21 +163,20 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) { GURL url = server->TestServerPageW(kEndState); ui_test_utils::NavigateToURL(browser(), url); - WebContents* web_contents = - browser()->GetSelectedTabContents()->AsWebContents(); - ASSERT_TRUE(NULL != web_contents); + TabContents* tab_contents = browser()->GetSelectedTabContents(); + ASSERT_TRUE(NULL != tab_contents); // Verify that nothing has focus. - ASSERT_STREQ("{nothing focused}", FocusedOnPage(web_contents).c_str()); + ASSERT_STREQ("{nothing focused}", FocusedOnPage(tab_contents).c_str()); // Search for a text that exists within a link on the page. EXPECT_EQ(1, FindInPage(L"nk", FWD, IGNORE_CASE, false)); // End the find session, which should set focus to the link. - web_contents->StopFinding(false); + tab_contents->StopFinding(false); // Verify that the link is focused. - EXPECT_STREQ("link1", FocusedOnPage(web_contents).c_str()); + EXPECT_STREQ("link1", FocusedOnPage(tab_contents).c_str()); // Search for a text that exists within a link on the page. EXPECT_EQ(1, FindInPage(L"Google", FWD, IGNORE_CASE, false)); @@ -190,14 +184,14 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) { // Move the selection to link 1, after searching. std::string result; ui_test_utils::ExecuteJavaScriptAndExtractString( - web_contents, + tab_contents, L"", L"window.domAutomationController.send(selectLink1());", &result); // End the find session. - web_contents->StopFinding(false); + tab_contents->StopFinding(false); // Verify that link2 is not focused. - EXPECT_STREQ("", FocusedOnPage(web_contents).c_str()); + EXPECT_STREQ("", FocusedOnPage(tab_contents).c_str()); } diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 6039045..b4f68f6 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -40,7 +40,7 @@ #include "chrome/browser/views/toolbar_view.h" #include "chrome/browser/sessions/tab_restore_service.h" #include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/browser/window_sizer.h" #include "chrome/common/chrome_switches.h" @@ -335,8 +335,8 @@ void BrowserView::WindowMoved() { void BrowserView::WindowMoveOrResizeStarted() { TabContents* tab_contents = GetSelectedTabContents(); - if (tab_contents && tab_contents->AsWebContents()) - tab_contents->AsWebContents()->WindowMoveOrResizeStarted(); + if (tab_contents) + tab_contents->WindowMoveOrResizeStarted(); } gfx::Rect BrowserView::GetToolbarBounds() const { @@ -524,8 +524,8 @@ void BrowserView::Show() { // If we do find there are cases where we need to restore the focus on show, // that should be added and this should be removed. TabContents* selected_tab_contents = GetSelectedTabContents(); - if (selected_tab_contents && selected_tab_contents->AsWebContents()) - selected_tab_contents->AsWebContents()->view()->RestoreFocus(); + if (selected_tab_contents) + selected_tab_contents->view()->RestoreFocus(); frame_->Show(); } diff --git a/chrome/browser/views/html_dialog_view.cc b/chrome/browser/views/html_dialog_view.cc index 1ce1a1f..28f7bb1 100644 --- a/chrome/browser/views/html_dialog_view.cc +++ b/chrome/browser/views/html_dialog_view.cc @@ -5,7 +5,7 @@ #include "chrome/browser/views/html_dialog_view.h" #include "chrome/browser/browser.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/views/widget/root_view.h" #include "chrome/views/window/window.h" @@ -101,7 +101,7 @@ void HtmlDialogView::InitDialog() { // Set the delegate. This must be done before loading the page. See // the comment above HtmlDialogUI in its header file for why. - HtmlDialogUI::GetPropertyAccessor().SetProperty(web_contents_->property_bag(), + HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), this); DOMView::LoadURL(delegate_->GetDialogContentURL()); diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/views/hung_renderer_view.cc index 9b7b8ec8..c203893 100644 --- a/chrome/browser/views/hung_renderer_view.cc +++ b/chrome/browser/views/hung_renderer_view.cc @@ -8,7 +8,7 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/views/standard_layout.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/path.h" @@ -35,7 +35,7 @@ class HungPagesTableModel : public views::GroupTableModel { HungPagesTableModel(); virtual ~HungPagesTableModel(); - void InitForWebContents(WebContents* hung_contents); + void InitForTabContents(TabContents* hung_contents); // Overridden from views::GroupTableModel: virtual int RowCount(); @@ -45,8 +45,8 @@ class HungPagesTableModel : public views::GroupTableModel { virtual void GetGroupRangeForItem(int item, views::GroupRange* range); private: - typedef std::vector<WebContents*> WebContentsVector; - WebContentsVector webcontentses_; + typedef std::vector<TabContents*> TabContentsVector; + TabContentsVector tab_contentses_; views::TableModelObserver* observer_; @@ -62,11 +62,11 @@ HungPagesTableModel::HungPagesTableModel() : observer_(NULL) { HungPagesTableModel::~HungPagesTableModel() { } -void HungPagesTableModel::InitForWebContents(WebContents* hung_contents) { - webcontentses_.clear(); - for (WebContentsIterator it; !it.done(); ++it) { +void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) { + tab_contentses_.clear(); + for (TabContentsIterator it; !it.done(); ++it) { if (it->process() == hung_contents->process()) - webcontentses_.push_back(*it); + tab_contentses_.push_back(*it); } // The world is different. if (observer_) @@ -77,12 +77,12 @@ void HungPagesTableModel::InitForWebContents(WebContents* hung_contents) { // HungPagesTableModel, views::GroupTableModel implementation: int HungPagesTableModel::RowCount() { - return static_cast<int>(webcontentses_.size()); + return static_cast<int>(tab_contentses_.size()); } std::wstring HungPagesTableModel::GetText(int row, int column_id) { DCHECK(row >= 0 && row < RowCount()); - std::wstring title = UTF16ToWideHack(webcontentses_.at(row)->GetTitle()); + std::wstring title = UTF16ToWideHack(tab_contentses_.at(row)->GetTitle()); if (title.empty()) title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); // TODO(xji): Consider adding a special case if the title text is a URL, @@ -94,7 +94,7 @@ std::wstring HungPagesTableModel::GetText(int row, int column_id) { SkBitmap HungPagesTableModel::GetIcon(int row) { DCHECK(row >= 0 && row < RowCount()); - return webcontentses_.at(row)->GetFavIcon(); + return tab_contentses_.at(row)->GetFavIcon(); } void HungPagesTableModel::SetObserver(views::TableModelObserver* observer) { @@ -118,8 +118,8 @@ class HungRendererWarningView : public views::View, HungRendererWarningView(); ~HungRendererWarningView(); - void ShowForWebContents(WebContents* contents); - void EndForWebContents(WebContents* contents); + void ShowForTabContents(TabContents* contents); + void EndForTabContents(TabContents* contents); // views::WindowDelegate overrides: virtual std::wstring GetWindowTitle() const; @@ -146,8 +146,8 @@ class HungRendererWarningView : public views::View, void CreateKillButtonView(); // Returns the bounds the dialog should be displayed at to be meaningfully - // associated with the specified WebContents. - gfx::Rect GetDisplayBounds(WebContents* contents); + // associated with the specified TabContents. + gfx::Rect GetDisplayBounds(TabContents* contents); static void InitClass(); @@ -173,9 +173,9 @@ class HungRendererWarningView : public views::View, // pages affected by the hang. scoped_ptr<HungPagesTableModel> hung_pages_table_model_; - // The WebContents that we detected had hung in the first place resulting in + // The TabContents that we detected had hung in the first place resulting in // the display of this view. - WebContents* contents_; + TabContents* contents_; // Whether or not we've created controls for ourself. bool initialized_; @@ -215,7 +215,7 @@ HungRendererWarningView::~HungRendererWarningView() { hung_pages_table_->SetModel(NULL); } -void HungRendererWarningView::ShowForWebContents(WebContents* contents) { +void HungRendererWarningView::ShowForTabContents(TabContents* contents) { DCHECK(contents && window()); contents_ = contents; @@ -234,21 +234,21 @@ void HungRendererWarningView::ShowForWebContents(WebContents* contents) { window()->SetBounds(bounds, frame_hwnd); // We only do this if the window isn't active (i.e. hasn't been shown yet, - // or is currently shown but deactivated for another WebContents). This is + // or is currently shown but deactivated for another TabContents). This is // because this window is a singleton, and it's possible another active // renderer may hang while this one is showing, and we don't want to reset // the list of hung pages for a potentially unrelated renderer while this // one is showing. - hung_pages_table_model_->InitForWebContents(contents); + hung_pages_table_model_->InitForTabContents(contents); window()->Show(); } } -void HungRendererWarningView::EndForWebContents(WebContents* contents) { +void HungRendererWarningView::EndForTabContents(TabContents* contents) { DCHECK(contents); if (contents_ && contents_->process() == contents->process()) { window()->Close(); - // Since we're closing, we no longer need this WebContents. + // Since we're closing, we no longer need this TabContents. contents_ = NULL; } } @@ -397,7 +397,7 @@ void HungRendererWarningView::CreateKillButtonView() { } gfx::Rect HungRendererWarningView::GetDisplayBounds( - WebContents* contents) { + TabContents* contents) { HWND contents_hwnd = contents->GetNativeView(); CRect contents_bounds; GetWindowRect(contents_hwnd, &contents_bounds); @@ -434,16 +434,16 @@ static HungRendererWarningView* CreateHungRendererWarningView() { } // static -void HungRendererWarning::ShowForWebContents(WebContents* contents) { +void HungRendererWarning::ShowForTabContents(TabContents* contents) { if (!logging::DialogsAreSuppressed()) { if (!instance_) instance_ = CreateHungRendererWarningView(); - instance_->ShowForWebContents(contents); + instance_->ShowForTabContents(contents); } } // static -void HungRendererWarning::HideForWebContents(WebContents* contents) { +void HungRendererWarning::HideForTabContents(TabContents* contents) { if (!logging::DialogsAreSuppressed() && instance_) - instance_->EndForWebContents(contents); + instance_->EndForTabContents(contents); } diff --git a/chrome/browser/views/hung_renderer_view.h b/chrome/browser/views/hung_renderer_view.h index 0b26e90..def210e 100644 --- a/chrome/browser/views/hung_renderer_view.h +++ b/chrome/browser/views/hung_renderer_view.h @@ -11,12 +11,12 @@ class HungRendererWarningView; namespace views { class Window; } -class WebContents; +class TabContents; class HungRendererWarning { public: - static void ShowForWebContents(WebContents* contents); - static void HideForWebContents(WebContents* contents); + static void ShowForTabContents(TabContents* contents); + static void HideForTabContents(TabContents* contents); private: friend HungRendererWarningView; diff --git a/chrome/browser/views/jsmessage_box_dialog.cc b/chrome/browser/views/jsmessage_box_dialog.cc index 1889317..7deca87 100644 --- a/chrome/browser/views/jsmessage_box_dialog.cc +++ b/chrome/browser/views/jsmessage_box_dialog.cc @@ -5,7 +5,7 @@ #include "chrome/browser/views/jsmessage_box_dialog.h" #include "chrome/browser/app_modal_dialog.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/l10n_util.h" #include "chrome/common/message_box_flags.h" #include "chrome/views/controls/message_box_view.h" @@ -36,7 +36,7 @@ JavascriptMessageBoxDialog::~JavascriptMessageBoxDialog() { } void JavascriptMessageBoxDialog::ShowModalDialog() { - HWND root_hwnd = GetAncestor(web_contents()->GetNativeView(), + HWND root_hwnd = GetAncestor(tab_contents()->GetNativeView(), GA_ROOT); dialog_ = views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this); dialog_->Show(); diff --git a/chrome/browser/views/jsmessage_box_dialog.h b/chrome/browser/views/jsmessage_box_dialog.h index e86e8ac..cd64c9a 100644 --- a/chrome/browser/views/jsmessage_box_dialog.h +++ b/chrome/browser/views/jsmessage_box_dialog.h @@ -11,7 +11,7 @@ #include "chrome/views/window/dialog_delegate.h" class MessageBoxView; -class WebContents; +class TabContents; namespace views { class Window; } @@ -46,8 +46,8 @@ class JavascriptMessageBoxDialog : public views::DialogDelegate { virtual views::View* GetInitiallyFocusedView(); private: - WebContents* web_contents() { - return parent_->web_contents(); + TabContents* tab_contents() { + return parent_->tab_contents(); } // A pointer to the AppModalDialog that owns us. diff --git a/chrome/browser/views/sad_tab_view.h b/chrome/browser/views/sad_tab_view.h index 766ad77..3013ecf 100644 --- a/chrome/browser/views/sad_tab_view.h +++ b/chrome/browser/views/sad_tab_view.h @@ -20,7 +20,7 @@ class SkBitmap; // Note that since this view is not (currently) part of a Container or // RootView hierarchy, it cannot respond to events or contain controls that // do, right now it is used simply to render. Adding an extra Container to -// WebContents seemed like a lot of complexity. Ideally, perhaps WebContents' +// TabContents seemed like a lot of complexity. Ideally, perhaps TabContents' // view portion would itself become a Container in the future, then event // processing will work. // diff --git a/chrome/browser/views/tab_contents_container_view.cc b/chrome/browser/views/tab_contents_container_view.cc index b31f6b6..05aa615 100644 --- a/chrome/browser/views/tab_contents_container_view.cc +++ b/chrome/browser/views/tab_contents_container_view.cc @@ -11,7 +11,7 @@ #include "chrome/browser/renderer_host/render_widget_host_view.h" #include "chrome/browser/tab_contents/render_view_host_manager.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/view_ids.h" #include "chrome/common/notification_service.h" #include "chrome/views/widget/root_view.h" @@ -70,7 +70,7 @@ void TabContentsContainerView::SetTabContents(TabContents* tab_contents) { // We need to register the tab contents window with the BrowserContainer so // that the BrowserContainer is the focused view when the focus is on the - // TabContents window (for the WebContents case). + // TabContents window (for the TabContents case). SetAssociatedFocusView(this); Attach(tab_contents->GetNativeView()); @@ -128,9 +128,9 @@ void TabContentsContainerView::Focus() { void TabContentsContainerView::RequestFocus() { // This is a hack to circumvent the fact that a view does not explicitly get // a call to set the focus if it already has the focus. This causes a problem - // with tabs such as the WebContents that instruct the RenderView that it got - // focus when they actually get the focus. When switching from one WebContents - // tab that has focus to another WebContents tab that had focus, since the + // with tabs such as the TabContents that instruct the RenderView that it got + // focus when they actually get the focus. When switching from one TabContents + // tab that has focus to another TabContents tab that had focus, since the // TabContentsContainerView already has focus, Focus() would not be called and // the RenderView would not get notified it got focused. // By clearing the focused view before-hand, we ensure Focus() will be called. @@ -148,12 +148,11 @@ bool TabContentsContainerView::GetAccessibleRole( bool TabContentsContainerView::ShouldLookupAccelerators( const views::KeyEvent& e) { - // Don't look-up accelerators if we are showing a non-crashed WebContents. + // Don't look-up accelerators if we are showing a non-crashed TabContents. // We'll first give the page a chance to process the key events. If it does // not process them, they'll be returned to us and we'll treat them as // accelerators then. - if (tab_contents_ && !tab_contents_->is_crashed() && - tab_contents_->AsWebContents()) + if (tab_contents_ && !tab_contents_->is_crashed()) return false; return true; } @@ -174,7 +173,7 @@ void TabContentsContainerView::Observe(NotificationType type, } void TabContentsContainerView::AddObservers() { - // WebContents can change their RenderViewHost and hence the HWND that is + // TabContents can change their RenderViewHost and hence the HWND that is // shown and getting focused. We need to keep track of that so we install // the focus subclass on the shown HWND so we intercept focus change events. registrar_.Add(this, diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc index 7a7bf9d..83bf266 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -16,7 +16,7 @@ #include "chrome/browser/views/tabs/hwnd_photobooth.h" #include "chrome/browser/views/tabs/tab.h" #include "chrome/browser/views/tabs/tab_strip.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/animation.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/notification_service.h" diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 34c0ce9..5e8cbdc 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -12,7 +12,7 @@ #include "chrome/browser/view_ids.h" #include "chrome/browser/views/tabs/dragged_tab_controller.h" #include "chrome/browser/views/tabs/tab.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/drag_drop_types.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/path.h" |