summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-18 16:17:49 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-18 16:17:49 +0000
commit3c9e187bd8ec34ebf2a91a37c868584c465647e8 (patch)
tree84c9540d220fa155cf2af8c944638c0719dee670 /chrome/browser/ui
parent3e35b224fd0c36f17f432f23e2eb3729667210b1 (diff)
downloadchromium_src-3c9e187bd8ec34ebf2a91a37c868584c465647e8.zip
chromium_src-3c9e187bd8ec34ebf2a91a37c868584c465647e8.tar.gz
chromium_src-3c9e187bd8ec34ebf2a91a37c868584c465647e8.tar.bz2
Make pink's TabContentsWrapper change compile on Windows.
Code by pinkerton@, with modifications by evanm and myself to get it to build on windows/linux/chromeos. BUG=none TEST=none Review URL: http://codereview.chromium.org/4694008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/browser.cc271
-rw-r--r--chrome/browser/ui/browser.h76
-rw-r--r--chrome/browser/ui/browser_init.cc5
-rw-r--r--chrome/browser/ui/browser_navigator.cc49
-rw-r--r--chrome/browser/ui/browser_navigator.h8
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest.cc26
-rw-r--r--chrome/browser/ui/browser_window.h3
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc56
-rw-r--r--chrome/browser/ui/views/frame/browser_view.h31
-rw-r--r--chrome/browser/ui/views/location_bar/click_handler.cc3
-rw-r--r--chrome/browser/ui/views/location_bar/content_setting_image_view.cc3
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc35
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.h7
-rw-r--r--chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc49
-rw-r--r--chrome/browser/ui/views/tabs/browser_tab_strip_controller.h29
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_controller.cc20
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_controller.h9
-rw-r--r--chrome/browser/ui/views/toolbar_view.cc4
-rw-r--r--chrome/browser/ui/views/toolbar_view.h2
19 files changed, 393 insertions, 293 deletions
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index c64818f..2f02b64 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -82,6 +82,7 @@
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/tab_menu_model.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/ui/browser_navigator.h"
@@ -328,7 +329,8 @@ Browser* Browser::CreateForPopup(Type type,
Browser* browser = new Browser(type, profile);
browser->set_override_bounds(initial_bounds);
browser->CreateBrowserWindow();
- browser->tabstrip_model()->AppendTabContents(new_contents, true);
+ TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents);
+ browser->tabstrip_model()->AppendTabContents(wrapper, true);
return browser;
}
@@ -561,8 +563,9 @@ TabContents* Browser::OpenApplicationWindow(
bool as_panel = extension && (container == extension_misc::LAUNCH_PANEL);
Browser* browser = Browser::CreateForApp(app_name, extension, profile,
as_panel);
- TabContents* contents =
+ TabContentsWrapper* wrapper =
browser->AddSelectedTabWithURL(url, PageTransition::START_PAGE);
+ TabContents* contents = wrapper->tab_contents();
contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
contents->render_view_host()->SyncRendererPrefs();
browser->window()->Show();
@@ -619,13 +622,13 @@ TabContents* Browser::OpenApplicationTab(Profile* profile,
// Launch the application in the existing TabContents, if it was supplied.
if (existing_tab) {
TabStripModel* model = browser->tabstrip_model();
- int tab_index = model->GetIndexOfTabContents(existing_tab);
+ int tab_index = model->GetWrapperIndex(existing_tab);
existing_tab->OpenURL(extension->GetFullLaunchURL(), existing_tab->GetURL(),
CURRENT_TAB, PageTransition::LINK);
if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) {
model->SetTabPinned(tab_index, true);
- tab_index = model->GetIndexOfTabContents(existing_tab);
+ tab_index = model->GetWrapperIndex(existing_tab);
}
if (params.tabstrip_add_types & TabStripModel::ADD_SELECTED)
model->SelectTabContentsAt(tab_index, true);
@@ -634,7 +637,7 @@ TabContents* Browser::OpenApplicationTab(Profile* profile,
} else {
params.disposition = NEW_FOREGROUND_TAB;
browser::Navigate(&params);
- contents = params.target_contents;
+ contents = params.target_contents->tab_contents();
}
if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN)
@@ -764,8 +767,7 @@ SkBitmap Browser::GetCurrentPageIcon() const {
}
string16 Browser::GetWindowTitleForCurrentTab() const {
- TabContents* contents =
- tab_handler_->GetTabStripModel()->GetSelectedTabContents();
+ TabContents* contents = GetSelectedTabContents();
string16 title;
// |contents| can be NULL because GetWindowTitleForCurrentTab is called by the
@@ -897,12 +899,25 @@ int Browser::GetIndexOfController(
return tab_handler_->GetTabStripModel()->GetIndexOfController(controller);
}
-TabContents* Browser::GetTabContentsAt(int index) const {
- return tab_handler_->GetTabStripModel()->GetTabContentsAt(index);
+TabContentsWrapper* Browser::GetSelectedTabContentsWrapper() const {
+ return tabstrip_model()->GetSelectedTabContents();
+}
+TabContentsWrapper* Browser::GetTabContentsWrapperAt(int index) const {
+ return tabstrip_model()->GetTabContentsAt(index);
}
TabContents* Browser::GetSelectedTabContents() const {
- return tab_handler_->GetTabStripModel()->GetSelectedTabContents();
+ TabContentsWrapper* wrapper = GetSelectedTabContentsWrapper();
+ if (wrapper)
+ return wrapper->tab_contents();
+ return NULL;
+}
+
+TabContents* Browser::GetTabContentsAt(int index) const {
+ TabContentsWrapper* wrapper = tabstrip_model()->GetTabContentsAt(index);
+ if (wrapper)
+ return wrapper->tab_contents();
+ return NULL;
}
void Browser::SelectTabContentsAt(int index, bool user_gesture) {
@@ -921,7 +936,7 @@ int Browser::GetIndexForInsertionDuringRestore(int relative_index) {
TabStripModel::INSERT_AFTER) ? tab_count() : relative_index;
}
-TabContents* Browser::AddSelectedTabWithURL(const GURL& url,
+TabContentsWrapper* Browser::AddSelectedTabWithURL(const GURL& url,
PageTransition::Type transition) {
browser::NavigateParams params(this, url, transition);
params.disposition = NEW_FOREGROUND_TAB;
@@ -929,11 +944,11 @@ TabContents* Browser::AddSelectedTabWithURL(const GURL& url,
return params.target_contents;
}
-TabContents* Browser::AddTab(TabContents* tab_contents,
+TabContents* Browser::AddTab(TabContentsWrapper* tab_contents,
PageTransition::Type type) {
tab_handler_->GetTabStripModel()->AddTabContents(
tab_contents, -1, type, TabStripModel::ADD_SELECTED);
- return tab_contents;
+ return tab_contents->tab_contents();
}
void Browser::AddTabContents(TabContents* new_contents,
@@ -969,10 +984,11 @@ TabContents* Browser::AddRestoredTab(
bool pin,
bool from_last_session,
SessionStorageNamespace* session_storage_namespace) {
- TabContents* new_tab = new TabContents(
- profile(), NULL, MSG_ROUTING_NONE,
- tab_handler_->GetTabStripModel()->GetSelectedTabContents(),
+ TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL,
+ MSG_ROUTING_NONE,
+ GetSelectedTabContents(),
session_storage_namespace);
+ TabContents* new_tab = wrapper->tab_contents();
new_tab->SetExtensionAppById(extension_app_id);
new_tab->controller().RestoreFromState(navigations, selected_navigation,
from_last_session);
@@ -980,7 +996,7 @@ TabContents* Browser::AddRestoredTab(
bool really_pin =
(pin && tab_index == tabstrip_model()->IndexOfFirstNonMiniTab());
tab_handler_->GetTabStripModel()->InsertTabContentsAt(
- tab_index, new_tab,
+ tab_index, wrapper,
select ? TabStripModel::ADD_SELECTED : TabStripModel::ADD_NONE);
if (really_pin)
tab_handler_->GetTabStripModel()->SetTabPinned(tab_index, true);
@@ -1010,17 +1026,18 @@ void Browser::ReplaceRestoredTab(
bool from_last_session,
const std::string& extension_app_id,
SessionStorageNamespace* session_storage_namespace) {
- TabContents* replacement = new TabContents(profile(), NULL,
+ TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL,
MSG_ROUTING_NONE,
- tab_handler_->GetTabStripModel()->GetSelectedTabContents(),
+ GetSelectedTabContents(),
session_storage_namespace);
+ TabContents* replacement = wrapper->tab_contents();
replacement->SetExtensionAppById(extension_app_id);
replacement->controller().RestoreFromState(navigations, selected_navigation,
from_last_session);
tab_handler_->GetTabStripModel()->ReplaceNavigationControllerAt(
tab_handler_->GetTabStripModel()->selected_index(),
- &replacement->controller());
+ wrapper);
}
bool Browser::CanRestoreTab() {
@@ -1111,7 +1128,7 @@ bool Browser::ShouldOpenNewTabForWindowDisposition(
TabContents* Browser::GetOrCloneTabForDisposition(
WindowOpenDisposition disposition) {
- TabContents* current_tab = GetSelectedTabContents();
+ TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper();
if (ShouldOpenNewTabForWindowDisposition(disposition)) {
current_tab = current_tab->Clone();
tab_handler_->GetTabStripModel()->AddTabContents(
@@ -1119,7 +1136,7 @@ TabContents* Browser::GetOrCloneTabForDisposition(
disposition == NEW_FOREGROUND_TAB ? TabStripModel::ADD_SELECTED :
TabStripModel::ADD_NONE);
}
- return current_tab;
+ return current_tab->tab_contents();
}
void Browser::UpdateTabStripModelInsertionPolicy() {
@@ -1182,12 +1199,13 @@ bool Browser::IsClosingPermitted() {
void Browser::GoBack(WindowOpenDisposition disposition) {
UserMetrics::RecordAction(UserMetricsAction("Back"), profile_);
- TabContents* current_tab = GetSelectedTabContents();
+ TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper();
if (current_tab->controller().CanGoBack()) {
TabContents* new_tab = GetOrCloneTabForDisposition(disposition);
// If we are on an interstitial page and clone the tab, it won't be copied
// to the new tab, so we don't need to go back.
- if (current_tab->showing_interstitial_page() && (new_tab != current_tab))
+ if (current_tab->tab_contents()->showing_interstitial_page() &&
+ (new_tab != current_tab->tab_contents()))
return;
new_tab->controller().GoBack();
}
@@ -1195,7 +1213,7 @@ void Browser::GoBack(WindowOpenDisposition disposition) {
void Browser::GoForward(WindowOpenDisposition disposition) {
UserMetrics::RecordAction(UserMetricsAction("Forward"), profile_);
- if (GetSelectedTabContents()->controller().CanGoForward())
+ if (GetSelectedTabContentsWrapper()->controller().CanGoForward())
GetOrCloneTabForDisposition(disposition)->controller().GoForward();
}
@@ -1221,13 +1239,13 @@ void Browser::ReloadInternal(WindowOpenDisposition disposition,
}
// As this is caused by a user action, give the focus to the page.
- current_tab = GetOrCloneTabForDisposition(disposition);
- if (!current_tab->FocusLocationBarByDefault())
- current_tab->Focus();
+ TabContents* tab = GetOrCloneTabForDisposition(disposition);
+ if (!tab->FocusLocationBarByDefault())
+ tab->Focus();
if (ignore_cache)
- current_tab->controller().ReloadIgnoringCache(true);
+ tab->controller().ReloadIgnoringCache(true);
else
- current_tab->controller().Reload(true);
+ tab->controller().Reload(true);
}
void Browser::Home(WindowOpenDisposition disposition) {
@@ -1257,7 +1275,7 @@ void Browser::OpenCurrentURL() {
void Browser::Stop() {
UserMetrics::RecordAction(UserMetricsAction("Stop"), profile_);
- GetSelectedTabContents()->Stop();
+ GetSelectedTabContentsWrapper()->tab_contents()->Stop();
}
void Browser::NewWindow() {
@@ -1297,7 +1315,7 @@ void Browser::NewTab() {
// The call to AddBlankTab above did not set the focus to the tab as its
// window was not active, so we have to do it explicitly.
// See http://crbug.com/6380.
- b->GetSelectedTabContents()->view()->RestoreFocus();
+ b->GetSelectedTabContentsWrapper()->view()->RestoreFocus();
}
}
@@ -1391,7 +1409,7 @@ void Browser::WriteCurrentURLToClipboard() {
void Browser::ConvertPopupToTabbedBrowser() {
UserMetrics::RecordAction(UserMetricsAction("ShowAsTab"), profile_);
int tab_strip_index = tab_handler_->GetTabStripModel()->selected_index();
- TabContents* contents =
+ TabContentsWrapper* contents =
tab_handler_->GetTabStripModel()->DetachTabContentsAt(tab_strip_index);
Browser* browser = Browser::Create(profile_);
browser->tabstrip_model()->AppendTabContents(contents, true);
@@ -1587,7 +1605,7 @@ void Browser::Zoom(PageZoom::Function zoom_function) {
UserMetrics::RecordAction(kActions[zoom_function - PageZoom::ZOOM_OUT],
profile_);
- TabContents* tab_contents = GetSelectedTabContents();
+ TabContentsWrapper* tab_contents = GetSelectedTabContentsWrapper();
tab_contents->render_view_host()->Zoom(zoom_function);
}
@@ -1658,9 +1676,10 @@ void Browser::OpenFile() {
void Browser::OpenCreateShortcutsDialog() {
UserMetrics::RecordAction(UserMetricsAction("CreateShortcut"), profile_);
#if defined(OS_WIN) || defined(OS_LINUX)
- TabContents* current_tab = GetSelectedTabContents();
- DCHECK(current_tab && web_app::IsValidUrl(current_tab->GetURL())) <<
- "Menu item should be disabled.";
+ TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper();
+ DCHECK(current_tab &&
+ web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) <<
+ "Menu item should be disabled.";
NavigationEntry* entry = current_tab->controller().GetLastCommittedEntry();
if (!entry)
@@ -1692,7 +1711,7 @@ void Browser::ToggleDevToolsWindow(DevToolsToggleAction action) {
}
UserMetrics::RecordAction(UserMetricsAction(uma_string.c_str()), profile_);
DevToolsManager::GetInstance()->ToggleDevToolsWindow(
- GetSelectedTabContents()->render_view_host(), action);
+ GetSelectedTabContentsWrapper()->render_view_host(), action);
}
void Browser::OpenTaskManager() {
@@ -2043,7 +2062,7 @@ void Browser::ExecuteCommandWithDisposition(
// tab. However, Ben says he tried removing this before and got lots of
// crashes, e.g. from Windows sending WM_COMMANDs at random times during
// window construction. This probably could use closer examination someday.
- if (!GetSelectedTabContents())
+ if (!GetSelectedTabContentsWrapper())
return;
DCHECK(command_updater_.IsCommandEnabled(id)) << "Invalid/disabled command";
@@ -2248,12 +2267,12 @@ int Browser::GetLastBlockedCommand(WindowOpenDisposition* disposition) {
return last_blocked_command_id_;
}
-void Browser::UpdateUIForNavigationInTab(TabContents* contents,
+void Browser::UpdateUIForNavigationInTab(TabContentsWrapper* contents,
PageTransition::Type transition,
bool user_initiated) {
tabstrip_model()->TabNavigating(contents, transition);
- bool contents_is_selected = contents == GetSelectedTabContents();
+ bool contents_is_selected = contents == GetSelectedTabContentsWrapper();
if (user_initiated && contents_is_selected && window()->GetLocationBar()) {
// Forcibly reset the location bar if the url is going to change in the
// current tab, since otherwise it won't discard any ongoing user edits,
@@ -2270,10 +2289,10 @@ void Browser::UpdateUIForNavigationInTab(TabContents* contents,
// displaying a favicon, which controls the throbber. If we updated it here,
// the throbber will show the default favicon for a split second when
// navigating away from the new tab page.
- ScheduleUIUpdate(contents, TabContents::INVALIDATE_URL);
+ ScheduleUIUpdate(contents->tab_contents(), TabContents::INVALIDATE_URL);
if (contents_is_selected)
- contents->Focus();
+ contents->tab_contents()->Focus();
}
GURL Browser::GetHomePage() const {
@@ -2333,11 +2352,11 @@ Browser* Browser::AsBrowser() {
///////////////////////////////////////////////////////////////////////////////
// Browser, TabStripModelDelegate implementation:
-TabContents* Browser::AddBlankTab(bool foreground) {
+TabContentsWrapper* Browser::AddBlankTab(bool foreground) {
return AddBlankTabAt(-1, foreground);
}
-TabContents* Browser::AddBlankTabAt(int index, bool foreground) {
+TabContentsWrapper* Browser::AddBlankTabAt(int index, bool foreground) {
// Time new tab page creation time. We keep track of the timing data in
// TabContents, but we want to include the time it takes to create the
// TabContents object too.
@@ -2347,14 +2366,16 @@ TabContents* Browser::AddBlankTabAt(int index, bool foreground) {
params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
params.tabstrip_index = index;
browser::Navigate(&params);
- params.target_contents->set_new_tab_start_time(new_tab_start_time);
+ params.target_contents->tab_contents()->set_new_tab_start_time(
+ new_tab_start_time);
return params.target_contents;
}
-Browser* Browser::CreateNewStripWithContents(TabContents* detached_contents,
- const gfx::Rect& window_bounds,
- const DockInfo& dock_info,
- bool maximize) {
+Browser* Browser::CreateNewStripWithContents(
+ TabContentsWrapper* detached_contents,
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info,
+ bool maximize) {
DCHECK(CanSupportWindowFeature(FEATURE_TABSTRIP));
gfx::Rect new_window_bounds = window_bounds;
@@ -2370,18 +2391,18 @@ Browser* Browser::CreateNewStripWithContents(TabContents* detached_contents,
browser->tabstrip_model()->AppendTabContents(detached_contents, true);
// Make sure the loading state is updated correctly, otherwise the throbber
// won't start if the page is loading.
- browser->LoadingStateChanged(detached_contents);
+ browser->LoadingStateChanged(detached_contents->tab_contents());
return browser;
}
-void Browser::ContinueDraggingDetachedTab(TabContents* contents,
+void Browser::ContinueDraggingDetachedTab(TabContentsWrapper* contents,
const gfx::Rect& window_bounds,
const gfx::Rect& tab_bounds) {
Browser* browser = new Browser(TYPE_NORMAL, profile_);
browser->set_override_bounds(window_bounds);
browser->CreateBrowserWindow();
browser->tabstrip_model()->AppendTabContents(contents, true);
- browser->LoadingStateChanged(contents);
+ browser->LoadingStateChanged(contents->tab_contents());
browser->window()->Show();
browser->window()->ContinueDraggingDetachedTab(tab_bounds);
}
@@ -2391,14 +2412,13 @@ int Browser::GetDragActions() const {
TabStripModelDelegate::TAB_MOVE_ACTION : 0);
}
-TabContents* Browser::CreateTabContentsForURL(
+TabContentsWrapper* Browser::CreateTabContentsForURL(
const GURL& url, const GURL& referrer, Profile* profile,
PageTransition::Type transition, bool defer_load,
SiteInstance* instance) const {
- TabContents* contents = new TabContents(profile, instance,
+ TabContentsWrapper* contents = TabContentsFactory(profile, instance,
MSG_ROUTING_NONE,
- tab_handler_->GetTabStripModel()->GetSelectedTabContents(), NULL);
-
+ GetSelectedTabContents(), NULL);
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.
@@ -2414,7 +2434,7 @@ bool Browser::CanDuplicateContentsAt(int index) {
}
void Browser::DuplicateContentsAt(int index) {
- TabContents* contents = GetTabContentsAt(index);
+ TabContentsWrapper* contents = GetTabContentsWrapperAt(index);
TabContents* new_contents = NULL;
DCHECK(contents);
bool pinned = false;
@@ -2422,13 +2442,14 @@ void Browser::DuplicateContentsAt(int index) {
if (CanSupportWindowFeature(FEATURE_TABSTRIP)) {
// If this is a tabbed browser, just create a duplicate tab inside the same
// window next to the tab being duplicated.
- new_contents = contents->Clone();
+ TabContentsWrapper* wrapper = contents->Clone();
+ new_contents = wrapper->tab_contents();
pinned = tab_handler_->GetTabStripModel()->IsTabPinned(index);
int add_types = TabStripModel::ADD_SELECTED |
TabStripModel::ADD_INHERIT_GROUP |
(pinned ? TabStripModel::ADD_PINNED : 0);
tab_handler_->GetTabStripModel()->InsertTabContentsAt(index + 1,
- new_contents,
+ wrapper,
add_types);
} else {
Browser* browser = NULL;
@@ -2452,9 +2473,7 @@ void Browser::DuplicateContentsAt(int index) {
browser->window()->Show();
// The page transition below is only for the purpose of inserting the tab.
- new_contents = browser->AddTab(
- contents->Clone()->controller().tab_contents(),
- PageTransition::LINK);
+ new_contents = browser->AddTab(contents->Clone(), PageTransition::LINK);
}
if (profile_->HasSessionService()) {
@@ -2475,7 +2494,7 @@ void Browser::CloseFrameAfterDragSession() {
#endif
}
-void Browser::CreateHistoricalTab(TabContents* contents) {
+void Browser::CreateHistoricalTab(TabContentsWrapper* contents) {
// We don't create historical tabs for incognito windows or windows without
// profiles.
if (!profile() || profile()->IsOffTheRecord() ||
@@ -2490,8 +2509,8 @@ void Browser::CreateHistoricalTab(TabContents* contents) {
}
}
-bool Browser::RunUnloadListenerBeforeClosing(TabContents* contents) {
- return Browser::RunUnloadEventsHelper(contents);
+bool Browser::RunUnloadListenerBeforeClosing(TabContentsWrapper* contents) {
+ return Browser::RunUnloadEventsHelper(contents->tab_contents());
}
bool Browser::CanReloadContents(TabContents* source) const {
@@ -2550,26 +2569,26 @@ bool Browser::LargeIconsPermitted() const {
///////////////////////////////////////////////////////////////////////////////
// Browser, TabStripModelObserver implementation:
-void Browser::TabInsertedAt(TabContents* contents,
+void Browser::TabInsertedAt(TabContentsWrapper* contents,
int index,
bool foreground) {
- contents->set_delegate(this);
+ contents->tab_contents()->set_delegate(this);
contents->controller().SetWindowID(session_id());
SyncHistoryWithTabs(index);
// Make sure the loading state is updated correctly, otherwise the throbber
// won't start if the page is loading.
- LoadingStateChanged(contents);
+ LoadingStateChanged(contents->tab_contents());
// If the tab crashes in the beforeunload or unload handler, it won't be
// able to ack. But we know we can close it.
registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED,
- Source<TabContents>(contents));
+ Source<TabContentsWrapper>(contents));
}
void Browser::TabClosingAt(TabStripModel* tab_strip_model,
- TabContents* contents,
+ TabContentsWrapper* contents,
int index) {
NotificationService::current()->Notify(
NotificationType::TAB_CLOSING,
@@ -2577,24 +2596,24 @@ void Browser::TabClosingAt(TabStripModel* tab_strip_model,
NotificationService::NoDetails());
// Sever the TabContents' connection back to us.
- contents->set_delegate(NULL);
+ contents->tab_contents()->set_delegate(NULL);
}
-void Browser::TabDetachedAt(TabContents* contents, int index) {
+void Browser::TabDetachedAt(TabContentsWrapper* contents, int index) {
TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH);
}
-void Browser::TabDeselectedAt(TabContents* contents, int index) {
+void Browser::TabDeselectedAt(TabContentsWrapper* contents, int index) {
if (instant())
instant()->DestroyPreviewContents();
// Save what the user's currently typing, so it can be restored when we
// switch back to this tab.
- window_->GetLocationBar()->SaveStateToContents(contents);
+ window_->GetLocationBar()->SaveStateToContents(contents->tab_contents());
}
-void Browser::TabSelectedAt(TabContents* old_contents,
- TabContents* new_contents,
+void Browser::TabSelectedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int index,
bool user_gesture) {
DCHECK(old_contents != new_contents);
@@ -2607,7 +2626,7 @@ void Browser::TabSelectedAt(TabContents* old_contents,
UpdateToolbar(true);
// Update reload/stop state.
- UpdateReloadStopState(new_contents->is_loading(), true);
+ UpdateReloadStopState(new_contents->tab_contents()->is_loading(), true);
// Update commands to reflect current state.
UpdateCommandsForTabState();
@@ -2623,7 +2642,7 @@ void Browser::TabSelectedAt(TabContents* old_contents,
}
if (HasFindBarController()) {
- find_bar_controller_->ChangeTabContents(new_contents);
+ find_bar_controller_->ChangeTabContents(new_contents->tab_contents());
find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true);
}
@@ -2638,7 +2657,7 @@ void Browser::TabSelectedAt(TabContents* old_contents,
}
}
-void Browser::TabMoved(TabContents* contents,
+void Browser::TabMoved(TabContentsWrapper* contents,
int from_index,
int to_index) {
DCHECK(from_index >= 0 && to_index >= 0);
@@ -2646,8 +2665,8 @@ void Browser::TabMoved(TabContents* contents,
SyncHistoryWithTabs(std::min(from_index, to_index));
}
-void Browser::TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents,
+void Browser::TabReplacedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int index) {
TabDetachedAtImpl(old_contents, index, DETACH_TYPE_REPLACE);
TabInsertedAt(new_contents, index,
@@ -2671,7 +2690,7 @@ void Browser::TabReplacedAt(TabContents* old_contents,
}
}
-void Browser::TabPinnedStateChanged(TabContents* contents, int index) {
+void Browser::TabPinnedStateChanged(TabContentsWrapper* contents, int index) {
if (!profile()->HasSessionService())
return;
SessionService* session_service = profile()->GetSessionService();
@@ -2705,7 +2724,9 @@ void Browser::OpenURLFromTab(TabContents* source,
WindowOpenDisposition disposition,
PageTransition::Type transition) {
browser::NavigateParams params(this, url, transition);
- params.source_contents = source;
+ params.source_contents =
+ tabstrip_model()->GetTabContentsAt(
+ tabstrip_model()->GetWrapperIndex(source));
params.referrer = referrer;
params.disposition = disposition;
params.tabstrip_add_types = TabStripModel::ADD_NONE;
@@ -2752,16 +2773,19 @@ void Browser::AddNewContents(TabContents* source,
}
#endif
- browser::NavigateParams params(this, new_contents);
- params.source_contents = source;
- params.disposition = disposition;
- params.window_bounds = initial_pos;
- browser::Navigate(&params);
+ TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents);
+ browser::NavigateParams params(this, wrapper);
+ params.source_contents =
+ tabstrip_model()->GetTabContentsAt(
+ tabstrip_model()->GetWrapperIndex(source));
+ params.disposition = disposition;
+ params.window_bounds = initial_pos;
+ browser::Navigate(&params);
}
void Browser::ActivateContents(TabContents* contents) {
tab_handler_->GetTabStripModel()->SelectTabContentsAt(
- tab_handler_->GetTabStripModel()->GetIndexOfTabContents(contents), false);
+ tab_handler_->GetTabStripModel()->GetWrapperIndex(contents), false);
window_->Activate();
}
@@ -2774,7 +2798,8 @@ void Browser::LoadingStateChanged(TabContents* source) {
tab_handler_->GetTabStripModel()->TabsAreLoading());
window_->UpdateTitleBar();
- if (source == GetSelectedTabContents()) {
+ TabContents* selected_contents = GetSelectedTabContents();
+ if (source == selected_contents) {
UpdateReloadStopState(source->is_loading(), false);
if (GetStatusBubble()) {
GetStatusBubble()->SetStatus(WideToUTF16(
@@ -2807,7 +2832,7 @@ void Browser::CloseContents(TabContents* source) {
return;
}
- int index = tab_handler_->GetTabStripModel()->GetIndexOfTabContents(source);
+ int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source);
if (index == TabStripModel::kNoTab) {
NOTREACHED() << "CloseContents called for tab not in our strip";
return;
@@ -2826,7 +2851,7 @@ void Browser::MoveContents(TabContents* source, const gfx::Rect& pos) {
}
void Browser::DetachContents(TabContents* source) {
- int index = tab_handler_->GetTabStripModel()->GetIndexOfTabContents(source);
+ int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source);
if (index >= 0)
tab_handler_->GetTabStripModel()->DetachTabContentsAt(index);
}
@@ -2890,7 +2915,7 @@ void Browser::OnContentSettingsChange(TabContents* source) {
}
void Browser::SetTabContentBlocked(TabContents* contents, bool blocked) {
- int index = tabstrip_model()->GetIndexOfTabContents(contents);
+ int index = tabstrip_model()->GetWrapperIndex(contents);
if (index == TabStripModel::kNoTab) {
NOTREACHED();
return;
@@ -2921,8 +2946,9 @@ void Browser::ConvertContentsToApplication(TabContents* contents) {
DetachContents(contents);
Browser* browser = Browser::CreateForApp(app_name, NULL, profile_, false);
- browser->tabstrip_model()->AppendTabContents(contents, true);
- TabContents* tab_contents = browser->GetSelectedTabContents();
+ TabContentsWrapper* wrapper = new TabContentsWrapper(contents);
+ browser->tabstrip_model()->AppendTabContents(wrapper, true);
+ TabContents* tab_contents = GetSelectedTabContents();
tab_contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
tab_contents->render_view_host()->SyncRendererPrefs();
browser->window()->Show();
@@ -3186,7 +3212,7 @@ void Browser::Observe(NotificationType type,
const Extension* extension = Details<const Extension>(details).ptr();
TabStripModel* model = tab_handler_->GetTabStripModel();
for (int i = model->count() - 1; i >= 0; --i) {
- TabContents* tc = model->GetTabContentsAt(i);
+ TabContents* tc = model->GetTabContentsAt(i)->tab_contents();
if (tc->GetURL().SchemeIs(chrome::kExtensionScheme) &&
tc->GetURL().host() == extension->id()) {
CloseTabContents(tc);
@@ -3316,20 +3342,20 @@ void Browser::PrepareForInstant() {
window_->PrepareForInstant();
}
-void Browser::ShowInstant(TabContents* preview_contents) {
- DCHECK(instant_->tab_contents() == GetSelectedTabContents());
- window_->ShowInstant(preview_contents);
+void Browser::ShowInstant(TabContentsWrapper* preview_contents) {
+ DCHECK(instant_->tab_contents() == GetSelectedTabContentsWrapper());
+ window_->ShowInstant(preview_contents->tab_contents());
}
void Browser::HideInstant() {
window_->HideInstant();
}
-void Browser::CommitInstant(TabContents* preview_contents) {
- TabContents* tab_contents = instant_->tab_contents();
- int index = tab_handler_->GetTabStripModel()->GetIndexOfTabContents(
- tab_contents);
- DCHECK_NE(-1, index);
+void Browser::CommitInstant(TabContentsWrapper* preview_contents) {
+ TabContentsWrapper* tab_contents = instant_->tab_contents();
+ int index =
+ tab_handler_->GetTabStripModel()->GetIndexOfTabContents(tab_contents);
+ DCHECK_NE(TabStripModel::kNoTab, index);
preview_contents->controller().CopyStateFromAndPrune(
&tab_contents->controller());
// TabStripModel takes ownership of preview_contents.
@@ -3604,7 +3630,7 @@ void Browser::UpdateCommandsForDevTools() {
// Browser, UI update coalescing and handling (private):
void Browser::UpdateToolbar(bool should_restore_state) {
- window_->UpdateToolbar(GetSelectedTabContents(), should_restore_state);
+ window_->UpdateToolbar(GetSelectedTabContentsWrapper(), should_restore_state);
}
void Browser::ScheduleUIUpdate(const TabContents* source,
@@ -3718,7 +3744,7 @@ void Browser::ProcessPendingUIUpdates() {
// Updates that don't depend upon the selected state go here.
if (flags & (TabContents::INVALIDATE_TAB | TabContents::INVALIDATE_TITLE)) {
tab_handler_->GetTabStripModel()->UpdateTabContentsStateAt(
- tab_handler_->GetTabStripModel()->GetIndexOfTabContents(contents),
+ tab_handler_->GetTabStripModel()->GetWrapperIndex(contents),
TabStripModelObserver::ALL);
}
@@ -3986,22 +4012,22 @@ void Browser::CloseFrame() {
window_->Close();
}
-void Browser::TabDetachedAtImpl(TabContents* contents, int index,
+void Browser::TabDetachedAtImpl(TabContentsWrapper* contents, int index,
DetachType type) {
if (type == DETACH_TYPE_DETACH) {
// Save the current location bar state, but only if the tab being detached
// is the selected tab. Because saving state can conditionally revert the
// location bar, saving the current tab's location bar state to a
// non-selected tab can corrupt both tabs.
- if (contents == GetSelectedTabContents())
- window_->GetLocationBar()->SaveStateToContents(contents);
+ if (contents == GetSelectedTabContentsWrapper())
+ window_->GetLocationBar()->SaveStateToContents(contents->tab_contents());
if (!tab_handler_->GetTabStripModel()->closing_all())
SyncHistoryWithTabs(0);
}
- contents->set_delegate(NULL);
- RemoveScheduledUpdatesFor(contents);
+ contents->tab_contents()->set_delegate(NULL);
+ RemoveScheduledUpdatesFor(contents->tab_contents());
if (find_bar_controller_.get() &&
index == tab_handler_->GetTabStripModel()->selected_index()) {
@@ -4009,7 +4035,7 @@ void Browser::TabDetachedAtImpl(TabContents* contents, int index,
}
registrar_.Remove(this, NotificationType::TAB_CONTENTS_DISCONNECTED,
- Source<TabContents>(contents));
+ Source<TabContentsWrapper>(contents));
}
// static
@@ -4049,6 +4075,21 @@ void Browser::TabRestoreServiceDestroyed(TabRestoreService* service) {
tab_restore_service_ = NULL;
}
+// Centralized method for creating a TabContents, configuring and installing
+// all its supporting objects and observers.
+TabContentsWrapper* Browser::TabContentsFactory(
+ Profile* profile,
+ SiteInstance* site_instance,
+ int routing_id,
+ const TabContents* base_tab_contents,
+ SessionStorageNamespace* session_storage_namespace) {
+ TabContents* new_contents = new TabContents(profile, site_instance,
+ routing_id, base_tab_contents,
+ session_storage_namespace);
+ TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents);
+ return wrapper;
+}
+
bool Browser::OpenInstant(WindowOpenDisposition disposition) {
if (!instant() || !instant()->is_active() || !instant()->IsCurrent())
return false;
@@ -4059,7 +4100,7 @@ bool Browser::OpenInstant(WindowOpenDisposition disposition) {
}
if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) {
HideInstant();
- TabContents* preview_contents = instant()->ReleasePreviewContents(
+ TabContentsWrapper* preview_contents = instant()->ReleasePreviewContents(
INSTANT_COMMIT_PRESSED_ENTER);
preview_contents->controller().PruneAllButActive();
tab_handler_->GetTabStripModel()->AddTabContents(
@@ -4068,7 +4109,7 @@ bool Browser::OpenInstant(WindowOpenDisposition disposition) {
instant()->last_transition_type(),
disposition == NEW_FOREGROUND_TAB ? TabStripModel::ADD_SELECTED :
TabStripModel::ADD_NONE);
- instant()->CompleteRelease(preview_contents);
+ instant()->CompleteRelease(preview_contents->tab_contents());
return true;
}
// The omnibox currently doesn't use other dispositions, so we don't attempt
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 3b1e2b5..b70049b 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -325,8 +325,16 @@ class Browser : public TabHandlerDelegate,
int tab_count() const;
int selected_index() const;
int GetIndexOfController(const NavigationController* controller) const;
- TabContents* GetTabContentsAt(int index) const;
+ TabContentsWrapper* GetSelectedTabContentsWrapper() const;
+ TabContentsWrapper* GetTabContentsWrapperAt(int index) const;
+ // Same as above but correctly handles if GetSelectedTabContents() is NULL
+ // in the model before dereferencing to get the raw TabContents.
+ // TODO(pinkerton): These should really be returning TabContentsWrapper
+ // objects, but that would require changing about 50+ other files. In order
+ // to keep changes localized, the default is to return a TabContents. Note
+ // this differs from the TabStripModel because it has far fewer clients.
TabContents* GetSelectedTabContents() const;
+ TabContents* GetTabContentsAt(int index) const;
void SelectTabContentsAt(int index, bool user_gesture);
void CloseAllTabs();
@@ -340,12 +348,14 @@ class Browser : public TabHandlerDelegate,
// Adds a selected tab with the specified URL and transition, returns the
// created TabContents.
- TabContents* AddSelectedTabWithURL(const GURL& url,
- PageTransition::Type transition);
+ TabContentsWrapper* AddSelectedTabWithURL(
+ const GURL& url,
+ PageTransition::Type transition);
// Add a new tab, given a TabContents. A TabContents appropriate to
// display the last committed entry is created and returned.
- TabContents* AddTab(TabContents* tab_contents, PageTransition::Type type);
+ TabContents* AddTab(TabContentsWrapper* tab_contents,
+ PageTransition::Type type);
// Add a tab with its session history restored from the SessionRestore
// system. If select is true, the tab is selected. |tab_index| gives the index
@@ -597,7 +607,7 @@ class Browser : public TabHandlerDelegate,
// Called by browser::Navigate() when a navigation has occurred in a tab in
// this Browser. Updates the UI for the start of this navigation.
- void UpdateUIForNavigationInTab(TabContents* contents,
+ void UpdateUIForNavigationInTab(TabContentsWrapper* contents,
PageTransition::Type transition,
bool user_initiated);
@@ -619,25 +629,34 @@ class Browser : public TabHandlerDelegate,
virtual void TabRestoreServiceChanged(TabRestoreService* service);
virtual void TabRestoreServiceDestroyed(TabRestoreService* service);
+ // Centralized method for creating a TabContents, configuring and installing
+ // all its supporting objects and observers.
+ static TabContentsWrapper*
+ TabContentsFactory(Profile* profile,
+ SiteInstance* site_instance,
+ int routing_id,
+ const TabContents* base_tab_contents,
+ SessionStorageNamespace* session_storage_namespace);
// Overridden from TabHandlerDelegate:
virtual Profile* GetProfile() const;
virtual Browser* AsBrowser();
// Overridden from TabStripModelDelegate:
- virtual TabContents* AddBlankTab(bool foreground);
- virtual TabContents* AddBlankTabAt(int index, bool foreground);
- virtual Browser* CreateNewStripWithContents(TabContents* detached_contents,
- const gfx::Rect& window_bounds,
- const DockInfo& dock_info,
- bool maximize);
- virtual void ContinueDraggingDetachedTab(TabContents* contents,
+ virtual TabContentsWrapper* AddBlankTab(bool foreground);
+ virtual TabContentsWrapper* AddBlankTabAt(int index, bool foreground);
+ virtual Browser* CreateNewStripWithContents(
+ TabContentsWrapper* detached_contents,
+ const gfx::Rect& window_bounds,
+ const DockInfo& dock_info,
+ bool maximize);
+ virtual void ContinueDraggingDetachedTab(TabContentsWrapper* contents,
const gfx::Rect& window_bounds,
const gfx::Rect& tab_bounds);
virtual int GetDragActions() const;
// Construct a TabContents for a given URL, profile and transition type.
// If instance is not null, its process will be used to render the tab.
- virtual TabContents* CreateTabContentsForURL(const GURL& url,
+ virtual TabContentsWrapper* CreateTabContentsForURL(const GURL& url,
const GURL& referrer,
Profile* profile,
PageTransition::Type transition,
@@ -646,8 +665,8 @@ class Browser : public TabHandlerDelegate,
virtual bool CanDuplicateContentsAt(int index);
virtual void DuplicateContentsAt(int index);
virtual void CloseFrameAfterDragSession();
- virtual void CreateHistoricalTab(TabContents* contents);
- virtual bool RunUnloadListenerBeforeClosing(TabContents* contents);
+ virtual void CreateHistoricalTab(TabContentsWrapper* contents);
+ virtual bool RunUnloadListenerBeforeClosing(TabContentsWrapper* contents);
virtual bool CanCloseContentsAt(int index);
virtual bool CanBookmarkAllTabs() const;
virtual void BookmarkAllTabs();
@@ -658,25 +677,25 @@ class Browser : public TabHandlerDelegate,
virtual bool LargeIconsPermitted() const;
// Overridden from TabStripModelObserver:
- virtual void TabInsertedAt(TabContents* contents,
+ virtual void TabInsertedAt(TabContentsWrapper* contents,
int index,
bool foreground);
virtual void TabClosingAt(TabStripModel* tab_strip_model,
- TabContents* contents,
+ TabContentsWrapper* contents,
int index);
- virtual void TabDetachedAt(TabContents* contents, int index);
- virtual void TabDeselectedAt(TabContents* contents, int index);
- virtual void TabSelectedAt(TabContents* old_contents,
- TabContents* new_contents,
+ virtual void TabDetachedAt(TabContentsWrapper* contents, int index);
+ virtual void TabDeselectedAt(TabContentsWrapper* contents, int index);
+ virtual void TabSelectedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int index,
bool user_gesture);
- virtual void TabMoved(TabContents* contents,
+ virtual void TabMoved(TabContentsWrapper* contents,
int from_index,
int to_index);
- virtual void TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents,
+ virtual void TabReplacedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int index);
- virtual void TabPinnedStateChanged(TabContents* contents, int index);
+ virtual void TabPinnedStateChanged(TabContentsWrapper* contents, int index);
virtual void TabStripEmpty();
private:
@@ -774,9 +793,9 @@ class Browser : public TabHandlerDelegate,
// Overriden from InstantDelegate:
virtual void PrepareForInstant();
- virtual void ShowInstant(TabContents* preview_contents);
+ virtual void ShowInstant(TabContentsWrapper* preview_contents);
virtual void HideInstant();
- virtual void CommitInstant(TabContents* preview_contents);
+ virtual void CommitInstant(TabContentsWrapper* preview_contents);
virtual void SetSuggestedText(const string16& text);
virtual gfx::Rect GetInstantBounds();
@@ -906,7 +925,8 @@ class Browser : public TabHandlerDelegate,
// after a return to the message loop.
void CloseFrame();
- void TabDetachedAtImpl(TabContents* contents, int index, DetachType type);
+ void TabDetachedAtImpl(TabContentsWrapper* contents,
+ int index, DetachType type);
// Create a preference dictionary for the provided application name. This is
// done only once per application name / per session.
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 84c85ff..9085033 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -48,6 +48,7 @@
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/tabs/pinned_tab_codec.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/ui/browser_navigator.h"
@@ -777,8 +778,8 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser(
browser::Navigate(&params);
if (profile_ && first_tab && process_startup) {
- AddCrashedInfoBarIfNecessary(params.target_contents);
- AddBadFlagsInfoBarIfNecessary(params.target_contents);
+ AddCrashedInfoBarIfNecessary(params.target_contents->tab_contents());
+ AddBadFlagsInfoBarIfNecessary(params.target_contents->tab_contents());
}
first_tab = false;
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index 7143bdf..cde98d9 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/status_bubble.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
@@ -82,16 +83,18 @@ int GetIndexOfSingletonTab(browser::NavigateParams* params) {
&reverse_on_redirect);
for (int i = 0; i < params->browser->tab_count(); ++i) {
- TabContents* tab = params->browser->GetTabContentsAt(i);
+ TabContentsWrapper* tab =
+ params->browser->GetTabContentsWrapperAt(i);
url_canon::Replacements<char> replacements;
replacements.ClearRef();
if (params->ignore_path)
replacements.ClearPath();
- if (CompareURLsWithReplacements(tab->GetURL(), params->url, replacements) ||
- CompareURLsWithReplacements(tab->GetURL(), rewritten_url,
- replacements)) {
+ if (CompareURLsWithReplacements(tab->tab_contents()->GetURL(),
+ params->url, replacements) ||
+ CompareURLsWithReplacements(tab->tab_contents()->GetURL(),
+ rewritten_url, replacements)) {
params->target_contents = tab;
return i;
}
@@ -130,7 +133,8 @@ Browser* GetBrowserForDisposition(browser::NavigateParams* params) {
// target browser. This must happen first, before GetBrowserForDisposition()
// has a chance to replace |params->browser| with another one.
if (!params->source_contents && params->browser)
- params->source_contents = params->browser->GetSelectedTabContents();
+ params->source_contents =
+ params->browser->GetSelectedTabContentsWrapper();
Profile* profile =
params->browser ? params->browser->profile() : params->profile;
@@ -158,7 +162,8 @@ Browser* GetBrowserForDisposition(browser::NavigateParams* params) {
// |source| represents an app.
Browser::Type type = Browser::TYPE_POPUP;
if ((params->browser && params->browser->type() == Browser::TYPE_APP) ||
- (params->source_contents && params->source_contents->is_app())) {
+ (params->source_contents &&
+ params->source_contents->is_app())) {
type = Browser::TYPE_APP_POPUP;
}
if (profile) {
@@ -272,13 +277,13 @@ class ScopedTargetContentsOwner {
}
// Relinquishes ownership of |params_|' target_contents.
- TabContents* ReleaseOwnership() {
+ TabContentsWrapper* ReleaseOwnership() {
return target_contents_owner_.release();
}
private:
browser::NavigateParams* params_;
- scoped_ptr<TabContents> target_contents_owner_;
+ scoped_ptr<TabContentsWrapper> target_contents_owner_;
DISALLOW_COPY_AND_ASSIGN(ScopedTargetContentsOwner);
};
@@ -303,7 +308,7 @@ NavigateParams::NavigateParams(
}
NavigateParams::NavigateParams(Browser* a_browser,
- TabContents* a_target_contents)
+ TabContentsWrapper* a_target_contents)
: target_contents(a_target_contents),
source_contents(NULL),
disposition(CURRENT_TAB),
@@ -354,12 +359,15 @@ void Navigate(NavigateParams* params) {
// supposed to target a new tab.
if (!params->target_contents) {
if (params->disposition != CURRENT_TAB) {
+ TabContents* source_contents = params->source_contents ?
+ params->source_contents->tab_contents() : NULL;
params->target_contents =
- new TabContents(params->browser->profile(),
- GetSiteInstance(params->source_contents, params->url),
- MSG_ROUTING_NONE,
- params->source_contents,
- NULL);
+ Browser::TabContentsFactory(
+ params->browser->profile(),
+ GetSiteInstance(source_contents, params->url),
+ MSG_ROUTING_NONE,
+ source_contents,
+ NULL);
// This function takes ownership of |params->target_contents| until it
// is added to a TabStripModel.
target_contents_owner.TakeOwnership();
@@ -370,7 +378,7 @@ void Navigate(NavigateParams* params) {
// in the background, tell it that it's hidden.
if ((params->tabstrip_add_types & TabStripModel::ADD_SELECTED) == 0) {
// TabStripModel::AddTabContents invokes HideContents if not foreground.
- params->target_contents->WasHidden();
+ params->target_contents->tab_contents()->WasHidden();
}
} else {
// ... otherwise if we're loading in the current tab, the target is the
@@ -381,7 +389,7 @@ void Navigate(NavigateParams* params) {
if (user_initiated) {
RenderViewHostDelegate::BrowserIntegration* integration =
- params->target_contents;
+ params->target_contents->tab_contents();
integration->OnUserGesture();
}
@@ -397,10 +405,11 @@ void Navigate(NavigateParams* params) {
}
if (params->source_contents == params->target_contents) {
- // The navigation occurred in the source tab, so update the UI.
- params->browser->UpdateUIForNavigationInTab(params->target_contents,
- params->transition,
- user_initiated);
+ // The navigation occurred in the source tab.
+ params->browser->UpdateUIForNavigationInTab(
+ params->target_contents,
+ params->transition,
+ user_initiated);
} else {
// The navigation occurred in some other tab.
int singleton_index = GetIndexOfSingletonTab(params);
diff --git a/chrome/browser/ui/browser_navigator.h b/chrome/browser/ui/browser_navigator.h
index 67bebbd..bdc8d8c 100644
--- a/chrome/browser/ui/browser_navigator.h
+++ b/chrome/browser/ui/browser_navigator.h
@@ -15,7 +15,7 @@
class Browser;
class Profile;
-class TabContents;
+class TabContentsWrapper;
namespace browser {
@@ -44,7 +44,7 @@ struct NavigateParams {
NavigateParams(Browser* browser,
const GURL& a_url,
PageTransition::Type a_transition);
- NavigateParams(Browser* browser, TabContents* a_target_contents);
+ NavigateParams(Browser* browser, TabContentsWrapper* a_target_contents);
~NavigateParams();
// The URL/referrer to be loaded. Ignored if |target_contents| is non-NULL.
@@ -63,13 +63,13 @@ struct NavigateParams {
// a new TabContents, this field will remain NULL and the TabContents
// deleted if the TabContents it created is not added to a TabStripModel
// before Navigate() returns.
- TabContents* target_contents;
+ TabContentsWrapper* target_contents;
// [in] The TabContents that initiated the Navigate() request if such context
// is necessary. Default is NULL, i.e. no context.
// [out] If NULL, this value will be set to the selected TabContents in the
// originating browser prior to the operation performed by Navigate().
- TabContents* source_contents;
+ TabContentsWrapper* source_contents;
// The disposition requested by the navigation source. Default is
// CURRENT_TAB. What follows is a set of coercions that happen to this value
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index 7bad301..dc9d661 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
@@ -40,12 +41,13 @@ class BrowserNavigatorTest : public InProcessBrowserTest {
return browser;
}
- TabContents* CreateTabContents() {
- return new TabContents(browser()->profile(),
- NULL,
- MSG_ROUTING_NONE,
- browser()->GetSelectedTabContents(),
- NULL);
+ TabContentsWrapper* CreateTabContents() {
+ return Browser::TabContentsFactory(
+ browser()->profile(),
+ NULL,
+ MSG_ROUTING_NONE,
+ browser()->GetSelectedTabContents(),
+ NULL);
}
void RunSuppressTest(WindowOpenDisposition disposition) {
@@ -131,7 +133,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) {
p.disposition = NEW_FOREGROUND_TAB;
browser::Navigate(&p);
EXPECT_NE(old_contents, browser()->GetSelectedTabContents());
- EXPECT_EQ(browser()->GetSelectedTabContents(), p.target_contents);
+ EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents);
EXPECT_EQ(2, browser()->tab_count());
}
@@ -347,7 +349,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) {
// Navigate() should have opened the contents in a new foreground in the
// current Browser.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(browser()->GetSelectedTabContents(), p.target_contents);
+ EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents);
// We should have one window, with two tabs.
EXPECT_EQ(1u, BrowserList::size());
@@ -382,7 +384,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_Popup) {
// All platforms should respect size however provided width > 400 (Mac has a
// minimum window width of 400).
EXPECT_EQ(p.window_bounds.size(),
- p.target_contents->view()->GetContainerSize());
+ p.target_contents->tab_contents()->view()->GetContainerSize());
// We should have two windows, the new popup and the browser() provided by the
// framework.
@@ -407,7 +409,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) {
// Navigate() should have inserted a new tab at slot 0 in the tabstrip.
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(0, browser()->tabstrip_model()->GetIndexOfTabContents(
- static_cast<const TabContents*>(p.target_contents)));
+ static_cast<const TabContentsWrapper*>(p.target_contents)));
// We should have one window - the browser() provided by the framework.
EXPECT_EQ(1u, BrowserList::size());
@@ -428,7 +430,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_NewForegroundTab) {
// Navigate() should have found browser() and create a new tab.
EXPECT_EQ(browser(), p.browser);
EXPECT_NE(old_contents, browser()->GetSelectedTabContents());
- EXPECT_EQ(browser()->GetSelectedTabContents(), p.target_contents);
+ EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents);
EXPECT_EQ(2, browser()->tab_count());
}
@@ -447,7 +449,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_MatchProfile) {
// Navigate() should have found incognito, not browser().
EXPECT_EQ(incognito, p.browser);
- EXPECT_EQ(incognito->GetSelectedTabContents(), p.target_contents);
+ EXPECT_EQ(incognito->GetSelectedTabContentsWrapper(), p.target_contents);
EXPECT_EQ(1, incognito->tab_count());
}
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h
index 31c1d560..acff556 100644
--- a/chrome/browser/ui/browser_window.h
+++ b/chrome/browser/ui/browser_window.h
@@ -20,6 +20,7 @@ class LocationBar;
class Profile;
class StatusBubble;
class TabContents;
+class TabContentsWrapper;
class TemplateURL;
class TemplateURLModel;
#if !defined(OS_MACOSX)
@@ -139,7 +140,7 @@ class BrowserWindow {
virtual void UpdateReloadStopState(bool is_loading, bool force) = 0;
// Updates the toolbar with the state for the specified |contents|.
- virtual void UpdateToolbar(TabContents* contents,
+ virtual void UpdateToolbar(TabContentsWrapper* contents,
bool should_restore_state) = 0;
// Focuses the toolbar (for accessibility).
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 8675cfe..4552de4 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -37,6 +37,7 @@
#include "chrome/browser/sidebar/sidebar_manager.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/themes/browser_theme_provider.h"
#include "chrome/browser/ui/browser.h"
@@ -670,6 +671,10 @@ TabContents* BrowserView::GetSelectedTabContents() const {
return browser_->GetSelectedTabContents();
}
+TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const {
+ return browser_->GetSelectedTabContentsWrapper();
+}
+
SkBitmap BrowserView::GetOTRAvatarIcon() {
static SkBitmap* otr_avatar_ = new SkBitmap();
@@ -774,10 +779,10 @@ StatusBubble* BrowserView::GetStatusBubble() {
void BrowserView::SelectedTabToolbarSizeChanged(bool is_animating) {
if (is_animating) {
contents_container_->SetFastResize(true);
- UpdateUIForContents(browser_->GetSelectedTabContents());
+ UpdateUIForContents(browser_->GetSelectedTabContentsWrapper());
contents_container_->SetFastResize(false);
} else {
- UpdateUIForContents(browser_->GetSelectedTabContents());
+ UpdateUIForContents(browser_->GetSelectedTabContentsWrapper());
// When transitioning from animating to not animating we need to make sure
// the contents_container_ gets layed out. If we don't do this and the
// bounds haven't changed contents_container_ won't get a Layout out and
@@ -798,7 +803,7 @@ void BrowserView::ShelfVisibilityChanged() {
}
void BrowserView::UpdateDevTools() {
- UpdateDevToolsForContents(GetSelectedTabContents());
+ UpdateDevToolsForContents(GetSelectedTabContentsWrapper());
Layout();
}
@@ -885,9 +890,9 @@ void BrowserView::UpdateReloadStopState(bool is_loading, bool force) {
is_loading ? ReloadButton::MODE_STOP : ReloadButton::MODE_RELOAD, force);
}
-void BrowserView::UpdateToolbar(TabContents* contents,
+void BrowserView::UpdateToolbar(TabContentsWrapper* contents,
bool should_restore_state) {
- toolbar_->Update(contents, should_restore_state);
+ toolbar_->Update(contents->tab_contents(), should_restore_state);
}
void BrowserView::FocusToolbar() {
@@ -1422,7 +1427,7 @@ void BrowserView::Observe(NotificationType type,
switch (type.value) {
case NotificationType::PREF_CHANGED:
if (*Details<std::string>(details).ptr() == prefs::kShowBookmarkBar &&
- MaybeShowBookmarkBar(browser_->GetSelectedTabContents())) {
+ MaybeShowBookmarkBar(browser_->GetSelectedTabContentsWrapper())) {
Layout();
}
break;
@@ -1443,7 +1448,7 @@ void BrowserView::Observe(NotificationType type,
///////////////////////////////////////////////////////////////////////////////
// BrowserView, TabStripModelObserver implementation:
-void BrowserView::TabDetachedAt(TabContents* contents, int index) {
+void BrowserView::TabDetachedAt(TabContentsWrapper* contents, int index) {
// We use index here rather than comparing |contents| because by this time
// the model has already removed |contents| from its list, so
// browser_->GetSelectedTabContents() will return NULL or something else.
@@ -1458,16 +1463,16 @@ void BrowserView::TabDetachedAt(TabContents* contents, int index) {
}
}
-void BrowserView::TabDeselectedAt(TabContents* contents, int index) {
+void BrowserView::TabDeselectedAt(TabContentsWrapper* contents, int index) {
// We do not store the focus when closing the tab to work-around bug 4633.
// Some reports seem to show that the focus manager and/or focused view can
// be garbage at that point, it is not clear why.
- if (!contents->is_being_destroyed())
+ if (!contents->tab_contents()->is_being_destroyed())
contents->view()->StoreFocus();
}
-void BrowserView::TabSelectedAt(TabContents* old_contents,
- TabContents* new_contents,
+void BrowserView::TabSelectedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int index,
bool user_gesture) {
DCHECK(old_contents != new_contents);
@@ -1475,8 +1480,8 @@ void BrowserView::TabSelectedAt(TabContents* old_contents,
ProcessTabSelected(new_contents, true);
}
-void BrowserView::TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents,
+void BrowserView::TabReplacedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int index) {
if (index != browser_->tabstrip_model()->selected_index())
return;
@@ -2014,7 +2019,7 @@ void BrowserView::LayoutStatusBubble() {
status_bubble_->SetBounds(origin.x(), origin.y(), width() / 3, height);
}
-bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) {
+bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) {
views::View* new_bookmark_bar_view = NULL;
if (browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)
&& contents) {
@@ -2028,7 +2033,7 @@ bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) {
} else {
bookmark_bar_view_->SetProfile(contents->profile());
}
- bookmark_bar_view_->SetPageNavigator(contents);
+ bookmark_bar_view_->SetPageNavigator(contents->tab_contents());
bookmark_bar_view_->
SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_BOOKMARKS));
new_bookmark_bar_view = bookmark_bar_view_.get();
@@ -2036,7 +2041,7 @@ bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) {
return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_);
}
-bool BrowserView::MaybeShowInfoBar(TabContents* contents) {
+bool BrowserView::MaybeShowInfoBar(TabContentsWrapper* contents) {
// TODO(beng): Remove this function once the interface between
// InfoBarContainer, DownloadShelfView and TabContents and this
// view is sorted out.
@@ -2044,11 +2049,11 @@ bool BrowserView::MaybeShowInfoBar(TabContents* contents) {
}
void BrowserView::UpdateSidebar() {
- UpdateSidebarForContents(GetSelectedTabContents());
+ UpdateSidebarForContents(GetSelectedTabContentsWrapper());
Layout();
}
-void BrowserView::UpdateSidebarForContents(TabContents* tab_contents) {
+void BrowserView::UpdateSidebarForContents(TabContentsWrapper* tab_contents) {
if (!sidebar_container_)
return; // Happens when sidebar is not allowed.
if (!SidebarManager::GetInstance())
@@ -2057,7 +2062,7 @@ void BrowserView::UpdateSidebarForContents(TabContents* tab_contents) {
TabContents* sidebar_contents = NULL;
if (tab_contents) {
SidebarContainer* client_host = SidebarManager::GetInstance()->
- GetActiveSidebarContainerFor(tab_contents);
+ GetActiveSidebarContainerFor(tab_contents->tab_contents());
if (client_host)
sidebar_contents = client_host->sidebar_contents();
}
@@ -2104,7 +2109,8 @@ void BrowserView::UpdateSidebarForContents(TabContents* tab_contents) {
}
}
-void BrowserView::UpdateDevToolsForContents(TabContents* tab_contents) {
+void BrowserView::UpdateDevToolsForContents(TabContentsWrapper* wrapper) {
+ TabContents* tab_contents = wrapper ? wrapper->tab_contents() : NULL;
TabContents* devtools_contents =
DevToolsWindow::GetDevToolsContents(tab_contents);
@@ -2150,7 +2156,7 @@ void BrowserView::UpdateDevToolsForContents(TabContents* tab_contents) {
}
}
-void BrowserView::UpdateUIForContents(TabContents* contents) {
+void BrowserView::UpdateUIForContents(TabContentsWrapper* contents) {
bool needs_layout = MaybeShowBookmarkBar(contents);
needs_layout |= MaybeShowInfoBar(contents);
if (needs_layout)
@@ -2460,7 +2466,7 @@ void BrowserView::InitHangMonitor() {
#endif
}
-void BrowserView::ProcessTabSelected(TabContents* new_contents,
+void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents,
bool change_tab_contents) {
// Update various elements that are interested in knowing the current
// TabContents.
@@ -2470,10 +2476,10 @@ void BrowserView::ProcessTabSelected(TabContents* new_contents,
// avoid an unnecessary resize and re-layout of a TabContents.
if (change_tab_contents)
contents_container_->ChangeTabContents(NULL);
- infobar_container_->ChangeTabContents(new_contents);
+ infobar_container_->ChangeTabContents(new_contents->tab_contents());
UpdateUIForContents(new_contents);
if (change_tab_contents)
- contents_container_->ChangeTabContents(new_contents);
+ contents_container_->ChangeTabContents(new_contents->tab_contents());
UpdateSidebarForContents(new_contents);
UpdateDevToolsForContents(new_contents);
@@ -2481,7 +2487,7 @@ void BrowserView::ProcessTabSelected(TabContents* new_contents,
// am striving for parity now rather than cleanliness. This is
// required to make features like Duplicate Tab, Undo Close Tab,
// etc not result in sad tab.
- new_contents->DidBecomeSelected();
+ new_contents->tab_contents()->DidBecomeSelected();
if (BrowserList::GetLastActive() == browser_ &&
!browser_->tabstrip_model()->closing_all() && GetWindow()->IsVisible()) {
// We only restore focus if our window is visible, to avoid invoking blur
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index 7d25a79..628620c 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -183,13 +183,14 @@ class BrowserView : public BrowserBubbleHost,
// activated, false if none was shown.
bool ActivateAppModalDialog() const;
- // Returns the selected TabContents. Used by our NonClientView's
+ // Returns the selected TabContents[Wrapper]. Used by our NonClientView's
// TabIconView::TabContentsProvider implementations.
// TODO(beng): exposing this here is a bit bogus, since it's only used to
// determine loading state. It'd be nicer if we could change this to be
// bool IsSelectedTabLoading() const; or something like that. We could even
// move it to a WindowDelegate subclass.
TabContents* GetSelectedTabContents() const;
+ TabContentsWrapper* GetSelectedTabContentsWrapper() const;
// Retrieves the icon to use in the frame to indicate an OTR window.
SkBitmap GetOTRAvatarIcon();
@@ -263,7 +264,8 @@ class BrowserView : public BrowserBubbleHost,
virtual LocationBar* GetLocationBar() const;
virtual void SetFocusToLocationBar(bool select_all);
virtual void UpdateReloadStopState(bool is_loading, bool force);
- virtual void UpdateToolbar(TabContents* contents, bool should_restore_state);
+ virtual void UpdateToolbar(TabContentsWrapper* contents,
+ bool should_restore_state);
virtual void FocusToolbar();
virtual void FocusAppMenu();
virtual void FocusBookmarksToolbar();
@@ -337,14 +339,14 @@ class BrowserView : public BrowserBubbleHost,
const NotificationDetails& details);
// Overridden from TabStripModelObserver:
- virtual void TabDetachedAt(TabContents* contents, int index);
- virtual void TabDeselectedAt(TabContents* contents, int index);
- virtual void TabSelectedAt(TabContents* old_contents,
- TabContents* new_contents,
+ virtual void TabDetachedAt(TabContentsWrapper* contents, int index);
+ virtual void TabDeselectedAt(TabContentsWrapper* contents, int index);
+ virtual void TabSelectedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int index,
bool user_gesture);
- virtual void TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents,
+ virtual void TabReplacedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int index);
virtual void TabStripEmpty();
@@ -442,28 +444,28 @@ class BrowserView : public BrowserBubbleHost,
// true if the Bookmark Bar can be shown (i.e. it's supported for this
// Browser type) and there should be a subsequent re-layout to show it.
// |contents| can be NULL.
- bool MaybeShowBookmarkBar(TabContents* contents);
+ bool MaybeShowBookmarkBar(TabContentsWrapper* contents);
// Prepare to show an Info Bar for the specified TabContents. Returns true
// if there is an Info Bar to show and one is supported for this Browser
// type, and there should be a subsequent re-layout to show it.
// |contents| can be NULL.
- bool MaybeShowInfoBar(TabContents* contents);
+ bool MaybeShowInfoBar(TabContentsWrapper* contents);
// Updates sidebar UI according to the current tab and sidebar state.
void UpdateSidebar();
// Displays active sidebar linked to the |tab_contents| or hides sidebar UI,
// if there's no such sidebar.
- void UpdateSidebarForContents(TabContents* tab_contents);
+ void UpdateSidebarForContents(TabContentsWrapper* tab_contents);
// Updated devtools window for given contents.
- void UpdateDevToolsForContents(TabContents* tab_contents);
+ void UpdateDevToolsForContents(TabContentsWrapper* tab_contents);
// Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
// Download Shelf in response to a change notification from the specified
// |contents|. |contents| can be NULL. In this case, all optional UI will be
// removed.
- void UpdateUIForContents(TabContents* contents);
+ void UpdateUIForContents(TabContentsWrapper* contents);
// Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download
// Shelf. If |*old_view| differs from new_view, the old_view is removed and
@@ -502,7 +504,8 @@ class BrowserView : public BrowserBubbleHost,
// |change_tab_contents| is true, |new_contents| is added to the view
// hierarchy, if |change_tab_contents| is false, it's assumed |new_contents|
// has already been added to the view hierarchy.
- void ProcessTabSelected(TabContents* new_contents, bool change_tab_contents);
+ void ProcessTabSelected(TabContentsWrapper* new_contents,
+ bool change_tab_contents);
// Last focused view that issued a tab traversal.
int last_focused_view_storage_id_;
diff --git a/chrome/browser/ui/views/location_bar/click_handler.cc b/chrome/browser/ui/views/location_bar/click_handler.cc
index e9c414c..92b2bb7 100644
--- a/chrome/browser/ui/views/location_bar/click_handler.cc
+++ b/chrome/browser/ui/views/location_bar/click_handler.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/views/location_bar/location_bar_view.h"
#include "views/view.h"
@@ -25,7 +26,7 @@ void ClickHandler::OnMouseReleased(const views::MouseEvent& event,
if (location_bar_->location_entry()->IsEditingOrEmpty())
return;
- TabContents* tab = location_bar_->GetTabContents();
+ TabContents* tab = location_bar_->GetTabContentsWrapper()->tab_contents();
NavigationEntry* nav_entry = tab->controller().GetActiveEntry();
if (!nav_entry) {
NOTREACHED();
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
index 2d5af65..2ddb4b0 100644
--- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/content_setting_bubble_model.h"
#include "chrome/browser/content_setting_image_model.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/views/content_setting_bubble_contents.h"
#include "chrome/browser/views/location_bar/location_bar_view.h"
@@ -56,7 +57,7 @@ void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event,
if (canceled || !HitTest(event.location()))
return;
- TabContents* tab_contents = parent_->GetTabContents();
+ TabContents* tab_contents = parent_->GetTabContentsWrapper()->tab_contents();
if (!tab_contents)
return;
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 d7a8920..59c191d 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/ui/views/location_bar/suggested_text_view.h"
#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/browser_dialogs.h"
@@ -50,6 +51,13 @@
using views::View;
+namespace {
+TabContents* GetTabContentsFromDelegate(LocationBarView::Delegate* delegate) {
+ const TabContentsWrapper* wrapper = delegate->GetTabContentsWrapper();
+ return wrapper ? wrapper->tab_contents() : NULL;
+}
+} // namespace
+
// static
const int LocationBarView::kNormalHorizontalEdgeThickness = 1;
const int LocationBarView::kVerticalEdgeThickness = 2;
@@ -335,8 +343,8 @@ void LocationBarView::SetProfile(Profile* profile) {
}
}
-TabContents* LocationBarView::GetTabContents() const {
- return delegate_->GetTabContents();
+TabContentsWrapper* LocationBarView::GetTabContentsWrapper() const {
+ return delegate_->GetTabContentsWrapper();
}
void LocationBarView::SetPreviewEnabledPageAction(ExtensionAction* page_action,
@@ -345,7 +353,7 @@ void LocationBarView::SetPreviewEnabledPageAction(ExtensionAction* page_action,
return;
DCHECK(page_action);
- TabContents* contents = delegate_->GetTabContents();
+ TabContents* contents = GetTabContentsFromDelegate(delegate_);
RefreshPageActionViews();
PageActionWithBadgeView* page_action_view =
@@ -839,10 +847,10 @@ void LocationBarView::OnChanged() {
InstantController* instant = delegate_->GetInstant();
string16 suggested_text;
- if (update_instant_ && instant && GetTabContents()) {
+ if (update_instant_ && instant && GetTabContentsWrapper()) {
if (location_entry_->model()->user_input_in_progress() &&
location_entry_->model()->popup_model()->IsOpen()) {
- instant->Update(GetTabContents(),
+ instant->Update(GetTabContentsWrapper(),
location_entry_->model()->CurrentMatch(),
WideToUTF16(location_entry_->GetText()),
&suggested_text);
@@ -876,15 +884,11 @@ void LocationBarView::OnSetFocus() {
}
SkBitmap LocationBarView::GetFavIcon() const {
- DCHECK(delegate_);
- DCHECK(delegate_->GetTabContents());
- return delegate_->GetTabContents()->GetFavIcon();
+ return GetTabContentsFromDelegate(delegate_)->GetFavIcon();
}
std::wstring LocationBarView::GetTitle() const {
- DCHECK(delegate_);
- DCHECK(delegate_->GetTabContents());
- return UTF16ToWideHack(delegate_->GetTabContents()->GetTitle());
+ return UTF16ToWideHack(GetTabContentsFromDelegate(delegate_)->GetTitle());
}
int LocationBarView::AvailableWidth(int location_bar_width) {
@@ -911,11 +915,10 @@ void LocationBarView::LayoutView(views::View* view,
}
void LocationBarView::RefreshContentSettingViews() {
- const TabContents* tab_contents = delegate_->GetTabContents();
for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
i != content_setting_views_.end(); ++i) {
(*i)->UpdateFromTabContents(
- model_->input_in_progress() ? NULL : tab_contents);
+ model_->input_in_progress() ? NULL : GetTabContentsFromDelegate(delegate_));
}
}
@@ -964,7 +967,7 @@ void LocationBarView::RefreshPageActionViews() {
}
}
- TabContents* contents = delegate_->GetTabContents();
+ TabContents* contents = GetTabContentsFromDelegate(delegate_);
if (!page_action_views_.empty() && contents) {
GURL url = GURL(WideToUTF8(model_->GetText()));
@@ -1067,7 +1070,7 @@ void LocationBarView::WriteDragData(views::View* sender,
OSExchangeData* data) {
DCHECK(GetDragOperations(sender, press_pt) != DragDropTypes::DRAG_NONE);
- TabContents* tab_contents = delegate_->GetTabContents();
+ TabContents* tab_contents = GetTabContentsFromDelegate(delegate_);
DCHECK(tab_contents);
drag_utils::SetURLAndDragImage(tab_contents->GetURL(),
UTF16ToWideHack(tab_contents->GetTitle()),
@@ -1077,7 +1080,7 @@ void LocationBarView::WriteDragData(views::View* sender,
int LocationBarView::GetDragOperations(views::View* sender,
const gfx::Point& p) {
DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_));
- TabContents* tab_contents = delegate_->GetTabContents();
+ TabContents* tab_contents = GetTabContentsFromDelegate(delegate_);
return (tab_contents && tab_contents->GetURL().is_valid() &&
!location_entry()->IsEditingOrEmpty()) ?
(DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK) :
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index 563d0f9..7f0f0a8 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -44,6 +44,7 @@ class Profile;
class SelectedKeywordView;
class StarView;
class SuggestedTextView;
+class TabContentsWrapper;
class TemplateURLModel;
namespace views {
@@ -72,7 +73,7 @@ class LocationBarView : public LocationBar,
class Delegate {
public:
// Should return the current tab contents.
- virtual TabContents* GetTabContents() = 0;
+ virtual TabContentsWrapper* GetTabContentsWrapper() = 0;
// Returns the InstantController, or NULL if there isn't one.
virtual InstantController* GetInstant() = 0;
@@ -129,8 +130,8 @@ class LocationBarView : public LocationBar,
void SetProfile(Profile* profile);
Profile* profile() const { return profile_; }
- // Returns the current TabContents.
- TabContents* GetTabContents() const;
+ // Returns the current TabContentsWrapper.
+ TabContentsWrapper* GetTabContentsWrapper() const;
// Sets |preview_enabled| for the PageAction View associated with this
// |page_action|. If |preview_enabled| is true, the view will display the
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index d77ff6f..0ecfacf 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/tab_menu_model.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/ui/browser.h"
@@ -199,7 +200,7 @@ bool BrowserTabStripController::IsTabCloseable(int model_index) const {
bool BrowserTabStripController::IsNewTabPage(int model_index) const {
return model_->ContainsIndex(model_index) &&
- model_->GetTabContentsAt(model_index)->GetURL() ==
+ model_->GetTabContentsAt(model_index)->tab_contents()->GetURL() ==
GURL(chrome::kChromeUINewTabURL);
}
@@ -229,8 +230,9 @@ void BrowserTabStripController::UpdateLoadingAnimations() {
BaseTab* tab = tabstrip_->base_tab_at_tab_index(tab_index);
int model_index = tabstrip_->GetModelIndexOfBaseTab(tab);
if (model_->ContainsIndex(model_index)) {
- TabContents* contents = model_->GetTabContentsAt(model_index);
- tab->UpdateLoadingAnimation(TabContentsNetworkState(contents));
+ TabContentsWrapper* contents = model_->GetTabContentsAt(model_index);
+ tab->UpdateLoadingAnimation(
+ TabContentsNetworkState(contents->tab_contents()));
}
}
}
@@ -247,7 +249,7 @@ void BrowserTabStripController::PerformDrop(bool drop_before,
model_->profile());
// Insert a new tab.
- TabContents* contents = model_->delegate()->CreateTabContentsForURL(
+ TabContentsWrapper* contents = model_->delegate()->CreateTabContentsForURL(
url, GURL(), model_->profile(), PageTransition::TYPED, false, NULL);
model_->AddTabContents(contents, index, PageTransition::GENERATED,
TabStripModel::ADD_SELECTED);
@@ -277,7 +279,7 @@ void BrowserTabStripController::CreateNewTab() {
////////////////////////////////////////////////////////////////////////////////
// BrowserTabStripController, TabStripModelObserver implementation:
-void BrowserTabStripController::TabInsertedAt(TabContents* contents,
+void BrowserTabStripController::TabInsertedAt(TabContentsWrapper* contents,
int model_index,
bool foreground) {
DCHECK(contents);
@@ -289,35 +291,35 @@ void BrowserTabStripController::TabInsertedAt(TabContents* contents,
contents->controller().window_id().id());
TabRendererData data;
- SetTabRendererDataFromModel(contents, model_index, &data);
+ SetTabRendererDataFromModel(contents->tab_contents(), model_index, &data);
tabstrip_->AddTabAt(model_index, foreground, data);
}
-void BrowserTabStripController::TabDetachedAt(TabContents* contents,
+void BrowserTabStripController::TabDetachedAt(TabContentsWrapper* contents,
int model_index) {
tabstrip_->RemoveTabAt(model_index);
}
-void BrowserTabStripController::TabSelectedAt(TabContents* old_contents,
- TabContents* contents,
+void BrowserTabStripController::TabSelectedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* contents,
int model_index,
bool user_gesture) {
tabstrip_->SelectTabAt(model_->GetIndexOfTabContents(old_contents),
model_index);
}
-void BrowserTabStripController::TabMoved(TabContents* contents,
+void BrowserTabStripController::TabMoved(TabContentsWrapper* contents,
int from_model_index,
int to_model_index) {
// Update the data first as the pinned state may have changed.
TabRendererData data;
- SetTabRendererDataFromModel(contents, to_model_index, &data);
+ SetTabRendererDataFromModel(contents->tab_contents(), to_model_index, &data);
tabstrip_->SetTabData(from_model_index, data);
tabstrip_->MoveTab(from_model_index, to_model_index);
}
-void BrowserTabStripController::TabChangedAt(TabContents* contents,
+void BrowserTabStripController::TabChangedAt(TabContentsWrapper* contents,
int model_index,
TabChangeType change_type) {
if (change_type == TITLE_NOT_LOADING) {
@@ -329,32 +331,35 @@ void BrowserTabStripController::TabChangedAt(TabContents* contents,
SetTabDataAt(contents, model_index);
}
-void BrowserTabStripController::TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents,
+void BrowserTabStripController::TabReplacedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int model_index) {
SetTabDataAt(new_contents, model_index);
}
-void BrowserTabStripController::TabPinnedStateChanged(TabContents* contents,
- int model_index) {
+void BrowserTabStripController::TabPinnedStateChanged(
+ TabContentsWrapper* contents,
+ int model_index) {
// Currently none of the renderers render pinned state differently.
}
void BrowserTabStripController::TabMiniStateChanged(
- TabContents* contents,
+ TabContentsWrapper* contents,
int model_index) {
SetTabDataAt(contents, model_index);
}
-void BrowserTabStripController::TabBlockedStateChanged(TabContents* contents,
- int model_index) {
+void BrowserTabStripController::TabBlockedStateChanged(
+ TabContentsWrapper* contents,
+ int model_index) {
SetTabDataAt(contents, model_index);
}
-void BrowserTabStripController::SetTabDataAt(TabContents* contents,
- int model_index) {
+void BrowserTabStripController::SetTabDataAt(
+ TabContentsWrapper* contents,
+ int model_index) {
TabRendererData data;
- SetTabRendererDataFromModel(contents, model_index, &data);
+ SetTabRendererDataFromModel(contents->tab_contents(), model_index, &data);
tabstrip_->SetTabData(model_index, data);
}
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
index 8cfb548..5fd7e11 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
@@ -19,7 +19,7 @@ class Browser;
struct TabRendererData;
// An implementation of TabStripController that sources data from the
-// TabContentses in a TabStripModel.
+// TabContentsWrappers in a TabStripModel.
class BrowserTabStripController : public TabStripController,
public TabStripModelObserver,
public NotificationObserver {
@@ -57,26 +57,29 @@ class BrowserTabStripController : public TabStripController,
virtual void CreateNewTab();
// TabStripModelObserver implementation:
- virtual void TabInsertedAt(TabContents* contents,
+ virtual void TabInsertedAt(TabContentsWrapper* contents,
int model_index,
bool foreground);
- virtual void TabDetachedAt(TabContents* contents, int model_index);
- virtual void TabSelectedAt(TabContents* old_contents,
- TabContents* contents,
+ virtual void TabDetachedAt(TabContentsWrapper* contents, int model_index);
+ virtual void TabSelectedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* contents,
int model_index,
bool user_gesture);
- virtual void TabMoved(TabContents* contents,
+ virtual void TabMoved(TabContentsWrapper* contents,
int from_model_index,
int to_model_index);
- virtual void TabChangedAt(TabContents* contents,
+ virtual void TabChangedAt(TabContentsWrapper* contents,
int model_index,
TabChangeType change_type);
- virtual void TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents,
+ virtual void TabReplacedAt(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
int model_index);
- virtual void TabPinnedStateChanged(TabContents* contents, int model_index);
- virtual void TabMiniStateChanged(TabContents* contents, int model_index);
- virtual void TabBlockedStateChanged(TabContents* contents, int model_index);
+ virtual void TabPinnedStateChanged(TabContentsWrapper* contents,
+ int model_index);
+ virtual void TabMiniStateChanged(TabContentsWrapper* contents,
+ int model_index);
+ virtual void TabBlockedStateChanged(TabContentsWrapper* contents,
+ int model_index);
// NotificationObserver implementation:
virtual void Observe(NotificationType type, const NotificationSource& source,
@@ -86,7 +89,7 @@ class BrowserTabStripController : public TabStripController,
class TabContextMenuContents;
// Invokes tabstrip_->SetTabData.
- void SetTabDataAt(TabContents* contents, int model_index);
+ void SetTabDataAt(TabContentsWrapper* contents, int model_index);
// Sets the TabRendererData from the TabStripModel.
void SetTabRendererDataFromModel(TabContents* contents,
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
index 8a3b173..691f99fa 100644
--- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
@@ -475,7 +475,8 @@ void DraggedTabController::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED);
- DCHECK(Source<TabContents>(source).ptr() == dragged_contents_);
+ DCHECK(Source<TabContents>(source).ptr() ==
+ dragged_contents_->tab_contents());
EndDragImpl(TAB_DESTROYED);
}
@@ -577,11 +578,12 @@ void DraggedTabController::UpdateDockInfo(const gfx::Point& screen_point) {
}
}
-void DraggedTabController::SetDraggedContents(TabContents* new_contents) {
+void DraggedTabController::SetDraggedContents(
+ TabContentsWrapper* new_contents) {
if (dragged_contents_) {
registrar_.Remove(this,
NotificationType::TAB_CONTENTS_DESTROYED,
- Source<TabContents>(dragged_contents_));
+ Source<TabContents>(dragged_contents_->tab_contents()));
if (original_delegate_)
dragged_contents_->set_delegate(original_delegate_);
}
@@ -590,7 +592,7 @@ void DraggedTabController::SetDraggedContents(TabContents* new_contents) {
if (dragged_contents_) {
registrar_.Add(this,
NotificationType::TAB_CONTENTS_DESTROYED,
- Source<TabContents>(dragged_contents_));
+ Source<TabContents>(dragged_contents_->tab_contents()));
// We need to be the delegate so we receive messages about stuff,
// otherwise our dragged_contents() may be replaced and subsequently
@@ -833,7 +835,7 @@ void DraggedTabController::Attach(BaseTabStrip* attached_tabstrip,
original_delegate_ = NULL;
// Return the TabContents' to normalcy.
- dragged_contents_->set_capturing_contents(false);
+ dragged_contents_->tab_contents()->set_capturing_contents(false);
// Inserting counts as a move. We don't want the tabs to jitter when the
// user moves the tab immediately after attaching it.
@@ -872,7 +874,7 @@ void DraggedTabController::Attach(BaseTabStrip* attached_tabstrip,
void DraggedTabController::Detach() {
// Prevent the TabContents' HWND from being hidden by any of the model
// operations performed during the drag.
- dragged_contents_->set_capturing_contents(true);
+ dragged_contents_->tab_contents()->set_capturing_contents(true);
// Update the Model.
TabRendererData tab_data = attached_tab_->data();
@@ -893,8 +895,8 @@ void DraggedTabController::Detach() {
// Set up the photo booth to start capturing the contents of the dragged
// TabContents.
if (!photobooth_.get()) {
- photobooth_.reset(
- NativeViewPhotobooth::Create(dragged_contents_->GetNativeView()));
+ photobooth_.reset(NativeViewPhotobooth::Create(
+ dragged_contents_->tab_contents()->GetNativeView()));
}
// Create the dragged view.
@@ -1228,7 +1230,7 @@ void DraggedTabController::CompleteDrag() {
void DraggedTabController::EnsureDraggedView(const TabRendererData& data) {
if (!view_.get()) {
gfx::Rect tab_bounds;
- dragged_contents_->GetContainerBounds(&tab_bounds);
+ dragged_contents_->tab_contents()->GetContainerBounds(&tab_bounds);
BaseTab* renderer = source_tabstrip_->CreateTabForDragging();
renderer->SetData(data);
// DraggedTabView takes ownership of renderer.
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.h b/chrome/browser/ui/views/tabs/dragged_tab_controller.h
index d0c4480..2d00ac6 100644
--- a/chrome/browser/ui/views/tabs/dragged_tab_controller.h
+++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.h
@@ -11,6 +11,7 @@
#include "base/timer.h"
#include "chrome/browser/dock_info.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "gfx/rect.h"
@@ -67,7 +68,7 @@ class DraggedTabController : public TabContentsDelegate,
// begun.
void EndDrag(bool canceled);
- TabContents* dragged_contents() { return dragged_contents_; }
+ TabContentsWrapper* dragged_contents() { return dragged_contents_; }
// Returns true if a drag started.
bool started_drag() const { return started_drag_; }
@@ -141,7 +142,7 @@ class DraggedTabController : public TabContentsDelegate,
void UpdateDockInfo(const gfx::Point& screen_point);
// Sets the TabContents being dragged with the specified |new_contents|.
- void SetDraggedContents(TabContents* new_contents);
+ void SetDraggedContents(TabContentsWrapper* new_contents);
// Saves focus in the window that the drag initiated from. Focus will be
// restored appropriately if the drag ends within this same window.
@@ -241,8 +242,8 @@ class DraggedTabController : public TabContentsDelegate,
// Handles registering for notifications.
NotificationRegistrar registrar_;
- // The TabContents being dragged.
- TabContents* dragged_contents_;
+ // The TabContentsWrapper being dragged.
+ TabContentsWrapper* dragged_contents_;
// The original TabContentsDelegate of |dragged_contents_|, before it was
// detached from the browser window. We store this so that we can forward
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index 71f1387..34261fe 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -327,8 +327,8 @@ cleanup:
////////////////////////////////////////////////////////////////////////////////
// ToolbarView, LocationBarView::Delegate implementation:
-TabContents* ToolbarView::GetTabContents() {
- return browser_->GetSelectedTabContents();
+TabContentsWrapper* ToolbarView::GetTabContentsWrapper() {
+ return browser_->GetSelectedTabContentsWrapper();
}
InstantController* ToolbarView::GetInstant() {
diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h
index ccae7fa2..bea00f3 100644
--- a/chrome/browser/ui/views/toolbar_view.h
+++ b/chrome/browser/ui/views/toolbar_view.h
@@ -96,7 +96,7 @@ class ToolbarView : public AccessiblePaneView,
virtual void RunMenu(views::View* source, const gfx::Point& pt);
// Overridden from LocationBarView::Delegate:
- virtual TabContents* GetTabContents();
+ virtual TabContentsWrapper* GetTabContentsWrapper();
virtual InstantController* GetInstant();
virtual void OnInputInProgress(bool in_progress);