diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-12 15:23:08 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-12 15:23:08 +0000 |
commit | 4a63e24958ec6d3c84d1eb4d8bba73db21af0a3c (patch) | |
tree | e2f495edbb471c545155e2421495500da7ef52d4 /chrome | |
parent | 075ee36cf9db4bf2c83cb1d95baf3ffb9faeda99 (diff) | |
download | chromium_src-4a63e24958ec6d3c84d1eb4d8bba73db21af0a3c.zip chromium_src-4a63e24958ec6d3c84d1eb4d8bba73db21af0a3c.tar.gz chromium_src-4a63e24958ec6d3c84d1eb4d8bba73db21af0a3c.tar.bz2 |
Clean up TCW, make it solely a hub for 1:1 observer/helper objects.
BUG=105872
TEST=no functional change
Review URL: http://codereview.chromium.org/8892011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
94 files changed, 486 insertions, 321 deletions
diff --git a/chrome/browser/alternate_nav_url_fetcher.cc b/chrome/browser/alternate_nav_url_fetcher.cc index fcb0f5a..2ab5455 100644 --- a/chrome/browser/alternate_nav_url_fetcher.cc +++ b/chrome/browser/alternate_nav_url_fetcher.cc @@ -13,6 +13,7 @@ #include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/common/url_fetcher.h" #include "grit/generated_resources.h" @@ -131,7 +132,8 @@ void AlternateNavURLFetcher::Observe( case chrome::NOTIFICATION_INSTANT_COMMITTED: { // See above. NavigationController* controller = - &content::Source<TabContentsWrapper>(source)->controller(); + &content::Source<TabContentsWrapper>(source)-> + tab_contents()->controller(); if (controller_ == controller) { delete this; } else if (!controller_) { diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index ce01531..366bcb1 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -40,6 +40,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" #include "content/public/browser/notification_service.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/autofill/autofill_external_delegate.cc b/chrome/browser/autofill/autofill_external_delegate.cc index 90f71a8..16d3ff5 100644 --- a/chrome/browser/autofill/autofill_external_delegate.cc +++ b/chrome/browser/autofill/autofill_external_delegate.cc @@ -9,6 +9,7 @@ #include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_constants.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -24,7 +25,8 @@ AutofillExternalDelegate::AutofillExternalDelegate( } void AutofillExternalDelegate::SelectAutofillSuggestionAtIndex(int listIndex) { - RenderViewHost* host = tab_contents_wrapper_->render_view_host(); + RenderViewHost* host = + tab_contents_wrapper_->tab_contents()->render_view_host(); host->Send(new AutofillMsg_SelectAutofillSuggestionAtIndex( host->routing_id(), listIndex)); diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 499ce83..29a3961 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -45,6 +45,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 7ea7e23..89ae686 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -389,8 +389,8 @@ void TabStripNotificationObserver::Observe( const content::NotificationDetails& details) { if (type == notification_) { if (type == content::NOTIFICATION_TAB_PARENTED) { - ObserveTab( - &(content::Source<TabContentsWrapper>(source).ptr()->controller())); + ObserveTab(&(content::Source<TabContentsWrapper>(source).ptr()-> + tab_contents()->controller())); } else { ObserveTab(content::Source<NavigationController>(source).ptr()); } @@ -2748,7 +2748,8 @@ void NewTabObserver::Observe(int type, const content::NotificationDetails& details) { DCHECK_EQ(content::NOTIFICATION_TAB_PARENTED, type); NavigationController* controller = - &(content::Source<TabContentsWrapper>(source).ptr()->controller()); + &(content::Source<TabContentsWrapper>(source).ptr()-> + tab_contents()->controller()); if (automation_) { // TODO(phajdan.jr): Clean up this hack. We write the correct return type // here, but don't send the message. NavigationNotificationObserver diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 88fbd3b..353bcbd 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -118,6 +118,7 @@ #include "content/browser/plugin_service.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/interstitial_page.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/child_process_host.h" @@ -526,8 +527,8 @@ void TestingAutomationProvider::AppendTab(int handle, TabContentsWrapper* contents = browser->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); if (contents) { - append_tab_response = - GetIndexForNavigationController(&contents->controller(), browser); + append_tab_response = GetIndexForNavigationController( + &contents->tab_contents()->controller(), browser); } } @@ -4811,9 +4812,9 @@ void TestingAutomationProvider::SubmitAutofillForm( base::SStringPrintf(&set_automation_id, "window.domAutomationController.setAutomationId(%d);", reply_message->routing_id()); - tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( + tab_contents->tab_contents()->render_view_host()->ExecuteJavascriptInWebFrame( frame_xpath, UTF8ToUTF16(set_automation_id)); - tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( + tab_contents->tab_contents()->render_view_host()->ExecuteJavascriptInWebFrame( frame_xpath, javascript); } diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index 6368b05..91b25f4 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -852,7 +852,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); } @@ -867,7 +868,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); } @@ -889,7 +891,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); } diff --git a/chrome/browser/chrome_browser_application_mac.mm b/chrome/browser/chrome_browser_application_mac.mm index c498832..a34695c 100644 --- a/chrome/browser/chrome_browser_application_mac.mm +++ b/chrome/browser/chrome_browser_application_mac.mm @@ -17,6 +17,7 @@ #import "chrome/common/mac/objc_zombie.h" #include "content/browser/accessibility/browser_accessibility_state.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" // The implementation of NSExceptions break various assumptions in the // Chrome code. This category defines a replacement for @@ -477,7 +478,8 @@ void SwizzleInit() { !it.done(); ++it) { if (TabContentsWrapper* contents = *it) { - if (RenderViewHost* rvh = contents->render_view_host()) { + if (RenderViewHost* rvh = + contents->tab_contents()->render_view_host()) { rvh->EnableRendererAccessibility(); } } diff --git a/chrome/browser/chromeos/login/lock_window_gtk.cc b/chrome/browser/chromeos/login/lock_window_gtk.cc index a115410..c375336 100644 --- a/chrome/browser/chromeos/login/lock_window_gtk.cc +++ b/chrome/browser/chromeos/login/lock_window_gtk.cc @@ -28,6 +28,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_widget_host_view.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index cbe2b94..a548bec 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" +#include "content/browser/tab_contents/tab_contents.h" #include "net/test/test_server.h" // Regression test for http://crbug.com/63649. diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc index 0bbb485..3d644a3 100644 --- a/chrome/browser/crash_recovery_browsertest.cc +++ b/chrome/browser/crash_recovery_browsertest.cc @@ -9,6 +9,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/common/page_transition_types.h" @@ -31,7 +32,7 @@ class CrashRecoveryBrowserTest : public InProcessBrowserTest { }; // Test that reload works after a crash. -// Disabled, http://crbug.com/29331, http://crbug.com/69637. +// Disabled, http://crbug.com/29331 , http://crbug.com/69637 . IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, Reload) { // The title of the active tab should change each time this URL is loaded. GURL url( @@ -47,7 +48,8 @@ IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, Reload) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), @@ -76,7 +78,8 @@ IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc index 03d60c5..71c3a90 100644 --- a/chrome/browser/debugger/devtools_sanity_unittest.cc +++ b/chrome/browser/debugger/devtools_sanity_unittest.cc @@ -502,7 +502,8 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestReattachAfterCrash) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 2a1fb5e..c60c1db 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -92,7 +92,7 @@ bool DevToolsWindow::IsDevToolsWindow(RenderViewHost* window_rvh) { DevToolsWindowList& instances = g_instances.Get(); for (DevToolsWindowList::iterator it = instances.begin(); it != instances.end(); ++it) { - if ((*it)->tab_contents_->render_view_host() == window_rvh) + if ((*it)->tab_contents_->tab_contents()->render_view_host() == window_rvh) return true; } return false; @@ -159,9 +159,9 @@ DevToolsWindow* DevToolsWindow::Create( // Create TabContents with devtools. TabContentsWrapper* tab_contents = Browser::TabContentsFactory(profile, NULL, MSG_ROUTING_NONE, NULL, NULL); - tab_contents->render_view_host()->AllowBindings( + tab_contents->tab_contents()->render_view_host()->AllowBindings( content::BINDINGS_POLICY_WEB_UI); - tab_contents->controller().LoadURL( + tab_contents->tab_contents()->controller().LoadURL( GetDevToolsUrl(profile, docked, shared_worker_frontend), content::Referrer(), content::PAGE_TRANSITION_START_PAGE, @@ -186,7 +186,8 @@ DevToolsWindow::DevToolsWindow(TabContentsWrapper* tab_contents, this); g_instances.Get().push_back(this); // Wipe out page icon so that the default application icon is used. - NavigationEntry* entry = tab_contents_->controller().GetActiveEntry(); + NavigationEntry* entry = + tab_contents_->tab_contents()->controller().GetActiveEntry(); entry->favicon().set_bitmap(SkBitmap()); entry->favicon().set_is_valid(true); @@ -194,11 +195,13 @@ DevToolsWindow::DevToolsWindow(TabContentsWrapper* tab_contents, registrar_.Add( this, content::NOTIFICATION_LOAD_STOP, - content::Source<NavigationController>(&tab_contents_->controller())); + content::Source<NavigationController>( + &tab_contents_->tab_contents()->controller())); registrar_.Add( this, content::NOTIFICATION_TAB_CLOSING, - content::Source<NavigationController>(&tab_contents_->controller())); + content::Source<NavigationController>( + &tab_contents_->tab_contents()->controller())); registrar_.Add( this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, @@ -263,7 +266,7 @@ void DevToolsWindow::Show(DevToolsToggleAction action) { BrowserWindow* inspected_window = inspected_browser->window(); tab_contents_->tab_contents()->set_delegate(this); inspected_window->UpdateDevTools(); - tab_contents_->view()->SetInitialFocus(); + tab_contents_->tab_contents()->view()->SetInitialFocus(); inspected_window->Show(); TabStripModel* tabstrip_model = inspected_browser->tabstrip_model(); tabstrip_model->ActivateTabAt(inspected_tab_index, true); @@ -286,7 +289,7 @@ void DevToolsWindow::Show(DevToolsToggleAction action) { if (should_show_window) { browser_->window()->Show(); - tab_contents_->view()->SetInitialFocus(); + tab_contents_->tab_contents()->view()->SetInitialFocus(); } ScheduleAction(action); @@ -327,7 +330,7 @@ void DevToolsWindow::RequestSetDocked(bool docked) { } RenderViewHost* DevToolsWindow::GetRenderViewHost() { - return tab_contents_->render_view_host(); + return tab_contents_->tab_contents()->render_view_host(); } void DevToolsWindow::CreateDevToolsBrowser() { @@ -365,7 +368,8 @@ bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser, if (!inspected_tab_) return false; - const NavigationController& controller = inspected_tab_->controller(); + const NavigationController& controller = + inspected_tab_->tab_contents()->controller(); for (BrowserList::const_iterator it = BrowserList::begin(); it != BrowserList::end(); ++it) { int tab_index = (*it)->GetIndexOfController(&controller); @@ -395,10 +399,11 @@ bool DevToolsWindow::IsInspectedBrowserPopupOrPanel() { } void DevToolsWindow::UpdateFrontendAttachedState() { - tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( - string16(), - docked_ ? ASCIIToUTF16("WebInspector.setAttachedWindow(true);") - : ASCIIToUTF16("WebInspector.setAttachedWindow(false);")); + tab_contents_->tab_contents()->render_view_host()-> + ExecuteJavascriptInWebFrame( + string16(), + docked_ ? ASCIIToUTF16("WebInspector.setAttachedWindow(true);") + : ASCIIToUTF16("WebInspector.setAttachedWindow(false);")); } @@ -446,7 +451,7 @@ void DevToolsWindow::CallClientFunction(const string16& function_name, base::JSONWriter::Write(&arg, false, &json); string16 javascript = function_name + char16('(') + UTF8ToUTF16(json) + ASCIIToUTF16(");"); - tab_contents_->render_view_host()-> + tab_contents_->tab_contents()->render_view_host()-> ExecuteJavascriptInWebFrame(string16(), javascript); } @@ -460,7 +465,7 @@ void DevToolsWindow::Observe(int type, AddDevToolsExtensionsToClient(); } else if (type == content::NOTIFICATION_TAB_CLOSING) { if (content::Source<NavigationController>(source).ptr() == - &tab_contents_->controller()) { + &tab_contents_->tab_contents()->controller()) { // This happens when browser closes all of its tabs as a result // of window.Close event. // Notify manager that this DevToolsClientHost no longer exists and @@ -484,12 +489,16 @@ void DevToolsWindow::DoAction() { // TODO: these messages should be pushed through the WebKit API instead. switch (action_on_load_) { case DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE: - tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( - string16(), ASCIIToUTF16("WebInspector.showConsole();")); + tab_contents_->tab_contents()->render_view_host()-> + ExecuteJavascriptInWebFrame( + string16(), + ASCIIToUTF16("WebInspector.showConsole();")); break; case DEVTOOLS_TOGGLE_ACTION_INSPECT: - tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( - string16(), ASCIIToUTF16("WebInspector.toggleSearchingForNode();")); + tab_contents_->tab_contents()->render_view_host()-> + ExecuteJavascriptInWebFrame( + string16(), + ASCIIToUTF16("WebInspector.toggleSearchingForNode();")); case DEVTOOLS_TOGGLE_ACTION_NONE: // Do nothing. break; @@ -539,7 +548,7 @@ void DevToolsWindow::UpdateTheme() { "WebInspector.setToolbarColors(\"%s\", \"%s\")", SkColorToRGBAString(color_toolbar).c_str(), SkColorToRGBAString(color_tab_text).c_str()); - tab_contents_->render_view_host()-> + tab_contents_->tab_contents()->render_view_host()-> ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(command)); } @@ -638,7 +647,7 @@ void DevToolsWindow::ActivateWindow() { } else { BrowserWindow* inspected_window = GetInspectedBrowserWindow(); if (inspected_window) - tab_contents_->view()->Focus(); + tab_contents_->tab_contents()->view()->Focus(); } } diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc index 8f950e89..e507542b 100644 --- a/chrome/browser/download/download_request_limiter.cc +++ b/chrome/browser/download/download_request_limiter.cc @@ -287,7 +287,7 @@ void DownloadRequestLimiter::CanDownloadImpl( TabDownloadState* state = GetDownloadState( &effective_wrapper->tab_contents()->controller(), - &originating_tab->controller(), true); + &originating_tab->tab_contents()->controller(), true); switch (state->download_status()) { case ALLOW_ALL_DOWNLOADS: if (state->download_count() && !(state->download_count() % diff --git a/chrome/browser/errorpage_browsertest.cc b/chrome/browser/errorpage_browsertest.cc index b2829be..0e1a670 100644 --- a/chrome/browser/errorpage_browsertest.cc +++ b/chrome/browser/errorpage_browsertest.cc @@ -12,6 +12,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/net/url_request_failed_dns_job.h" #include "content/browser/net/url_request_mock_http_job.h" +#include "content/browser/tab_contents/tab_contents.h" using content::BrowserThread; @@ -81,7 +82,8 @@ class ErrorPageTest : public InProcessBrowserTest { TestNavigationObserver test_navigation_observer( content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller()), + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller()), NULL, num_navigations); if (direction == HISTORY_NAVIGATE_BACK) { diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index 18fadc7..f2caf8d 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -416,7 +416,8 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::WindowedNotificationObserver reload_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); reload_observer.Wait(); EXPECT_TRUE(process_map->Contains( @@ -427,7 +428,8 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::WindowedNotificationObserver reload_observer2( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); reload_observer2.Wait(); EXPECT_FALSE(process_map->Contains( @@ -438,7 +440,8 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::WindowedNotificationObserver js_reload_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->render_view_host(), L"", L"location.reload();")); js_reload_observer.Wait(); @@ -450,7 +453,8 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::WindowedNotificationObserver js_reload_observer2( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->render_view_host(), L"", L"location.reload();")); js_reload_observer2.Wait(); @@ -599,7 +603,8 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadAppAfterCrash) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( diff --git a/chrome/browser/extensions/execute_code_in_tab_function.cc b/chrome/browser/extensions/execute_code_in_tab_function.cc index 2d27d1d..684b9ae 100644 --- a/chrome/browser/extensions/execute_code_in_tab_function.cc +++ b/chrome/browser/extensions/execute_code_in_tab_function.cc @@ -224,8 +224,9 @@ bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) { params.code = code_string; params.all_frames = all_frames_; params.in_main_world = false; - contents->render_view_host()->Send(new ExtensionMsg_ExecuteCode( - contents->render_view_host()->routing_id(), params)); + contents->tab_contents()->render_view_host()->Send( + new ExtensionMsg_ExecuteCode( + contents->tab_contents()->render_view_host()->routing_id(), params)); Observe(contents->tab_contents()); AddRef(); // balanced in OnExecuteCodeFinished() diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc index 5585ec1..8f3a461 100644 --- a/chrome/browser/extensions/extension_browsertests_misc.cc +++ b/chrome/browser/extensions/extension_browsertests_misc.cc @@ -805,7 +805,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); } @@ -831,7 +832,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); } diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc index 2dd874a..e6fee79 100644 --- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc +++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc @@ -472,7 +472,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); } diff --git a/chrome/browser/extensions/extension_devtools_bridge.cc b/chrome/browser/extensions/extension_devtools_bridge.cc index 237e072..b59232f 100644 --- a/chrome/browser/extensions/extension_devtools_bridge.cc +++ b/chrome/browser/extensions/extension_devtools_bridge.cc @@ -61,7 +61,7 @@ bool ExtensionDevToolsBridge::RegisterAsDevToolsClientHost() { &contents, &tab_index)) { DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( - contents->render_view_host()); + contents->tab_contents()->render_view_host()); if (devtools_manager->GetDevToolsClientHostFor(agent)) return false; diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index 361c408..9bf1402 100644 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -194,11 +194,12 @@ void ExtensionMessageService::OpenChannelToTab( MessagePort receiver; if (ExtensionTabUtil::GetTabById(tab_id, profile, true, NULL, NULL, &contents, NULL)) { - receiver.sender = contents->render_view_host(); - receiver.routing_id = contents->render_view_host()->routing_id(); + receiver.sender = contents->tab_contents()->render_view_host(); + receiver.routing_id = + contents->tab_contents()->render_view_host()->routing_id(); } - if (contents && contents->controller().needs_reload()) { + if (contents && contents->tab_contents()->controller().needs_reload()) { // The tab isn't loaded yet. Don't attempt to connect. Treat this as a // disconnect. DispatchOnDisconnect(MessagePort(source, MSG_ROUTING_CONTROL), diff --git a/chrome/browser/extensions/extension_page_actions_module.cc b/chrome/browser/extensions/extension_page_actions_module.cc index 65d9cbb..5e2aa5c 100644 --- a/chrome/browser/extensions/extension_page_actions_module.cc +++ b/chrome/browser/extensions/extension_page_actions_module.cc @@ -80,7 +80,8 @@ bool PageActionFunction::SetPageActionEnabled(bool enable) { } // Make sure the URL hasn't changed. - NavigationEntry* entry = contents->controller().GetActiveEntry(); + NavigationEntry* entry = + contents->tab_contents()->controller().GetActiveEntry(); if (!entry || url != entry->url().spec()) { error_ = ExtensionErrorUtils::FormatErrorMessage(kUrlNotActiveError, url); return false; diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc index 8b5d6fa6..71b58f1 100644 --- a/chrome/browser/extensions/extension_tab_helper.cc +++ b/chrome/browser/extensions/extension_tab_helper.cc @@ -169,7 +169,7 @@ void ExtensionTabHelper::OnGetAppNotifyChannel( ExtensionService* extension_service = profile->GetExtensionService(); extensions::ProcessMap* process_map = extension_service->process_map(); content::RenderProcessHost* process = - tab_contents_wrapper()->render_view_host()->process(); + tab_contents_wrapper()->tab_contents()->render_view_host()->process(); const Extension* extension = extension_service->GetInstalledApp(requestor_url); bool allowed = diff --git a/chrome/browser/extensions/extension_tab_id_map.cc b/chrome/browser/extensions/extension_tab_id_map.cc index 581e8e4..f799dd1 100644 --- a/chrome/browser/extensions/extension_tab_id_map.cc +++ b/chrome/browser/extensions/extension_tab_id_map.cc @@ -82,7 +82,7 @@ void ExtensionTabIdMap::TabObserver::Observe( case content::NOTIFICATION_TAB_PARENTED: { TabContentsWrapper* tab = content::Source<TabContentsWrapper>(source).ptr(); - RenderViewHost* host = tab->render_view_host(); + RenderViewHost* host = tab->tab_contents()->render_view_host(); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind( @@ -101,7 +101,7 @@ void ExtensionTabIdMap::TabObserver::Observe( TabContentsWrapper::GetCurrentWrapperForContents(contents); if (!tab) break; - RenderViewHost* host = tab->render_view_host(); + RenderViewHost* host = tab->tab_contents()->render_view_host(); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind( diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index e5ee9b8..7e34d9e 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -898,7 +898,7 @@ bool CreateTabFunction::RunImpl() { browser::Navigate(¶ms); if (active) - params.target_contents->view()->SetInitialFocus(); + params.target_contents->tab_contents()->view()->SetInitialFocus(); // Return data about the newly created tab. if (has_callback()) { @@ -1033,7 +1033,7 @@ bool UpdateTabFunction::RunImpl() { NULL, &tab_strip, &contents, &tab_index, &error_)) { return false; } - NavigationController& controller = contents->controller(); + NavigationController& controller = contents->tab_contents()->controller(); // TODO(rafaelw): handle setting remaining tab properties: // -title @@ -1376,7 +1376,8 @@ bool RemoveTabsFunction::RunImpl() { // is being dragged, or we're in some other nested event loop. This code // path should ensure that the tab is safely closed under such // circumstances, whereas |Browser::CloseTabContents()| does not. - RenderViewHost* render_view_host = contents->render_view_host(); + RenderViewHost* render_view_host = + contents->tab_contents()->render_view_host(); render_view_host->delegate()->Close(render_view_host); } return true; @@ -1574,7 +1575,7 @@ bool DetectTabLanguageFunction::RunImpl() { return false; } - if (contents->controller().needs_reload()) { + if (contents->tab_contents()->controller().needs_reload()) { // If the tab hasn't been loaded, don't wait for the tab to load. error_ = keys::kCannotDetermineLanguageOfUnloadedTab; return false; @@ -1597,10 +1598,12 @@ bool DetectTabLanguageFunction::RunImpl() { content::Source<TabContents>(contents->tab_contents())); registrar_.Add( this, content::NOTIFICATION_TAB_CLOSING, - content::Source<NavigationController>(&(contents->controller()))); + content::Source<NavigationController>( + &(contents->tab_contents()->controller()))); registrar_.Add( this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::Source<NavigationController>(&(contents->controller()))); + content::Source<NavigationController>( + &(contents->tab_contents()->controller()))); return true; } diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index 7769bbc..a14d87a 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -118,7 +118,8 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, CookieIsolation) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); EXPECT_TRUE(HasCookie(tab1, "app1=3")); diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 267b483..459936d 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -42,6 +42,7 @@ #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/provisional_load_details.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/intents_host.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/notification_service.h" @@ -167,7 +168,7 @@ bool ExternalTabContainer::Init(Profile* profile, if (existing_contents) { tab_contents_.reset(existing_contents); - tab_contents_->controller().set_browser_context(profile); + tab_contents_->tab_contents()->controller().set_browser_context(profile); } else { TabContents* new_contents = new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL, NULL); @@ -184,11 +185,12 @@ bool ExternalTabContainer::Init(Profile* profile, handle_top_level_requests; if (!existing_contents) { - tab_contents_->render_view_host()->AllowBindings( + tab_contents_->tab_contents()->render_view_host()->AllowBindings( content::BINDINGS_POLICY_EXTERNAL_HOST); } - NavigationController* controller = &tab_contents_->controller(); + NavigationController* controller = + &tab_contents_->tab_contents()->controller(); registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>(controller)); registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, @@ -236,14 +238,15 @@ bool ExternalTabContainer::Init(Profile* profile, void ExternalTabContainer::Uninitialize() { registrar_.RemoveAll(); if (tab_contents_.get()) { - UnregisterRenderViewHost(tab_contents_->render_view_host()); + UnregisterRenderViewHost(tab_contents_->tab_contents()->render_view_host()); if (GetWidget()->GetRootView()) GetWidget()->GetRootView()->RemoveAllChildViews(true); content::NotificationService::current()->Notify( chrome::NOTIFICATION_EXTERNAL_TAB_CLOSED, - content::Source<NavigationController>(&tab_contents_->controller()), + content::Source<NavigationController>( + &tab_contents_->tab_contents()->controller()), content::Details<ExternalTabContainer>(this)); tab_contents_.reset(NULL); @@ -817,7 +820,8 @@ void ExternalTabContainer::Observe(int type, // 0th entry will be +1). if (InitNavigationInfo(&navigation_info, commit->type, commit->previous_entry_index - - tab_contents_->controller().last_committed_entry_index())) + tab_contents_->tab_contents()-> + controller().last_committed_entry_index())) automation_->Send(new AutomationMsg_DidNavigate(tab_handle_, navigation_info)); } @@ -938,7 +942,8 @@ bool ExternalTabContainer::InitNavigationInfo(NavigationInfo* nav_info, content::NavigationType nav_type, int relative_offset) { DCHECK(nav_info); - NavigationEntry* entry = tab_contents_->controller().GetActiveEntry(); + NavigationEntry* entry = + tab_contents_->tab_contents()->controller().GetActiveEntry(); // If this is very early in the game then we may not have an entry. if (!entry) return false; @@ -946,7 +951,7 @@ bool ExternalTabContainer::InitNavigationInfo(NavigationInfo* nav_info, nav_info->navigation_type = nav_type; nav_info->relative_offset = relative_offset; nav_info->navigation_index = - tab_contents_->controller().GetCurrentEntryIndex(); + tab_contents_->tab_contents()->controller().GetCurrentEntryIndex(); nav_info->url = entry->url(); nav_info->referrer = entry->referrer().url; nav_info->title = UTF16ToWideHack(entry->title()); @@ -994,12 +999,13 @@ bool ExternalTabContainer::AcceleratorPressed( accelerator_table_.find(accelerator); DCHECK(iter != accelerator_table_.end()); - if (!tab_contents_.get() || !tab_contents_->render_view_host()) { + if (!tab_contents_.get() || + !tab_contents_->tab_contents()->render_view_host()) { NOTREACHED(); return false; } - RenderViewHost* host = tab_contents_->render_view_host(); + RenderViewHost* host = tab_contents_->tab_contents()->render_view_host(); int command_id = iter->second; switch (command_id) { case IDC_ZOOM_PLUS: @@ -1013,16 +1019,17 @@ bool ExternalTabContainer::AcceleratorPressed( break; case IDC_DEV_TOOLS: DevToolsWindow::ToggleDevToolsWindow( - tab_contents_->render_view_host(), DEVTOOLS_TOGGLE_ACTION_NONE); + tab_contents_->tab_contents()->render_view_host(), + DEVTOOLS_TOGGLE_ACTION_NONE); break; case IDC_DEV_TOOLS_CONSOLE: DevToolsWindow::ToggleDevToolsWindow( - tab_contents_->render_view_host(), + tab_contents_->tab_contents()->render_view_host(), DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); break; case IDC_DEV_TOOLS_INSPECT: DevToolsWindow::ToggleDevToolsWindow( - tab_contents_->render_view_host(), + tab_contents_->tab_contents()->render_view_host(), DEVTOOLS_TOGGLE_ACTION_INSPECT); break; default: @@ -1040,7 +1047,7 @@ void ExternalTabContainer::Navigate(const GURL& url, const GURL& referrer) { TRACE_EVENT_BEGIN_ETW("ExternalTabContainer::Navigate", 0, url.spec()); - tab_contents_->controller().LoadURL( + tab_contents_->tab_contents()->controller().LoadURL( url, content::Referrer(referrer, WebKit::WebReferrerPolicyDefault), content::PAGE_TRANSITION_START_PAGE, std::string()); } @@ -1093,7 +1100,7 @@ void ExternalTabContainer::LoadAccelerators() { void ExternalTabContainer::OnReinitialize() { if (load_requests_via_automation_) { - RenderViewHost* rvh = tab_contents_->render_view_host(); + RenderViewHost* rvh = tab_contents_->tab_contents()->render_view_host(); if (rvh) { AutomationResourceMessageFilter::ResumePendingRenderView( rvh->process()->GetID(), rvh->routing_id(), diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index 82793b5..6f324d92 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -324,7 +324,7 @@ class GeolocationBrowserTest : public InProcessBrowserTest { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &tab_contents_wrapper->controller())); + &tab_contents_wrapper->tab_contents()->controller())); if (allowed) infobar_->AsConfirmInfoBarDelegate()->Accept(); else diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc index b1396f6..b8f10d1 100644 --- a/chrome/browser/instant/instant_controller.cc +++ b/chrome/browser/instant/instant_controller.cc @@ -269,7 +269,8 @@ TabContentsWrapper* InstantController::CommitCurrentPreview( InstantCommitType type) { DCHECK(loader_.get()); TabContentsWrapper* tab = ReleasePreviewContents(type); - tab->controller().CopyStateFromAndPrune(&tab_contents_->controller()); + tab->tab_contents()->controller().CopyStateFromAndPrune( + &tab_contents_->tab_contents()->controller()); delegate_->CommitInstant(tab); CompleteRelease(tab); return tab; diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 767dad6..783644e 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -290,7 +290,7 @@ InstantLoader::TabContentsDelegateImpl::TabContentsDelegateImpl( content::Source<TabContents>(loader->preview_contents()->tab_contents())); registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, content::Source<NavigationController>( - &loader->preview_contents()->controller())); + &loader->preview_contents()->tab_contents()->controller())); } void InstantLoader::TabContentsDelegateImpl::PrepareForNewLoad() { @@ -547,9 +547,11 @@ void InstantLoader::TabContentsDelegateImpl::OnSetSuggestions( const std::vector<std::string>& suggestions, InstantCompleteBehavior behavior) { TabContentsWrapper* source = loader_->preview_contents(); - if (!source->controller().GetActiveEntry() || - page_id != source->controller().GetActiveEntry()->page_id()) + if (!source->tab_contents()->controller().GetActiveEntry() || + page_id != + source->tab_contents()->controller().GetActiveEntry()->page_id()) { return; + } if (suggestions.empty()) loader_->SetCompleteSuggestedText(string16(), behavior); @@ -668,7 +670,8 @@ bool InstantLoader::Update(TabContentsWrapper* tab_contents, } // TODO: support real cursor position. int text_length = static_cast<int>(user_text_.size()); - RenderViewHost* host = preview_contents_->render_view_host(); + RenderViewHost* host = + preview_contents_->tab_contents()->render_view_host(); host->Send(new ChromeViewMsg_SearchBoxChange( host->routing_id(), user_text_, verbatim, text_length, text_length)); @@ -690,8 +693,8 @@ bool InstantLoader::Update(TabContentsWrapper* tab_contents, DCHECK(template_url_id_ == 0); preview_tab_contents_delegate_->PrepareForNewLoad(); frame_load_observer_.reset(NULL); - preview_contents_->controller().LoadURL(url_, content::Referrer(), - transition_type, std::string()); + preview_contents_->tab_contents()->controller().LoadURL( + url_, content::Referrer(), transition_type, std::string()); } return true; } @@ -737,7 +740,8 @@ TabContentsWrapper* InstantLoader::ReleasePreviewContents( DCHECK(type == INSTANT_COMMIT_DESTROY || !frame_load_observer_.get()); if (type != INSTANT_COMMIT_DESTROY && is_showing_instant()) { - RenderViewHost* host = preview_contents_->render_view_host(); + RenderViewHost* host = + preview_contents_->tab_contents()->render_view_host(); if (type == INSTANT_COMMIT_FOCUS_LOST) { host->Send(new ChromeViewMsg_SearchBoxCancel(host->routing_id())); } else { @@ -770,7 +774,7 @@ TabContentsWrapper* InstantLoader::ReleasePreviewContents( this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, content::Source<NavigationController>( - &preview_contents_->controller())); + &preview_contents_->tab_contents()->controller())); #endif } preview_contents_->tab_contents()->set_delegate(NULL); @@ -807,7 +811,7 @@ void InstantLoader::MaybeLoadInstantURL(TabContentsWrapper* tab_contents, bool InstantLoader::IsNavigationPending() const { return preview_contents_.get() && - preview_contents_->controller().pending_entry(); + preview_contents_->tab_contents()->controller().pending_entry(); } void InstantLoader::Observe(int type, @@ -962,7 +966,8 @@ void InstantLoader::SendBoundsToPage(bool force_if_waiting) { if (preview_contents_.get() && is_showing_instant() && (force_if_waiting || !is_determining_if_page_supports_instant())) { last_omnibox_bounds_ = omnibox_bounds_; - RenderViewHost* host = preview_contents_->render_view_host(); + RenderViewHost* host = + preview_contents_->tab_contents()->render_view_host(); host->Send(new ChromeViewMsg_SearchBoxResize( host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); } @@ -988,11 +993,14 @@ void InstantLoader::ReplacePreviewContents(TabContentsWrapper* old_tc, registrar_.Remove( this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, - content::Source<NavigationController>(&old_tc->controller())); + content::Source<NavigationController>( + &old_tc->tab_contents()->controller())); #endif - registrar_.Remove(this, - content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::Source<NavigationController>(&old_tc->controller())); + registrar_.Remove( + this, + content::NOTIFICATION_NAV_ENTRY_COMMITTED, + content::Source<NavigationController>( + &old_tc->tab_contents()->controller())); // We prerendered so we should be ready to show. If we're ready, swap in // immediately, otherwise show the preview as normal. @@ -1015,8 +1023,10 @@ void InstantLoader::SetupPreviewContents(TabContentsWrapper* tab_contents) { // NavigationControllers (which happens if we commit) none of the page ids // will overlap. int32 max_page_id = tab_contents->tab_contents()->GetMaxPageID(); - if (max_page_id != -1) - preview_contents_->controller().set_max_restored_page_id(max_page_id + 1); + if (max_page_id != -1) { + preview_contents_->tab_contents()->controller().set_max_restored_page_id( + max_page_id + 1); + } #if defined(OS_MACOSX) // If |preview_contents_| does not currently have a RWHV, we will call @@ -1029,17 +1039,19 @@ void InstantLoader::SetupPreviewContents(TabContentsWrapper* tab_contents) { registrar_.Add( this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, - content::Source<NavigationController>(&preview_contents_->controller())); + content::Source<NavigationController>( + &preview_contents_->tab_contents()->controller())); #endif registrar_.Add( this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::Source<NavigationController>(&preview_contents_->controller())); + content::Source<NavigationController>( + &preview_contents_->tab_contents()->controller())); gfx::Rect tab_bounds; - tab_contents->view()->GetContainerBounds(&tab_bounds); - preview_contents_->view()->SizeContents(tab_bounds.size()); + tab_contents->tab_contents()->view()->GetContainerBounds(&tab_bounds); + preview_contents_->tab_contents()->view()->SizeContents(tab_bounds.size()); } void InstantLoader::CreatePreviewContents(TabContentsWrapper* tab_contents) { @@ -1074,9 +1086,9 @@ void InstantLoader::LoadInstantURL(TabContentsWrapper* tab_contents, CommandLine* cl = CommandLine::ForCurrentProcess(); if (cl->HasSwitch(switches::kInstantURL)) instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); - preview_contents_->controller().LoadURL(instant_url, content::Referrer(), - transition_type, std::string()); - RenderViewHost* host = preview_contents_->render_view_host(); + preview_contents_->tab_contents()->controller().LoadURL( + instant_url, content::Referrer(), transition_type, std::string()); + RenderViewHost* host = preview_contents_->tab_contents()->render_view_host(); preview_contents_->tab_contents()->HideContents(); // If user_text is empty, this must be a preload of the search homepage. In diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index 859a924..bded9c0 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -8,8 +8,6 @@ #include "base/message_loop.h" #include "base/metrics/histogram.h" #include "base/task.h" -// TODO(avi): remove when conversions not needed any more -#include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" @@ -29,6 +27,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/navigation_details.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" @@ -150,7 +149,7 @@ bool HintInfoBar::Accept() { // OmniboxSearchHint ---------------------------------------------------------- OmniboxSearchHint::OmniboxSearchHint(TabContentsWrapper* tab) : tab_(tab) { - NavigationController* controller = &(tab->controller()); + NavigationController* controller = &(tab->tab_contents()->controller()); notification_registrar_.Add( this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, @@ -172,7 +171,8 @@ void OmniboxSearchHint::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { - NavigationEntry* entry = tab_->controller().GetActiveEntry(); + NavigationEntry* entry = + tab_->tab_contents()->controller().GetActiveEntry(); if (search_engine_urls_.find(entry->url().spec()) == search_engine_urls_.end()) { // The search engine is not in our white-list, bail. diff --git a/chrome/browser/password_manager_delegate_impl.cc b/chrome/browser/password_manager_delegate_impl.cc index 550aafb..3c423a6 100644 --- a/chrome/browser/password_manager_delegate_impl.cc +++ b/chrome/browser/password_manager_delegate_impl.cc @@ -13,6 +13,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/autofill_messages.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources_standard.h" @@ -110,8 +111,10 @@ bool SavePasswordInfoBarDelegate::Cancel() { void PasswordManagerDelegateImpl::FillPasswordForm( const webkit_glue::PasswordFormFillData& form_data) { - tab_contents_->render_view_host()->Send(new AutofillMsg_FillPasswordForm( - tab_contents_->render_view_host()->routing_id(), form_data)); + tab_contents_->tab_contents()->render_view_host()->Send( + new AutofillMsg_FillPasswordForm( + tab_contents_->tab_contents()->render_view_host()->routing_id(), + form_data)); } void PasswordManagerDelegateImpl::AddSavePasswordInfoBar( @@ -126,6 +129,6 @@ Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() { } bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { - return tab_contents_->controller().ssl_manager()-> + return tab_contents_->tab_contents()->controller().ssl_manager()-> ProcessedSSLErrorFromRequest(); } diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 6634fd8..d6ef959 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -1353,9 +1353,12 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderRendererCrash) { // Navigate to about:crash and then wait for the renderer to crash. ASSERT_TRUE(GetPrerenderContents()); ASSERT_TRUE(GetPrerenderContents()->prerender_contents()); - GetPrerenderContents()->prerender_contents()->controller().LoadURL( - GURL(chrome::kAboutCrashURL), content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + GetPrerenderContents()->prerender_contents()->tab_contents()->controller(). + LoadURL( + GURL(chrome::kAboutCrashURL), + content::Referrer(), + content::PAGE_TRANSITION_TYPED, + std::string()); ui_test_utils::RunMessageLoop(); } diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index 4cce935..d6e4ab4 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -27,6 +27,7 @@ #include "content/browser/in_process_webkit/session_storage_namespace.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/resource_request_details.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/notification_service.h" @@ -282,13 +283,14 @@ void PrerenderContents::StartPrerendering( if (starting_page_id_ < 0) starting_page_id_ = 0; starting_page_id_ += kPrerenderPageIdOffset; - prerender_contents_->controller().set_max_restored_page_id(starting_page_id_); + prerender_contents_->tab_contents()->controller().set_max_restored_page_id( + starting_page_id_); tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); new_contents->set_delegate(tab_contents_delegate_.get()); // Set the size of the prerender TabContents. - prerender_contents_->view()->SizeContents(tab_bounds.size()); + prerender_contents_->tab_contents()->view()->SizeContents(tab_bounds.size()); // Register as an observer of the RenderViewHost so we get messages. render_view_host_observer_.reset( @@ -667,7 +669,7 @@ RenderViewHost* PrerenderContents::render_view_host_mutable() { const RenderViewHost* PrerenderContents::render_view_host() const { if (!prerender_contents_.get()) return NULL; - return prerender_contents_->render_view_host(); + return prerender_contents_->tab_contents()->render_view_host(); } void PrerenderContents::CommitHistory(TabContentsWrapper* tab) { diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index 43e69af..134a51b 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc @@ -609,7 +609,8 @@ bool PrerenderManager::MaybeUsePrerenderedPage(TabContents* tab_contents, // If the session storage namespaces don't match, cancel the prerender. RenderViewHost* old_render_view_host = tab_contents->render_view_host(); RenderViewHost* new_render_view_host = - prerender_contents->prerender_contents()->render_view_host(); + prerender_contents->prerender_contents()->tab_contents()-> + render_view_host(); DCHECK(old_render_view_host); DCHECK(new_render_view_host); if (old_render_view_host->session_storage_namespace() != @@ -662,8 +663,8 @@ bool PrerenderManager::MaybeUsePrerenderedPage(TabContents* tab_contents, MarkTabContentsAsPrerendered(new_tab_contents->tab_contents()); // Merge the browsing history. - new_tab_contents->controller().CopyStateFromAndPrune( - &old_tab_contents->controller()); + new_tab_contents->tab_contents()->controller().CopyStateFromAndPrune( + &old_tab_contents->tab_contents()->controller()); old_tab_contents->core_tab_helper()->delegate()-> SwapTabContents(old_tab_contents, new_tab_contents); prerender_contents->CommitHistory(new_tab_contents); @@ -693,7 +694,8 @@ bool PrerenderManager::MaybeUsePrerenderedPage(TabContents* tab_contents, // Schedule the delete to occur after the tab has run its unload handlers. on_close_tab_contents_deleters_.push_back( new OnCloseTabContentsDeleter(this, old_tab_contents)); - old_tab_contents->render_view_host()->FirePageBeforeUnload(false); + old_tab_contents->tab_contents()->render_view_host()-> + FirePageBeforeUnload(false); } else { // No unload handler to run, so delete asap. ScheduleDeleteOldTabContents(old_tab_contents, NULL); diff --git a/chrome/browser/printing/background_printing_manager.cc b/chrome/browser/printing/background_printing_manager.cc index 206c04a..9ccf27e 100644 --- a/chrome/browser/printing/background_printing_manager.cc +++ b/chrome/browser/printing/background_printing_manager.cc @@ -12,6 +12,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_notification_types.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" @@ -58,7 +59,8 @@ void BackgroundPrintingManager::OwnPrintPreviewTab( // // Multiple sites may share the same RenderProcessHost, so check if this // notification has already been added. - content::RenderProcessHost* rph = preview_tab->render_view_host()->process(); + content::RenderProcessHost* rph = + preview_tab->tab_contents()->render_view_host()->process(); if (!registrar_.IsRegistered(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::Source<content::RenderProcessHost>( @@ -113,7 +115,7 @@ void BackgroundPrintingManager::OnRendererProcessClosed( TabContentsWrapperSet::const_iterator it; for (it = begin(); it != end(); ++it) { TabContentsWrapper* preview_tab = *it; - if (preview_tab->render_view_host()->process() == rph) { + if (preview_tab->tab_contents()->render_view_host()->process() == rph) { preview_tabs_pending_deletion.insert(preview_tab); } } @@ -146,7 +148,7 @@ void BackgroundPrintingManager::OnTabContentsDestroyed( HasSharedRenderProcessHost(printing_tabs_pending_deletion_, preview_tab); if (!shared_rph) { content::RenderProcessHost* rph = - preview_tab->render_view_host()->process(); + preview_tab->tab_contents()->render_view_host()->process(); registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::Source<content::RenderProcessHost>(rph)); } @@ -174,13 +176,14 @@ void BackgroundPrintingManager::DeletePreviewTab(TabContentsWrapper* tab) { bool BackgroundPrintingManager::HasSharedRenderProcessHost( const TabContentsWrapperSet& set, TabContentsWrapper* tab) { - content::RenderProcessHost* rph = tab->render_view_host()->process(); + content::RenderProcessHost* rph = + tab->tab_contents()->render_view_host()->process(); for (TabContentsWrapperSet::const_iterator it = set.begin(); it != set.end(); ++it) { TabContentsWrapper* iter_tab = *it; if ((iter_tab != tab) && - (iter_tab->render_view_host()->process() == rph)) { + (iter_tab->tab_contents()->render_view_host()->process() == rph)) { return true; } } diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc index 50770ad..7a0470a 100644 --- a/chrome/browser/printing/print_preview_message_handler.cc +++ b/chrome/browser/printing/print_preview_message_handler.cc @@ -91,10 +91,11 @@ PrintPreviewUI* PrintPreviewMessageHandler::OnFailure(int document_cookie) { // Inform the print preview tab of the failure. TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); // User might have closed it already. - if (!print_preview_tab || !print_preview_tab->web_ui()) + if (!print_preview_tab || !print_preview_tab->tab_contents()->web_ui()) return NULL; - return static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); + return static_cast<PrintPreviewUI*>( + print_preview_tab->tab_contents()->web_ui()); } void PrintPreviewMessageHandler::OnRequestPrintPreview( @@ -112,11 +113,11 @@ void PrintPreviewMessageHandler::OnDidGetPreviewPageCount( } TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); - if (!print_preview_tab || !print_preview_tab->web_ui()) + if (!print_preview_tab || !print_preview_tab->tab_contents()->web_ui()) return; PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); + static_cast<PrintPreviewUI*>(print_preview_tab->tab_contents()->web_ui()); if (!params.is_modifiable || params.clear_preview_data) print_preview_ui->ClearAllPreviewData(); @@ -127,11 +128,11 @@ void PrintPreviewMessageHandler::OnDidGetPreviewPageCount( void PrintPreviewMessageHandler::OnDidPreviewPage( const PrintHostMsg_DidPreviewPage_Params& params) { TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); - if (!print_preview_tab || !print_preview_tab->web_ui()) + if (!print_preview_tab || !print_preview_tab->tab_contents()->web_ui()) return; PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); + static_cast<PrintPreviewUI*>(print_preview_tab->tab_contents()->web_ui()); int page_number = params.page_number; if (page_number >= FIRST_PAGE_INDEX && params.data_size) { RefCountedBytes* data_bytes = @@ -156,11 +157,11 @@ void PrintPreviewMessageHandler::OnMetafileReadyForPrinting( // Get the print preview tab. TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); // User might have closed it already. - if (!print_preview_tab || !print_preview_tab->web_ui()) + if (!print_preview_tab || !print_preview_tab->tab_contents()->web_ui()) return; PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); + static_cast<PrintPreviewUI*>(print_preview_tab->tab_contents()->web_ui()); if (params.reuse_existing_data) { // Need to match normal rendering where we are expected to send this. @@ -198,11 +199,11 @@ void PrintPreviewMessageHandler::OnPrintPreviewFailed(int document_cookie) { void PrintPreviewMessageHandler::OnDidGetDefaultPageLayout( const PageSizeMargins& page_layout_in_points) { TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); - if (!print_preview_tab || !print_preview_tab->web_ui()) + if (!print_preview_tab || !print_preview_tab->tab_contents()->web_ui()) return; PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); + static_cast<PrintPreviewUI*>(print_preview_tab->tab_contents()->web_ui()); print_preview_ui->OnDidGetDefaultPageLayout(page_layout_in_points); } diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc index 8295e97..5c7d56e 100644 --- a/chrome/browser/printing/print_preview_tab_controller.cc +++ b/chrome/browser/printing/print_preview_tab_controller.cc @@ -41,8 +41,8 @@ namespace { void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) { // Always enable the internal PDF plugin for the print preview page. ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( - preview_tab->render_view_host()->process()->GetID(), - preview_tab->render_view_host()->routing_id(), + preview_tab->tab_contents()->render_view_host()->process()->GetID(), + preview_tab->tab_contents()->render_view_host()->routing_id(), GURL(), ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); } @@ -243,10 +243,11 @@ void PrintPreviewTabController::OnRendererProcessClosed( iter != preview_tab_map_.end(); ++iter) { TabContentsWrapper* preview_tab = iter->first; TabContentsWrapper* initiator_tab = iter->second; - if (preview_tab->render_view_host()->process() == rph) { + if (preview_tab->tab_contents()->render_view_host()->process() == rph) { closed_preview_tabs.push_back(preview_tab); } else if (initiator_tab && - initiator_tab->render_view_host()->process() == rph) { + initiator_tab->tab_contents()->render_view_host()->process() + == rph) { closed_initiator_tabs.push_back(initiator_tab); } } @@ -254,7 +255,8 @@ void PrintPreviewTabController::OnRendererProcessClosed( for (size_t i = 0; i < closed_preview_tabs.size(); ++i) { RemovePreviewTab(closed_preview_tabs[i]); PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(closed_preview_tabs[i]->web_ui()); + static_cast<PrintPreviewUI*>( + closed_preview_tabs[i]->tab_contents()->web_ui()); if (print_preview_ui) print_preview_ui->OnPrintPreviewTabClosed(); } @@ -394,9 +396,9 @@ TabContentsWrapper* PrintPreviewTabController::CreatePrintPreviewTab( void PrintPreviewTabController::SetInitiatorTabURLAndTitle( TabContentsWrapper* preview_tab) { TabContentsWrapper* initiator_tab = GetInitiatorTab(preview_tab); - if (initiator_tab && preview_tab->web_ui()) { + if (initiator_tab && preview_tab->tab_contents()->web_ui()) { PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(preview_tab->web_ui()); + static_cast<PrintPreviewUI*>(preview_tab->tab_contents()->web_ui()); print_preview_ui->SetInitiatorTabURLAndTitle( initiator_tab->tab_contents()->GetURL().spec(), initiator_tab->print_view_manager()->RenderSourceName()); @@ -413,7 +415,8 @@ void PrintPreviewTabController::AddObservers(TabContentsWrapper* tab) { // Multiple sites may share the same RenderProcessHost, so check if this // notification has already been added. - content::RenderProcessHost* rph = tab->render_view_host()->process(); + content::RenderProcessHost* rph = + tab->tab_contents()->render_view_host()->process(); if (!registrar_.IsRegistered(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::Source<content::RenderProcessHost>( @@ -433,7 +436,8 @@ void PrintPreviewTabController::RemoveObservers(TabContentsWrapper* tab) { // Multiple sites may share the same RenderProcessHost, so check if this // notification has already been added. - content::RenderProcessHost* rph = tab->render_view_host()->process(); + content::RenderProcessHost* rph = + tab->tab_contents()->render_view_host()->process(); if (registrar_.IsRegistered(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::Source<content::RenderProcessHost>( @@ -460,7 +464,7 @@ void PrintPreviewTabController::RemoveInitiatorTab( // Initiator tab is closed. Close the print preview tab too. PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(preview_tab->web_ui()); + static_cast<PrintPreviewUI*>(preview_tab->tab_contents()->web_ui()); if (print_preview_ui) print_preview_ui->OnInitiatorTabClosed(); } @@ -477,7 +481,7 @@ void PrintPreviewTabController::RemovePreviewTab( // Print preview TabContents is destroyed. Notify |PrintPreviewUI| to abort // the initiator tab preview request. PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(preview_tab->web_ui()); + static_cast<PrintPreviewUI*>(preview_tab->tab_contents()->web_ui()); if (print_preview_ui) print_preview_ui->OnTabDestroyed(); diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index c89c841..84b9237 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -102,10 +102,10 @@ bool PrintViewManager::AdvancedPrintNow() { tab_controller->GetPrintPreviewForTab(tab_); if (print_preview_tab) { // Preview tab exist for current tab or current tab is preview tab. - if (!print_preview_tab->web_ui()) + if (!print_preview_tab->tab_contents()->web_ui()) return false; - PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); + PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( + print_preview_tab->tab_contents()->web_ui()); print_preview_ui->OnShowSystemDialog(); return true; } else { diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index 701a6c8..51a5ae6 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc @@ -422,7 +422,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); SendCommand("\"proceed\""); // Simulate the user clicking "proceed" observer.Wait(); AssertNoInterstitial(true); // Assert the interstitial is gone. @@ -450,7 +451,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingProceed) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); SendCommand("\"proceed\""); // Simulate the user clicking "proceed". observer.Wait(); AssertNoInterstitial(true); // Assert the interstitial is gone @@ -466,7 +468,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); SendCommand("\"reportError\""); // Simulate the user clicking "report error" observer.Wait(); AssertNoInterstitial(false); // Assert the interstitial is gone @@ -486,7 +489,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); SendCommand("\"learnMore\""); // Simulate the user clicking "learn more" observer.Wait(); AssertNoInterstitial(false); // Assert the interstitial is gone diff --git a/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc b/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc index f4daa6e..4d8755b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc +++ b/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc @@ -13,6 +13,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/sessions/restore_tab_helper.cc b/chrome/browser/sessions/restore_tab_helper.cc index 074991e..6516731 100644 --- a/chrome/browser/sessions/restore_tab_helper.cc +++ b/chrome/browser/sessions/restore_tab_helper.cc @@ -7,6 +7,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/extensions/extension_messages.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" @@ -27,8 +28,9 @@ void RestoreTabHelper::SetWindowID(const SessionID& id) { // Extension code in the renderer holds the ID of the window that hosts it. // Notify it that the window ID changed. - tab_->render_view_host()->Send(new ExtensionMsg_UpdateBrowserWindowId( - tab_->render_view_host()->routing_id(), id.id())); + tab_->tab_contents()->render_view_host()->Send( + new ExtensionMsg_UpdateBrowserWindowId( + tab_->tab_contents()->render_view_host()->routing_id(), id.id())); } void RestoreTabHelper::RenderViewCreated(RenderViewHost* render_view_host) { diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 0dda61c..546adcc 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -589,7 +589,7 @@ void SessionService::Observe(int type, TabNavigationPathPrunedFromBack( tab->restore_tab_helper()->window_id(), tab->restore_tab_helper()->session_id(), - tab->controller().entry_count()); + tab->tab_contents()->controller().entry_count()); } RecordSessionUpdateHistogramData(content::NOTIFICATION_NAV_LIST_PRUNED, &last_updated_nav_list_pruned_time_); @@ -618,7 +618,8 @@ void SessionService::Observe(int type, source).ptr()->tab_contents()); if (!tab || tab->profile() != profile()) return; - int current_entry_index = tab->controller().GetCurrentEntryIndex(); + int current_entry_index = + tab->tab_contents()->controller().GetCurrentEntryIndex(); SetSelectedNavigationIndex(tab->restore_tab_helper()->window_id(), tab->restore_tab_helper()->session_id(), current_entry_index); @@ -626,7 +627,8 @@ void SessionService::Observe(int type, tab->restore_tab_helper()->window_id(), tab->restore_tab_helper()->session_id(), current_entry_index, - *tab->controller().GetEntryAtIndex(current_entry_index)); + *tab->tab_contents()->controller().GetEntryAtIndex( + current_entry_index)); content::Details<content::LoadCommittedDetails> changed(details); if (changed->type == content::NAVIGATION_TYPE_NEW_PAGE || changed->type == content::NAVIGATION_TYPE_EXISTING_PAGE) { @@ -1140,12 +1142,15 @@ void SessionService::BuildCommandsForTab( DCHECK(tab && commands && window_id.id()); const SessionID& session_id(tab->restore_tab_helper()->session_id()); commands->push_back(CreateSetTabWindowCommand(window_id, session_id)); - const int current_index = tab->controller().GetCurrentEntryIndex(); + const int current_index = + tab->tab_contents()->controller().GetCurrentEntryIndex(); const int min_index = std::max(0, current_index - max_persist_navigation_count); - const int max_index = std::min(current_index + max_persist_navigation_count, - tab->controller().entry_count()); - const int pending_index = tab->controller().pending_entry_index(); + const int max_index = + std::min(current_index + max_persist_navigation_count, + tab->tab_contents()->controller().entry_count()); + const int pending_index = + tab->tab_contents()->controller().pending_entry_index(); if (tab_to_available_range) { (*tab_to_available_range)[session_id.id()] = std::pair<int, int>(min_index, max_index); @@ -1163,8 +1168,8 @@ void SessionService::BuildCommandsForTab( } for (int i = min_index; i < max_index; ++i) { const NavigationEntry* entry = (i == pending_index) ? - tab->controller().pending_entry() : - tab->controller().GetEntryAtIndex(i); + tab->tab_contents()->controller().pending_entry() : + tab->tab_contents()->controller().GetEntryAtIndex(i); DCHECK(entry); if (ShouldTrackEntry(entry->virtual_url())) { commands->push_back( diff --git a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc index 93be6d709..8b0d2e5 100644 --- a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc +++ b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc @@ -25,6 +25,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "content/browser/ssl/ssl_client_auth_handler.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc b/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc index 91b05d1..8422665 100644 --- a/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc +++ b/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc @@ -10,6 +10,7 @@ #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/profiles/profile.h" +#include "content/browser/tab_contents/tab_contents.h" #include "ui/base/dragdrop/gtk_dnd_util.h" WebDragBookmarkHandlerGtk::WebDragBookmarkHandlerGtk() @@ -81,7 +82,7 @@ void WebDragBookmarkHandlerGtk::OnDrop() { // Focus the target browser. Browser* browser = Browser::GetBrowserForController( - &tab_->controller(), NULL); + &tab_->tab_contents()->controller(), NULL); if (browser) browser->window()->Show(); } diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm b/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm index 702dad9..765290e 100644 --- a/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm +++ b/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm @@ -8,6 +8,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "content/browser/tab_contents/tab_contents.h" WebDragBookmarkHandlerMac::WebDragBookmarkHandlerMac() : tab_(NULL) { @@ -48,7 +49,7 @@ void WebDragBookmarkHandlerMac::OnDrop() { // Focus the target browser. Browser* browser = Browser::GetBrowserForController( - &tab_->controller(), NULL); + &tab_->tab_contents()->controller(), NULL); if (browser) browser->window()->Show(); } diff --git a/chrome/browser/tabs/pinned_tab_codec.cc b/chrome/browser/tabs/pinned_tab_codec.cc index cb3c7f7..eaa02da 100644 --- a/chrome/browser/tabs/pinned_tab_codec.cc +++ b/chrome/browser/tabs/pinned_tab_codec.cc @@ -53,9 +53,10 @@ static void EncodePinnedTab(TabStripModel* model, value->SetString(kURL, extension->GetFullLaunchURL().spec()); values->Append(value.release()); } else { - NavigationEntry* entry = tab_contents->controller().GetActiveEntry(); - if (!entry && tab_contents->controller().entry_count()) - entry = tab_contents->controller().GetEntryAtIndex(0); + NavigationEntry* entry = + tab_contents->tab_contents()->controller().GetActiveEntry(); + if (!entry && tab_contents->tab_contents()->controller().entry_count()) + entry = tab_contents->tab_contents()->controller().GetEntryAtIndex(0); if (entry) { value->SetString(kURL, entry->url().spec()); values->Append(value.release()); diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index c9731b1..4048e0a 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -142,14 +142,14 @@ void TabStripModel::InsertTabContentsAt(int index, ForgetAllOpeners(); } // Anything opened by a link we deem to have an opener. - data->SetGroup(&selected_contents->controller()); + data->SetGroup(&selected_contents->tab_contents()->controller()); } else if ((add_types & ADD_INHERIT_OPENER) && selected_contents) { if (active) { // Forget any existing relationships, we don't want to make things too // confusing by having multiple groups active at the same time. ForgetAllOpeners(); } - data->opener = &selected_contents->controller(); + data->opener = &selected_contents->tab_contents()->controller(); } contents_data_.insert(contents_data_.begin() + index, data); @@ -172,7 +172,8 @@ TabContentsWrapper* TabStripModel::ReplaceTabContentsAt( DCHECK(ContainsIndex(index)); TabContentsWrapper* old_contents = GetContentsAt(index); - ForgetOpenersAndGroupsReferencing(&(old_contents->controller())); + ForgetOpenersAndGroupsReferencing( + &(old_contents->tab_contents()->controller())); contents_data_[index]->contents = new_contents; @@ -211,14 +212,15 @@ TabContentsWrapper* TabStripModel::DiscardTabContentsAt(int index) { NULL /* base_tab_contents */, NULL /* session_storage_namespace */)); TabContentsWrapper* old_contents = GetContentsAt(index); - NavigationEntry* old_nav_entry = old_contents->controller().GetActiveEntry(); + NavigationEntry* old_nav_entry = + old_contents->tab_contents()->controller().GetActiveEntry(); if (old_nav_entry) { // Set the new tab contents to reload this URL when clicked. // This also allows the tab to keep drawing the favicon and page title. NavigationEntry* new_nav_entry = new NavigationEntry(*old_nav_entry); std::vector<NavigationEntry*> entries; entries.push_back(new_nav_entry); - null_contents->controller().Restore(0, false, &entries); + null_contents->tab_contents()->controller().Restore(0, false, &entries); } ReplaceTabContentsAt(index, null_contents); // Mark the tab so it will reload when we click. @@ -238,7 +240,8 @@ TabContentsWrapper* TabStripModel::DetachTabContentsAt(int index) { int next_selected_index = order_controller_->DetermineNewSelectedIndex(index); delete contents_data_.at(index); contents_data_.erase(contents_data_.begin() + index); - ForgetOpenersAndGroupsReferencing(&(removed_contents->controller())); + ForgetOpenersAndGroupsReferencing( + &(removed_contents->tab_contents()->controller())); if (empty()) closing_all_ = true; FOR_EACH_OBSERVER(TabStripModelObserver, observers_, @@ -384,7 +387,7 @@ int TabStripModel::GetIndexOfController( int index = 0; TabContentsDataVector::const_iterator iter = contents_data_.begin(); for (; iter != contents_data_.end(); ++iter, ++index) { - if (&(*iter)->contents->controller() == controller) + if (&(*iter)->contents->tab_contents()->controller() == controller) return index; } return kNoTab; @@ -841,7 +844,7 @@ void TabStripModel::ExecuteContextMenuCommand( TabContentsWrapper* tab = GetTabContentsAt(indices[i]); if (tab && tab->tab_contents()->delegate()->CanReloadContents( tab->tab_contents())) { - tab->controller().Reload(true); + tab->tab_contents()->controller().Reload(true); } } break; @@ -1084,7 +1087,7 @@ void TabStripModel::GetIndicesWithSameOpener(int index, NavigationController* opener = contents_data_[index]->group; if (!opener) { // If there is no group, find all tabs with the selected tab as the opener. - opener = &(GetTabContentsAt(index)->controller()); + opener = &(GetTabContentsAt(index)->tab_contents()->controller()); if (!opener) return; } @@ -1092,7 +1095,7 @@ void TabStripModel::GetIndicesWithSameOpener(int index, if (i == index) continue; if (contents_data_[i]->group == opener || - &(GetTabContentsAt(i)->controller()) == opener) { + &(GetTabContentsAt(i)->tab_contents()->controller()) == opener) { indices->push_back(i); } } @@ -1113,7 +1116,7 @@ bool TabStripModel::IsNewTabAtEndOfTabStrip( return url.SchemeIs(chrome::kChromeUIScheme) && url.host() == chrome::kChromeUINewTabHost && contents == GetContentsAt(count() - 1) && - contents->controller().entry_count() == 1; + contents->tab_contents()->controller().entry_count() == 1; } bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices, diff --git a/chrome/browser/tabs/tab_strip_model_order_controller.cc b/chrome/browser/tabs/tab_strip_model_order_controller.cc index 76854a4..5917dfa 100644 --- a/chrome/browser/tabs/tab_strip_model_order_controller.cc +++ b/chrome/browser/tabs/tab_strip_model_order_controller.cc @@ -5,6 +5,7 @@ #include "chrome/browser/tabs/tab_strip_model_order_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "content/browser/tab_contents/tab_contents.h" /////////////////////////////////////////////////////////////////////////////// // TabStripModelOrderController, public: @@ -39,7 +40,7 @@ int TabStripModelOrderController::DetermineInsertionIndex( return tabstrip_->active_index() + delta; } NavigationController* opener = - &tabstrip_->GetActiveTabContents()->controller(); + &tabstrip_->GetActiveTabContents()->tab_contents()->controller(); // Get the index of the next item opened by this tab, and insert after // it... int index; @@ -74,7 +75,8 @@ int TabStripModelOrderController::DetermineNewSelectedIndex( // want to select the first in that child group, not the next tab in the same // group of the removed tab. NavigationController* removed_controller = - &tabstrip_->GetTabContentsAt(removing_index)->controller(); + &tabstrip_->GetTabContentsAt(removing_index)-> + tab_contents()->controller(); // The parent opener should never be the same as the controller being removed. DCHECK(parent_opener != removed_controller); int index = tabstrip_->GetIndexOfNextTabContentsOpenedBy(removed_controller, @@ -129,9 +131,9 @@ void TabStripModelOrderController::ActiveTabChanged( if (user_gesture && new_opener != old_opener && ((old_contents == NULL && new_opener == NULL) || - new_opener != &old_contents->controller()) && + new_opener != &old_contents->tab_contents()->controller()) && ((new_contents == NULL && old_opener == NULL) || - old_opener != &new_contents->controller())) { + old_opener != &new_contents->tab_contents()->controller())) { tabstrip_->ForgetAllOpeners(); } } diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc index 93d1ac3..447d349 100644 --- a/chrome/browser/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/tabs/tab_strip_model_unittest.cc @@ -583,8 +583,10 @@ TEST_F(TabStripModelTest, TestBasicAPI) { EXPECT_EQ(contents1, tabstrip.GetTabContentsAt(1)); EXPECT_EQ(0, tabstrip.GetIndexOfTabContents(contents2)); EXPECT_EQ(1, tabstrip.GetIndexOfTabContents(contents1)); - EXPECT_EQ(0, tabstrip.GetIndexOfController(&contents2->controller())); - EXPECT_EQ(1, tabstrip.GetIndexOfController(&contents1->controller())); + EXPECT_EQ(0, tabstrip.GetIndexOfController( + &contents2->tab_contents()->controller())); + EXPECT_EQ(1, tabstrip.GetIndexOfController( + &contents1->tab_contents()->controller())); } // Test UpdateTabContentsStateAt @@ -637,7 +639,7 @@ TEST_F(TabStripModelTest, TestBasicOpenerAPI) { // background with opener_contents set as their opener. TabContentsWrapper* opener_contents = CreateTabContents(); - NavigationController* opener = &opener_contents->controller(); + NavigationController* opener = &opener_contents->tab_contents()->controller(); tabstrip.AppendTabContents(opener_contents, true); TabContentsWrapper* contents1 = CreateTabContents(); TabContentsWrapper* contents2 = CreateTabContents(); @@ -675,7 +677,7 @@ TEST_F(TabStripModelTest, TestBasicOpenerAPI) { // For a tab that has opened no other tabs, the return value should always be // -1... - NavigationController* o1 = &contents1->controller(); + NavigationController* o1 = &contents1->tab_contents()->controller(); EXPECT_EQ(-1, tabstrip.GetIndexOfNextTabContentsOpenedBy(o1, 3, false)); EXPECT_EQ(-1, tabstrip.GetIndexOfLastTabContentsOpenedBy(o1, 3)); @@ -788,7 +790,7 @@ TEST_F(TabStripModelTest, TestInsertionIndexDetermination) { EXPECT_TRUE(tabstrip.empty()); TabContentsWrapper* opener_contents = CreateTabContents(); - NavigationController* opener = &opener_contents->controller(); + NavigationController* opener = &opener_contents->tab_contents()->controller(); tabstrip.AppendTabContents(opener_contents, true); // Open some other random unrelated tab in the background to monkey with our diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index 5b91f4a..44fbf52 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -221,7 +221,7 @@ TaskManagerTabContentsResource::TaskManagerTabContentsResource( TabContentsWrapper* tab_contents) : TaskManagerRendererResource( tab_contents->tab_contents()->GetRenderProcessHost()->GetHandle(), - tab_contents->render_view_host()), + tab_contents->tab_contents()->render_view_host()), tab_contents_(tab_contents), is_instant_preview_(false) { if (!prerender_icon_) { diff --git a/chrome/browser/ui/alternate_error_tab_observer.cc b/chrome/browser/ui/alternate_error_tab_observer.cc index 0e3f633..c148416 100644 --- a/chrome/browser/ui/alternate_error_tab_observer.cc +++ b/chrome/browser/ui/alternate_error_tab_observer.cc @@ -11,6 +11,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" AlternateErrorPageTabObserver::AlternateErrorPageTabObserver( diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 652795d..88d0e46 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -148,6 +148,7 @@ #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/user_metrics.h" #include "content/public/browser/devtools_manager.h" @@ -1485,7 +1486,8 @@ bool Browser::IsClosingPermitted() { } bool Browser::CanGoBack() const { - return GetSelectedTabContentsWrapper()->controller().CanGoBack(); + return GetSelectedTabContentsWrapper()-> + tab_contents()->controller().CanGoBack(); } void Browser::GoBack(WindowOpenDisposition disposition) { @@ -1504,7 +1506,8 @@ void Browser::GoBack(WindowOpenDisposition disposition) { } bool Browser::CanGoForward() const { - return GetSelectedTabContentsWrapper()->controller().CanGoForward(); + return GetSelectedTabContentsWrapper()-> + tab_contents()->controller().CanGoForward(); } void Browser::GoForward(WindowOpenDisposition disposition) { @@ -1639,7 +1642,7 @@ void Browser::NewTab() { if (is_type_tabbed()) { AddBlankTab(true); - GetSelectedTabContentsWrapper()->view()->RestoreFocus(); + GetSelectedTabContentsWrapper()->tab_contents()->view()->RestoreFocus(); } else { Browser* b = GetOrCreateTabbedBrowser(profile_); b->AddBlankTab(true); @@ -1647,7 +1650,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->GetSelectedTabContentsWrapper()->view()->RestoreFocus(); + b->GetSelectedTabContentsWrapper()->tab_contents()->view()->RestoreFocus(); } } @@ -1929,7 +1932,8 @@ void Browser::Zoom(content::PageZoom zoom) { if (is_devtools()) return; - RenderViewHost* host = GetSelectedTabContentsWrapper()->render_view_host(); + RenderViewHost* host = + GetSelectedTabContentsWrapper()->tab_contents()->render_view_host(); if (zoom == content::PAGE_ZOOM_RESET) { host->SetZoomLevel(0); UserMetrics::RecordAction(UserMetricsAction("ZoomNormal")); @@ -2043,7 +2047,8 @@ void Browser::OpenCreateShortcutsDialog() { web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) << "Menu item should be disabled."; - NavigationEntry* entry = current_tab->controller().GetLastCommittedEntry(); + NavigationEntry* entry = + current_tab->tab_contents()->controller().GetLastCommittedEntry(); if (!entry) return; @@ -2066,7 +2071,8 @@ void Browser::ToggleDevToolsWindow(DevToolsToggleAction action) { UserMetrics::RecordAction(UserMetricsAction("DevTools_ToggleWindow")); DevToolsWindow::ToggleDevToolsWindow( - GetSelectedTabContentsWrapper()->render_view_host(), action); + GetSelectedTabContentsWrapper()->tab_contents()->render_view_host(), + action); } void Browser::OpenTaskManager(bool highlight_background_resources) { @@ -3075,7 +3081,8 @@ TabContentsWrapper* Browser::CreateTabContentsForURL( if (!defer_load) { // Load the initial URL before adding the new tab contents to the tab strip // so that the tab contents has navigation state. - contents->controller().LoadURL(url, referrer, transition, std::string()); + contents->tab_contents()->controller().LoadURL( + url, referrer, transition, std::string()); } return contents; @@ -3161,7 +3168,7 @@ void Browser::CreateHistoricalTab(TabContentsWrapper* contents) { // We only create historical tab entries for tabbed browser windows. if (service && CanSupportWindowFeature(FEATURE_TABSTRIP)) { - service->CreateHistoricalTab(&contents->controller(), + service->CreateHistoricalTab(&contents->tab_contents()->controller(), tab_handler_->GetTabStripModel()->GetIndexOfTabContents(contents)); } } @@ -3249,7 +3256,8 @@ void Browser::TabClosingAt(TabStripModel* tab_strip_model, fullscreen_controller_->OnTabClosing(contents->tab_contents()); content::NotificationService::current()->Notify( content::NOTIFICATION_TAB_CLOSING, - content::Source<NavigationController>(&contents->controller()), + content::Source<NavigationController>( + &contents->tab_contents()->controller()), content::NotificationService::NoDetails()); // Sever the TabContents' connection back to us. @@ -3347,11 +3355,12 @@ void Browser::TabReplacedAt(TabStripModel* tab_strip_model, TabInsertedAt(new_contents, index, (index == tab_handler_->GetTabStripModel()->active_index())); - int entry_count = new_contents->controller().entry_count(); + int entry_count = new_contents->tab_contents()->controller().entry_count(); if (entry_count > 0) { // Send out notification so that observers are updated appropriately. - new_contents->controller().NotifyEntryChanged( - new_contents->controller().GetEntryAtIndex(entry_count - 1), + new_contents->tab_contents()->controller().NotifyEntryChanged( + new_contents->tab_contents()->controller().GetEntryAtIndex( + entry_count - 1), entry_count - 1); } @@ -3965,7 +3974,8 @@ void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, if (GetSelectedTabContentsWrapper() != source) return; - NavigationEntry* entry = source->controller().GetLastCommittedEntry(); + NavigationEntry* entry = + source->tab_contents()->controller().GetLastCommittedEntry(); if (!entry || (entry->page_id() != page_id)) return; @@ -5141,7 +5151,7 @@ bool Browser::OpenInstant(WindowOpenDisposition disposition) { // HideInstant is invoked after release so that InstantController is not // active when HideInstant asks it for its state. HideInstant(); - preview_contents->controller().PruneAllButActive(); + preview_contents->tab_contents()->controller().PruneAllButActive(); tab_handler_->GetTabStripModel()->AddTabContents( preview_contents, -1, @@ -5172,7 +5182,8 @@ void Browser::CreateInstantIfNecessary() { void Browser::ViewSource(TabContentsWrapper* contents) { DCHECK(contents); - NavigationEntry* active_entry = contents->controller().GetActiveEntry(); + NavigationEntry* active_entry = + contents->tab_contents()->controller().GetActiveEntry(); if (!active_entry) return; @@ -5186,9 +5197,9 @@ void Browser::ViewSource(TabContentsWrapper* contents, DCHECK(contents); TabContentsWrapper* view_source_contents = contents->Clone(); - view_source_contents->controller().PruneAllButActive(); + view_source_contents->tab_contents()->controller().PruneAllButActive(); NavigationEntry* active_entry = - view_source_contents->controller().GetActiveEntry(); + view_source_contents->tab_contents()->controller().GetActiveEntry(); if (!active_entry) return; @@ -5296,7 +5307,8 @@ void Browser::ShowSyncSetup() { } void Browser::ToggleSpeechInput() { - GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); + GetSelectedTabContentsWrapper()->tab_contents()->render_view_host()-> + ToggleSpeechInput(); } void Browser::OnWindowDidShow() { diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index e4384e8..4f493b7 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -75,6 +75,7 @@ #include "chrome/installer/util/browser_distribution.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/tab_contents/navigation_details.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/browser_thread.h" #include "grit/chromium_strings.h" diff --git a/chrome/browser/ui/browser_list_unittest.cc b/chrome/browser/ui/browser_list_unittest.cc index b0fd9ee..ca5d26c 100644 --- a/chrome/browser/ui/browser_list_unittest.cc +++ b/chrome/browser/ui/browser_list_unittest.cc @@ -8,6 +8,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/testing_browser_process.h" +#include "content/browser/tab_contents/tab_contents.h" typedef BrowserWithTestWindowTest BrowserListTest; @@ -24,8 +25,8 @@ size_t CountAllTabs() { // Helper function to navigate to the print preview page. void NavigateToPrintUrl(TabContentsWrapper* tab, int page_id) { static_cast<TestRenderViewHost*>( - tab->render_view_host())->SendNavigate(page_id, - GURL(chrome::kChromeUIPrintURL)); + tab->tab_contents()->render_view_host())->SendNavigate( + page_id, GURL(chrome::kChromeUIPrintURL)); } } // namespace diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm index 888e6ca..6c3c5ee 100644 --- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -22,6 +22,7 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" #include "googleurl/src/gurl.h" @@ -185,7 +186,8 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { return nil; } - NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); + NavigationEntry* entry = + tabContents_->tab_contents()->controller().GetActiveEntry(); if (!entry) { return nil; } @@ -208,7 +210,8 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { return; } - NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); + NavigationEntry* entry = + tabContents_->tab_contents()->controller().GetActiveEntry(); if (!entry) return; @@ -222,7 +225,8 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (NSString*)title { - NavigationEntry* entry = tabContents_->controller().GetActiveEntry(); + NavigationEntry* entry = + tabContents_->tab_contents()->controller().GetActiveEntry(); if (!entry) return nil; @@ -240,7 +244,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (void)handlesUndoScriptCommand:(NSScriptCommand*)command { - RenderViewHost* view = tabContents_->render_view_host(); + RenderViewHost* view = tabContents_->tab_contents()->render_view_host(); if (!view) { NOTREACHED(); return; @@ -250,7 +254,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (void)handlesRedoScriptCommand:(NSScriptCommand*)command { - RenderViewHost* view = tabContents_->render_view_host(); + RenderViewHost* view = tabContents_->tab_contents()->render_view_host(); if (!view) { NOTREACHED(); return; @@ -260,7 +264,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (void)handlesCutScriptCommand:(NSScriptCommand*)command { - RenderViewHost* view = tabContents_->render_view_host(); + RenderViewHost* view = tabContents_->tab_contents()->render_view_host(); if (!view) { NOTREACHED(); return; @@ -270,7 +274,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (void)handlesCopyScriptCommand:(NSScriptCommand*)command { - RenderViewHost* view = tabContents_->render_view_host(); + RenderViewHost* view = tabContents_->tab_contents()->render_view_host(); if (!view) { NOTREACHED(); return; @@ -280,7 +284,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (void)handlesPasteScriptCommand:(NSScriptCommand*)command { - RenderViewHost* view = tabContents_->render_view_host(); + RenderViewHost* view = tabContents_->tab_contents()->render_view_host(); if (!view) { NOTREACHED(); return; @@ -290,7 +294,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (void)handlesSelectAllScriptCommand:(NSScriptCommand*)command { - RenderViewHost* view = tabContents_->render_view_host(); + RenderViewHost* view = tabContents_->tab_contents()->render_view_host(); if (!view) { NOTREACHED(); return; @@ -300,25 +304,28 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (void)handlesGoBackScriptCommand:(NSScriptCommand*)command { - NavigationController& navigationController = tabContents_->controller(); + NavigationController& navigationController = + tabContents_->tab_contents()->controller(); if (navigationController.CanGoBack()) navigationController.GoBack(); } - (void)handlesGoForwardScriptCommand:(NSScriptCommand*)command { - NavigationController& navigationController = tabContents_->controller(); + NavigationController& navigationController = + tabContents_->tab_contents()->controller(); if (navigationController.CanGoForward()) navigationController.GoForward(); } - (void)handlesReloadScriptCommand:(NSScriptCommand*)command { - NavigationController& navigationController = tabContents_->controller(); + NavigationController& navigationController = + tabContents_->tab_contents()->controller(); const bool checkForRepost = true; navigationController.Reload(checkForRepost); } - (void)handlesStopScriptCommand:(NSScriptCommand*)command { - RenderViewHost* view = tabContents_->render_view_host(); + RenderViewHost* view = tabContents_->tab_contents()->render_view_host(); if (!view) { // We tolerate Stop being called even before a view has been created. // So just log a warning instead of a NOTREACHED(). @@ -380,7 +387,8 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command { - NavigationEntry* entry = tabContents_->controller().GetLastCommittedEntry(); + NavigationEntry* entry = + tabContents_->tab_contents()->controller().GetLastCommittedEntry(); if (entry) { tabContents_->tab_contents()->OpenURL( GURL(chrome::kViewSourceScheme + std::string(":") + @@ -392,7 +400,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (id)handlesExecuteJavascriptScriptCommand:(NSScriptCommand*)command { - RenderViewHost* view = tabContents_->render_view_host(); + RenderViewHost* view = tabContents_->tab_contents()->render_view_host(); if (!view) { NOTREACHED(); return nil; diff --git a/chrome/browser/ui/cocoa/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window_mac.mm index bed37c8..16f0214 100644 --- a/chrome/browser/ui/cocoa/constrained_window_mac.mm +++ b/chrome/browser/ui/cocoa/constrained_window_mac.mm @@ -105,7 +105,8 @@ void ConstrainedWindowMac::ShowConstrainedWindow() { // The TabContents only has a native window if it is currently visible. In // this case, open the sheet now. Else, Realize() will be called later, when // our tab becomes visible. - NSWindow* browserWindow = wrapper_->view()->GetTopLevelNativeWindow(); + NSWindow* browserWindow = + wrapper_->tab_contents()->view()->GetTopLevelNativeWindow(); NSWindowController* controller = [browserWindow windowController]; if (controller != nil) { DCHECK([controller isKindOfClass:[BrowserWindowController class]]); diff --git a/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm b/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm index b44325a..235a221 100644 --- a/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm +++ b/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm @@ -233,7 +233,8 @@ const float kRightEdgeOffset = 25; // |ForwardKeyboardEvent()| directly ignores edit commands, which breaks // cmd-up/down if we ever decide to include |moveToBeginningOfDocument:| in // the list above. - RenderViewHost* render_view_host = contents->render_view_host(); + RenderViewHost* render_view_host = + contents->tab_contents()->render_view_host(); render_view_host->ForwardKeyboardEvent(NativeWebKeyboardEvent(event)); return YES; } @@ -466,7 +467,8 @@ const float kRightEdgeOffset = 25; return frame.origin.x; // Get the size of the container. - gfx::Rect container_rect(contents->view()->GetContainerSize()); + gfx::Rect container_rect( + contents->tab_contents()->view()->GetContainerSize()); // Position the FindBar on the top right corner. view_rect.set_x( diff --git a/chrome/browser/ui/cocoa/tab_contents/favicon_util.mm b/chrome/browser/ui/cocoa/tab_contents/favicon_util.mm index ff5cc74..52a266d 100644 --- a/chrome/browser/ui/cocoa/tab_contents/favicon_util.mm +++ b/chrome/browser/ui/cocoa/tab_contents/favicon_util.mm @@ -10,6 +10,7 @@ #include "chrome/browser/favicon/favicon_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "skia/ext/skia_utils_mac.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/mac/nsimage_cache.h" namespace mac { diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index 9b6e800..6b3bb82 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -260,7 +260,8 @@ void ThumbnailLoader::LoadThumbnail() { // change on window resize, and since most users don't use devtools, this is // good enough. bottomOffset += - devToolsContents->render_view_host()->view()->GetViewBounds().height(); + devToolsContents->tab_contents()->render_view_host()->view()-> + GetViewBounds().height(); bottomOffset += 1; // :-( Divider line between web contents and devtools. } return bottomOffset; @@ -284,7 +285,7 @@ void ThumbnailLoader::LoadThumbnail() { } - (void)drawInContext:(CGContextRef)context { - RenderWidgetHost* rwh = contents_->render_view_host(); + RenderWidgetHost* rwh = contents_->tab_contents()->render_view_host(); // NULL if renderer crashed. RenderWidgetHostView* rwhv = rwh ? rwh->view() : NULL; if (!rwhv) { diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index 89fd994..cadd115 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -1108,14 +1108,14 @@ private: NSInteger activeIndex = [self indexFromModelIndex:modelIndex]; if (oldContents) { - int oldModelIndex = - browser_->GetIndexOfController(&(oldContents->controller())); + int oldModelIndex = browser_->GetIndexOfController( + &(oldContents->tab_contents()->controller())); if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone. NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex]; TabContentsController* oldController = [tabContentsArray_ objectAtIndex:oldIndex]; [oldController willBecomeUnselectedTab]; - oldContents->view()->StoreFocus(); + oldContents->tab_contents()->view()->StoreFocus(); oldContents->tab_contents()->WasHidden(); } } @@ -1152,7 +1152,7 @@ private: if (newContents) { newContents->tab_contents()->DidBecomeSelected(); - newContents->view()->RestoreFocus(); + newContents->tab_contents()->view()->RestoreFocus(); if (newContents->find_tab_helper()->find_ui_active()) browser_->GetFindBarController()->find_bar()->SetFocusAndSelection(); diff --git a/chrome/browser/ui/constrained_window_tab_helper.cc b/chrome/browser/ui/constrained_window_tab_helper.cc index c9adba7..6b4fb99 100644 --- a/chrome/browser/ui/constrained_window_tab_helper.cc +++ b/chrome/browser/ui/constrained_window_tab_helper.cc @@ -11,6 +11,7 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/navigation_details.h" +#include "content/browser/tab_contents/tab_contents.h" #include "net/base/registry_controlled_domain.h" ConstrainedWindowTabHelper::ConstrainedWindowTabHelper( diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc index ba5b356..ce99842 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc @@ -379,7 +379,7 @@ class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { virtual void OnCustomLinkClicked() OVERRIDE { UserMetrics::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble")); DCHECK(tab_contents()); - RenderViewHost* host = tab_contents()->render_view_host(); + RenderViewHost* host = tab_contents()->tab_contents()->render_view_host(); host->Send(new ChromeViewMsg_LoadBlockedPlugins(host->routing_id())); set_custom_link_enabled(false); tab_contents()->content_settings()->set_load_plugins_link_enabled(false); diff --git a/chrome/browser/ui/find_bar/find_bar_controller.cc b/chrome/browser/ui/find_bar/find_bar_controller.cc index 87bed69..19e9e1f8 100644 --- a/chrome/browser/ui/find_bar/find_bar_controller.cc +++ b/chrome/browser/ui/find_bar/find_bar_controller.cc @@ -15,6 +15,7 @@ #include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "ui/gfx/rect.h" @@ -85,11 +86,14 @@ void FindBarController::ChangeTabContents(TabContentsWrapper* contents) { if (!tab_contents_) return; - registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, + registrar_.Add(this, + chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, content::Source<TabContents>(tab_contents_->tab_contents())); registrar_.Add( - this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::Source<NavigationController>(&tab_contents_->controller())); + this, + content::NOTIFICATION_NAV_ENTRY_COMMITTED, + content::Source<NavigationController>( + &tab_contents_->tab_contents()->controller())); MaybeSetPrepopulateText(); @@ -129,7 +133,7 @@ void FindBarController::Observe(int type, } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { NavigationController* source_controller = content::Source<NavigationController>(source).ptr(); - if (source_controller == &tab_contents_->controller()) { + if (source_controller == &tab_contents_->tab_contents()->controller()) { content::LoadCommittedDetails* commit_details = content::Details<content::LoadCommittedDetails>(details).ptr(); content::PageTransition transition_type = diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index 3c8179e..7763acd 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -271,7 +271,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) { // Move the selection to link 1, after searching. ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - tab_contents->render_view_host(), + tab_contents->tab_contents()->render_view_host(), L"", L"window.domAutomationController.send(selectLink1());", &result)); @@ -345,7 +345,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, // Move the selection to link 1, after searching. std::string result; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - tab->render_view_host(), + tab->tab_contents()->render_view_host(), L"", L"window.domAutomationController.send(selectLink1());", &result)); @@ -588,7 +588,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller())); + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller())); browser()->Reload(CURRENT_TAB); observer.Wait(); @@ -1113,7 +1114,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, ActivateLinkNavigatesPage) { // End the find session, click on the link. ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, - content::Source<NavigationController>(&tab->controller())); + content::Source<NavigationController>( + &tab->tab_contents()->controller())); tab->find_tab_helper()->StopFinding(FindBarController::kActivateSelection); observer.Wait(); } diff --git a/chrome/browser/ui/fullscreen_controller.cc b/chrome/browser/ui/fullscreen_controller.cc index c8f497e..4db0d80 100644 --- a/chrome/browser/ui/fullscreen_controller.cc +++ b/chrome/browser/ui/fullscreen_controller.cc @@ -14,6 +14,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 0716b57..0a0ba25 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1260,7 +1260,7 @@ void BrowserWindowGtk::ActiveTabChanged(TabContentsWrapper* old_contents, bool user_gesture) { TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::ActiveTabChanged"); if (old_contents && !old_contents->tab_contents()->is_being_destroyed()) - old_contents->view()->StoreFocus(); + old_contents->tab_contents()->view()->StoreFocus(); // Update various elements that are interested in knowing the current // TabContents. @@ -1272,7 +1272,7 @@ void BrowserWindowGtk::ActiveTabChanged(TabContentsWrapper* old_contents, // 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->view()->RestoreFocus(); + new_contents->tab_contents()->view()->RestoreFocus(); if (new_contents->find_tab_helper()->find_ui_active()) browser_->GetFindBarController()->find_bar()->SetFocusAndSelection(); } diff --git a/chrome/browser/ui/gtk/constrained_window_gtk.cc b/chrome/browser/ui/gtk/constrained_window_gtk.cc index 1fafc73..65004ace 100644 --- a/chrome/browser/ui/gtk/constrained_window_gtk.cc +++ b/chrome/browser/ui/gtk/constrained_window_gtk.cc @@ -126,7 +126,7 @@ void ConstrainedWindowGtk::FocusConstrainedWindow() { // TODO(estade): this define should not need to be here because this class // should not be used on linux/views. #if defined(TOOLKIT_GTK) - static_cast<TabContentsViewGtk*>(wrapper_->view())-> + static_cast<TabContentsViewGtk*>(wrapper_->tab_contents()->view())-> SetFocusedWidget(focus_widget); #endif } @@ -136,11 +136,11 @@ ConstrainedWindowGtk::TabContentsViewType* ConstrainedWindowGtk::ContainingView() { #if defined(TOOLKIT_VIEWS) return static_cast<NativeTabContentsViewGtk*>( - static_cast<TabContentsViewViews*>(wrapper_->view())-> + static_cast<TabContentsViewViews*>(wrapper_->tab_contents()->view())-> native_tab_contents_view()); #else return static_cast<TabContentsViewType*>( - static_cast<TabContentsViewGtk*>(wrapper_->view())-> + static_cast<TabContentsViewGtk*>(wrapper_->tab_contents()->view())-> wrapper()); #endif } diff --git a/chrome/browser/ui/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc index bea3fae..0f33b79 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.cc +++ b/chrome/browser/ui/gtk/find_bar_gtk.cc @@ -673,7 +673,8 @@ bool FindBarGtk::MaybeForwardKeyEventToRenderer(GdkEventKey* event) { if (!contents) return false; - RenderViewHost* render_view_host = contents->render_view_host(); + RenderViewHost* render_view_host = + contents->tab_contents()->render_view_host(); // Make sure we don't have a text field element interfering with keyboard // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". diff --git a/chrome/browser/ui/gtk/html_dialog_gtk.cc b/chrome/browser/ui/gtk/html_dialog_gtk.cc index 43c73a1..fdd4796 100644 --- a/chrome/browser/ui/gtk/html_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/html_dialog_gtk.cc @@ -179,10 +179,11 @@ gfx::NativeWindow HtmlDialogGtk::InitDialog() { HtmlDialogUI::GetPropertyAccessor().SetProperty( tab_->tab_contents()->property_bag(), this); - tab_->controller().LoadURL(GetDialogContentURL(), - content::Referrer(), - content::PAGE_TRANSITION_START_PAGE, - std::string()); + tab_->tab_contents()->controller().LoadURL( + GetDialogContentURL(), + content::Referrer(), + content::PAGE_TRANSITION_START_PAGE, + std::string()); GtkDialogFlags flags = GTK_DIALOG_NO_SEPARATOR; if (delegate_->IsDialogModal()) flags = static_cast<GtkDialogFlags>(flags | GTK_DIALOG_MODAL); diff --git a/chrome/browser/ui/gtk/tabs/drag_data.cc b/chrome/browser/ui/gtk/tabs/drag_data.cc index a44f069..99588aa 100644 --- a/chrome/browser/ui/gtk/tabs/drag_data.cc +++ b/chrome/browser/ui/gtk/tabs/drag_data.cc @@ -7,6 +7,7 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/gtk/tabs/tab_gtk.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" DraggedTabData::DraggedTabData() diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc index 65cfcc2..b4014b8 100644 --- a/chrome/browser/ui/intents/web_intent_picker_controller.cc +++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc @@ -116,7 +116,7 @@ WebIntentPickerController::WebIntentPickerController( picker_(NULL), pending_async_count_(0), service_tab_(NULL) { - NavigationController* controller = &wrapper->controller(); + NavigationController* controller = &wrapper->tab_contents()->controller(); registrar_.Add(this, content::NOTIFICATION_LOAD_START, content::Source<NavigationController>(controller)); registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc index 60eb95e..5917fc7 100644 --- a/chrome/browser/ui/login/login_prompt_browsertest.cc +++ b/chrome/browser/ui/login/login_prompt_browsertest.cc @@ -15,6 +15,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/test/test_browser_thread.h" @@ -240,7 +241,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, PrefetchAuthCancels) { TabContentsWrapper* contents = browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents); - NavigationController* controller = &contents->controller(); + NavigationController* controller = &contents->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller)); @@ -266,7 +267,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, TestCancelAuth) { browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents); - NavigationController* controller = &contents->controller(); + NavigationController* controller = &contents->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller)); @@ -361,7 +362,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, MultipleRealmCancellation) { browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents); - NavigationController* controller = &contents->controller(); + NavigationController* controller = &contents->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller)); @@ -413,7 +414,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, MultipleRealmConfirmation) { browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents); - NavigationController* controller = &contents->controller(); + NavigationController* controller = &contents->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller)); @@ -465,7 +466,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, IncorrectConfirmation) { browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents); - NavigationController* controller = &contents->controller(); + NavigationController* controller = &contents->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller)); @@ -536,7 +537,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, NoLoginPromptForFavicon) { browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents); - NavigationController* controller = &contents->controller(); + NavigationController* controller = &contents->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller)); @@ -591,7 +592,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, BlockCrossdomainPrompt) { TabContentsWrapper* contents = browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents); - NavigationController* controller = &contents->controller(); + NavigationController* controller = &contents->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller)); @@ -656,7 +657,8 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, SupplyRedundantAuths) { TabContentsWrapper* contents_1 = browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents_1); - NavigationController* controller_1 = &contents_1->controller(); + NavigationController* controller_1 = + &contents_1->tab_contents()->controller(); // Open a new tab. ui_test_utils::NavigateToURLWithDisposition( @@ -670,7 +672,8 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, SupplyRedundantAuths) { browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents_2); ASSERT_NE(contents_1, contents_2); - NavigationController* controller_2 = &contents_2->controller(); + NavigationController* controller_2 = + &contents_2->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller_1)); @@ -722,7 +725,8 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, CancelRedundantAuths) { TabContentsWrapper* contents_1 = browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents_1); - NavigationController* controller_1 = &contents_1->controller(); + NavigationController* controller_1 = + &contents_1->tab_contents()->controller(); // Open a new tab. ui_test_utils::NavigateToURLWithDisposition( @@ -736,7 +740,8 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, CancelRedundantAuths) { browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents_2); ASSERT_NE(contents_1, contents_2); - NavigationController* controller_2 = &contents_2->controller(); + NavigationController* controller_2 = + &contents_2->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller_1)); @@ -789,7 +794,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, TabContentsWrapper* contents = browser()->GetSelectedTabContentsWrapper(); ASSERT_TRUE(contents); - NavigationController* controller = &contents->controller(); + NavigationController* controller = &contents->tab_contents()->controller(); // Open an incognito window. Browser* browser_incognito = CreateIncognitoBrowser(); @@ -800,7 +805,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, ASSERT_TRUE(contents_incognito); ASSERT_NE(contents, contents_incognito); NavigationController* controller_incognito = - &contents_incognito->controller(); + &contents_incognito->tab_contents()->controller(); LoginPromptBrowserTestObserver observer; observer.Register(content::Source<NavigationController>(controller)); diff --git a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc index 7e70821..632e14f 100644 --- a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc +++ b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc @@ -22,6 +22,7 @@ #include "chrome/common/pref_names.h" #include "content/browser/plugin_service.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" @@ -136,11 +137,11 @@ void OpenUsingReader(TabContentsWrapper* tab, InfoBarDelegate* old_delegate, InfoBarDelegate* new_delegate) { ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( - tab->render_view_host()->process()->GetID(), - tab->render_view_host()->routing_id(), + tab->tab_contents()->render_view_host()->process()->GetID(), + tab->tab_contents()->render_view_host()->routing_id(), tab->tab_contents()->GetURL(), ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName)); - tab->render_view_host()->ReloadFrame(); + tab->tab_contents()->render_view_host()->ReloadFrame(); if (new_delegate) { if (old_delegate) { @@ -402,6 +403,6 @@ void PDFHasUnsupportedFeature(TabContentsWrapper* tab) { PluginService::GetInstance()->GetPluginGroups( base::Bind(&GotPluginGroupsCallback, - tab->render_view_host()->process()->GetID(), - tab->render_view_host()->routing_id())); + tab->tab_contents()->render_view_host()->process()->GetID(), + tab->tab_contents()->render_view_host()->routing_id())); } diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index 955501f..aae0a6a 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -17,6 +17,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "grit/locale_settings.h" diff --git a/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc index d4aa993..65d66a5 100644 --- a/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc +++ b/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc @@ -46,26 +46,28 @@ const std::string& TabContentsWrapperSyncedTabDelegate::GetExtensionAppId() } int TabContentsWrapperSyncedTabDelegate::GetCurrentEntryIndex() const { - return tab_contents_wrapper_->controller().GetCurrentEntryIndex(); + return tab_contents_wrapper_->tab_contents()->controller(). + GetCurrentEntryIndex(); } int TabContentsWrapperSyncedTabDelegate::GetEntryCount() const { - return tab_contents_wrapper_->controller().entry_count(); + return tab_contents_wrapper_->tab_contents()->controller().entry_count(); } int TabContentsWrapperSyncedTabDelegate::GetPendingEntryIndex() const { - return tab_contents_wrapper_->controller().pending_entry_index(); + return tab_contents_wrapper_->tab_contents()->controller(). + pending_entry_index(); } NavigationEntry* TabContentsWrapperSyncedTabDelegate::GetPendingEntry() const { - return tab_contents_wrapper_->controller().pending_entry(); + return tab_contents_wrapper_->tab_contents()->controller().pending_entry(); } NavigationEntry* TabContentsWrapperSyncedTabDelegate::GetEntryAtIndex(int i) const { - return tab_contents_wrapper_->controller().GetEntryAtIndex(i); + return tab_contents_wrapper_->tab_contents()->controller().GetEntryAtIndex(i); } NavigationEntry* TabContentsWrapperSyncedTabDelegate::GetActiveEntry() const { - return tab_contents_wrapper_->controller().GetActiveEntry(); + return tab_contents_wrapper_->tab_contents()->controller().GetActiveEntry(); } diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc index 25eac33..c08a420 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper.cc +++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc @@ -7,6 +7,7 @@ #include "chrome/browser/renderer_host/web_cache_manager.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index e04443d..f5a26ef 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -45,6 +45,7 @@ #include "chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.h" #include "chrome/browser/ui/tab_contents/core_tab_helper.h" #include "chrome/common/chrome_switches.h" +#include "content/browser/tab_contents/tab_contents.h" namespace { diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h index bbfd333..08345c5 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h @@ -13,7 +13,7 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "base/property_bag.h" #include "content/browser/tab_contents/tab_contents_observer.h" class AlternateErrorPageTabObserver; @@ -72,9 +72,10 @@ class SafeBrowsingTabObserver; // Wraps TabContents and all of its supporting objects in order to control // their ownership and lifetime, while allowing TabContents to remain generic // and re-usable in other projects. -// TODO(pinkerton): Eventually, this class will become TabContents as far as +// +// TODO(avi): Eventually, this class will become TabContents as far as // the browser front-end is concerned, and the current TabContents will be -// renamed to something like WebPage or WebView (ben's suggestions). +// renamed to something like WebContents; <http://crbug.com/105875>. class TabContentsWrapper : public TabContentsObserver { public: // Takes ownership of |contents|, which must be heap-allocated (as it lives @@ -82,10 +83,6 @@ class TabContentsWrapper : public TabContentsObserver { explicit TabContentsWrapper(TabContents* contents); virtual ~TabContentsWrapper(); - // Used to retrieve this object from |tab_contents_|, which is placed in - // its property bag to avoid adding additional interfaces. - static base::PropertyAccessor<TabContentsWrapper*>* property_accessor(); - // Create a TabContentsWrapper with the same state as this one. The returned // heap-allocated pointer is owned by the caller. TabContentsWrapper* Clone(); @@ -101,16 +98,10 @@ class TabContentsWrapper : public TabContentsObserver { static const TabContentsWrapper* GetCurrentWrapperForContents( const TabContents* contents); + // Returns the TabContents that this wraps. TabContents* tab_contents() const { return tab_contents_.get(); } - NavigationController& controller() const { - return tab_contents()->controller(); - } - TabContentsView* view() const { return tab_contents()->view(); } - RenderViewHost* render_view_host() const { - return tab_contents()->render_view_host(); - } - WebUI* web_ui() const { return tab_contents()->web_ui(); } + // Returns the Profile that is associated with this TabContentsWrapper. Profile* profile() const; // Tab Helpers --------------------------------------------------------------- @@ -206,6 +197,10 @@ class TabContentsWrapper : public TabContentsObserver { FRIEND_TEST_ALL_PREFIXES( PrefsTabHelperTest, OverridePrefsOnViewCreation); + // Used to retrieve this object from |tab_contents_|, which is placed in + // its property bag to avoid adding additional interfaces. + static base::PropertyAccessor<TabContentsWrapper*>* property_accessor(); + // Tab Helpers --------------------------------------------------------------- // (These provide API for callers and have a getter function listed in the // "Tab Helpers" section in the member functions area, above.) @@ -237,9 +232,6 @@ class TabContentsWrapper : public TabContentsObserver { scoped_ptr<RestoreTabHelper> restore_tab_helper_; - // Handles displaying a web intents picker to the user. - scoped_ptr<WebIntentPickerController> web_intent_picker_controller_; - scoped_ptr<SearchEngineTabHelper> search_engine_tab_helper_; scoped_ptr<SnapshotTabHelper> snapshot_tab_helper_; scoped_ptr<TabContentsSSLHelper> ssl_helper_; @@ -251,6 +243,9 @@ class TabContentsWrapper : public TabContentsObserver { scoped_ptr<TranslateTabHelper> translate_tab_helper_; + // Handles displaying a web intents picker to the user. + scoped_ptr<WebIntentPickerController> web_intent_picker_controller_; + // Per-tab observers --------------------------------------------------------- // (These provide no API for callers; objects that need to exist 1:1 with tabs // and silently do their thing live here.) diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc index 3c4a5eb..9f4938a 100644 --- a/chrome/browser/ui/views/collected_cookies_win.cc +++ b/chrome/browser/ui/views/collected_cookies_win.cc @@ -17,6 +17,7 @@ #include "chrome/browser/ui/views/cookie_info_view.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/ui/views/find_bar_host.cc b/chrome/browser/ui/views/find_bar_host.cc index b4d214e..442b8dd 100644 --- a/chrome/browser/ui/views/find_bar_host.cc +++ b/chrome/browser/ui/views/find_bar_host.cc @@ -69,7 +69,8 @@ bool FindBarHost::MaybeForwardKeyEventToWebpage( if (!contents) return false; - RenderViewHost* render_view_host = contents->render_view_host(); + RenderViewHost* render_view_host = + contents->tab_contents()->render_view_host(); // Make sure we don't have a text field element interfering with keyboard // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". @@ -319,7 +320,8 @@ void FindBarHost::UnregisterAccelerators() { void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowScreenBounds(); - TabContentsView* tab_view = find_bar_controller_->tab_contents()->view(); + TabContentsView* tab_view = + find_bar_controller_->tab_contents()->tab_contents()->view(); gfx::Rect webcontents_rect; tab_view->GetViewBounds(&webcontents_rect); avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 50060c7..e962922 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -1440,7 +1440,7 @@ void BrowserView::TabDeactivated(TabContentsWrapper* contents) { // 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 (!contents->tab_contents()->is_being_destroyed()) - contents->view()->StoreFocus(); + contents->tab_contents()->view()->StoreFocus(); } void BrowserView::ActiveTabChanged(TabContentsWrapper* old_contents, @@ -2608,7 +2608,7 @@ void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents) { !browser_->tabstrip_model()->closing_all() && GetWidget()->IsVisible()) { // We only restore focus if our window is visible, to avoid invoking blur // handlers when we are eventually shown. - new_contents->view()->RestoreFocus(); + new_contents->tab_contents()->view()->RestoreFocus(); } // Update all the UI bits. diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index b495217..061df5b 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -43,6 +43,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/renderer_host/render_widget_host_view.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc index 6a04d4f..225fd85c 100644 --- a/chrome/browser/ui/web_applications/web_app_ui.cc +++ b/chrome/browser/ui/web_applications/web_app_ui.cc @@ -101,8 +101,10 @@ UpdateShortcutWorker::UpdateShortcutWorker(TabContentsWrapper* tab_contents) file_name_ = web_app::internals::GetSanitizedFileName(shortcut_info_.title); registrar_.Add( - this, content::NOTIFICATION_TAB_CLOSING, - content::Source<NavigationController>(&tab_contents_->controller())); + this, + content::NOTIFICATION_TAB_CLOSING, + content::Source<NavigationController>( + &tab_contents_->tab_contents()->controller())); } void UpdateShortcutWorker::Run() { @@ -116,7 +118,7 @@ void UpdateShortcutWorker::Observe( const content::NotificationDetails& details) { if (type == content::NOTIFICATION_TAB_CLOSING && content::Source<NavigationController>(source).ptr() == - &tab_contents_->controller()) { + &tab_contents_->tab_contents()->controller()) { // Underlying tab is closing. tab_contents_ = NULL; } diff --git a/chrome/browser/ui/webui/certificate_viewer_ui.cc b/chrome/browser/ui/webui/certificate_viewer_ui.cc index 24f1895..e366afe 100644 --- a/chrome/browser/ui/webui/certificate_viewer_ui.cc +++ b/chrome/browser/ui/webui/certificate_viewer_ui.cc @@ -8,6 +8,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" #include "chrome/common/url_constants.h" +#include "content/browser/tab_contents/tab_contents.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/ui/webui/media/media_internals_ui.cc b/chrome/browser/ui/webui/media/media_internals_ui.cc index cd8848c..fded7ac 100644 --- a/chrome/browser/ui/webui/media/media_internals_ui.cc +++ b/chrome/browser/ui/webui/media/media_internals_ui.cc @@ -12,6 +12,7 @@ #include "chrome/browser/ui/webui/media/media_internals_handler.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/url_constants.h" +#include "content/browser/tab_contents/tab_contents.h" #include "grit/browser_resources.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc index d868926..03233b5 100644 --- a/chrome/browser/ui/webui/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview_handler.cc @@ -308,7 +308,8 @@ void PrintPreviewHandler::HandleGetPreview(const ListValue* args) { settings->SetString(printing::kSettingHeaderFooterTitle, initiator_tab->tab_contents()->GetTitle()); std::string url; - NavigationEntry* entry = initiator_tab->controller().GetActiveEntry(); + NavigationEntry* entry = + initiator_tab->tab_contents()->controller().GetActiveEntry(); if (entry) url = entry->virtual_url().spec(); settings->SetString(printing::kSettingHeaderFooterURL, url); @@ -336,7 +337,7 @@ void PrintPreviewHandler::HandleGetPreview(const ListValue* args) { } VLOG(1) << "Print preview request start"; - RenderViewHost* rvh = initiator_tab->render_view_host(); + RenderViewHost* rvh = initiator_tab->tab_contents()->render_view_host(); rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); } @@ -351,7 +352,7 @@ void PrintPreviewHandler::HandlePrint(const ListValue* args) { TabContentsWrapper* initiator_tab = GetInitiatorTab(); CHECK(initiator_tab); - RenderViewHost* init_rvh = initiator_tab->render_view_host(); + RenderViewHost* init_rvh = initiator_tab->tab_contents()->render_view_host(); init_rvh->Send(new PrintMsg_ResetScriptedPrintCount(init_rvh->routing_id())); scoped_ptr<DictionaryValue> settings(GetSettingsDictionary(args)); diff --git a/chrome/browser/ui/webui/print_preview_handler_unittest.cc b/chrome/browser/ui/webui/print_preview_handler_unittest.cc index 1b27188..e21cff6b 100644 --- a/chrome/browser/ui/webui/print_preview_handler_unittest.cc +++ b/chrome/browser/ui/webui/print_preview_handler_unittest.cc @@ -15,6 +15,7 @@ #include "chrome/browser/ui/webui/print_preview_ui.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/browser_with_test_window_test.h" +#include "content/browser/tab_contents/tab_contents.h" #include "printing/page_size_margins.h" #include "printing/print_job_constants.h" @@ -68,7 +69,8 @@ class PrintPreviewHandlerTest : public BrowserWithTestWindowTest { preview_tab_ = controller->GetOrCreatePreviewTab(initiator_tab); ASSERT_TRUE(preview_tab_); - preview_ui_ = static_cast<PrintPreviewUI*>(preview_tab_->web_ui()); + preview_ui_ = + static_cast<PrintPreviewUI*>(preview_tab_->tab_contents()->web_ui()); ASSERT_TRUE(preview_ui_); } diff --git a/chrome/browser/ui/webui/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview_ui.cc index dd4a725..43b230b 100644 --- a/chrome/browser/ui/webui/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview_ui.cc @@ -126,10 +126,10 @@ void PrintPreviewUI::SetInitiatorTabURLAndTitle( void PrintPreviewUI::SetSourceIsModifiable( TabContentsWrapper* print_preview_tab, bool source_is_modifiable) { - if (!print_preview_tab || !print_preview_tab->web_ui()) + if (!print_preview_tab || !print_preview_tab->tab_contents()->web_ui()) return; PrintPreviewUI* print_preview_ui = - static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); + static_cast<PrintPreviewUI*>(print_preview_tab->tab_contents()->web_ui()); print_preview_ui->source_is_modifiable_ = source_is_modifiable; } diff --git a/chrome/browser/ui/webui/print_preview_ui_unittest.cc b/chrome/browser/ui/webui/print_preview_ui_unittest.cc index 19c546f..861d858 100644 --- a/chrome/browser/ui/webui/print_preview_ui_unittest.cc +++ b/chrome/browser/ui/webui/print_preview_ui_unittest.cc @@ -57,7 +57,7 @@ TEST_F(PrintPreviewUIUnitTest, PrintPreviewData) { EXPECT_EQ(1U, GetConstrainedWindowCount(initiator_tab)); PrintPreviewUI* preview_ui = - reinterpret_cast<PrintPreviewUI*>(preview_tab->web_ui()); + reinterpret_cast<PrintPreviewUI*>(preview_tab->tab_contents()->web_ui()); ASSERT_TRUE(preview_ui != NULL); scoped_refptr<RefCountedBytes> data; @@ -119,7 +119,7 @@ TEST_F(PrintPreviewUIUnitTest, PrintPreviewDraftPages) { EXPECT_EQ(1U, GetConstrainedWindowCount(initiator_tab)); PrintPreviewUI* preview_ui = - reinterpret_cast<PrintPreviewUI*>(preview_tab->web_ui()); + reinterpret_cast<PrintPreviewUI*>(preview_tab->tab_contents()->web_ui()); ASSERT_TRUE(preview_ui != NULL); scoped_refptr<RefCountedBytes> data; @@ -188,7 +188,7 @@ TEST_F(PrintPreviewUIUnitTest, GetCurrentPrintPreviewStatus) { EXPECT_EQ(1U, GetConstrainedWindowCount(initiator_tab)); PrintPreviewUI* preview_ui = - reinterpret_cast<PrintPreviewUI*>(preview_tab->web_ui()); + reinterpret_cast<PrintPreviewUI*>(preview_tab->tab_contents()->web_ui()); ASSERT_TRUE(preview_ui != NULL); // Test with invalid |preview_ui_addr|. diff --git a/chrome/browser/ui/webui/sync_internals_ui.cc b/chrome/browser/ui/webui/sync_internals_ui.cc index 8b03d28..ef53b9b 100644 --- a/chrome/browser/ui/webui/sync_internals_ui.cc +++ b/chrome/browser/ui/webui/sync_internals_ui.cc @@ -24,6 +24,7 @@ #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/url_constants.h" +#include "content/browser/tab_contents/tab_contents.h" #include "grit/sync_internals_resources.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc index d960cc1..971ecb3 100644 --- a/chrome/browser/ui/webui/web_ui_browsertest.cc +++ b/chrome/browser/ui/webui/web_ui_browsertest.cc @@ -178,7 +178,8 @@ void WebUIBrowserTest::PreLoadJavascriptLibraries( void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) { TestNavigationObserver navigation_observer( content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->controller()), + &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + controller()), this, 1); browser::NavigateParams params( browser(), GURL(browse_to), content::PAGE_TRANSITION_TYPED); @@ -200,7 +201,7 @@ void WebUIBrowserTest::BrowsePrintPreload(const GURL& browse_to) { TabContentsWrapper* preview_tab = tab_controller->GetPrintPreviewForTab( browser()->GetSelectedTabContentsWrapper()); ASSERT_TRUE(preview_tab); - SetWebUIInstance(preview_tab->web_ui()); + SetWebUIInstance(preview_tab->tab_contents()->web_ui()); } const char WebUIBrowserTest::kDummyURL[] = "chrome://DummyURL"; diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index d0e792d..d071474 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc @@ -64,7 +64,7 @@ void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { params.tabstrip_index = 0; params.disposition = NEW_FOREGROUND_TAB; browser::Navigate(¶ms); - CommitPendingLoad(¶ms.target_contents->controller()); + CommitPendingLoad(¶ms.target_contents->tab_contents()->controller()); } void BrowserWithTestWindowTest::CommitPendingLoad( diff --git a/chrome/test/base/test_tab_strip_model_observer.cc b/chrome/test/base/test_tab_strip_model_observer.cc index 7beda3c..dcb8196 100644 --- a/chrome/test/base/test_tab_strip_model_observer.cc +++ b/chrome/test/base/test_tab_strip_model_observer.cc @@ -9,6 +9,7 @@ #include "chrome/browser/printing/print_preview_tab_controller.h" #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_source.h" TestTabStripModelObserver::TestTabStripModelObserver( @@ -41,8 +42,8 @@ void TestTabStripModelObserver::ObservePrintPreviewTabContents( TabContentsWrapper* preview_tab = tab_controller->GetPrintPreviewForTab(contents); if (preview_tab) { - RegisterAsObserver( - content::Source<NavigationController>(&preview_tab->controller())); + RegisterAsObserver(content::Source<NavigationController>( + &preview_tab->tab_contents()->controller())); } } } |