summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autocomplete/autocomplete_browsertest.cc4
-rw-r--r--chrome/browser/autofill/autofill_cc_infobar_delegate.cc13
-rw-r--r--chrome/browser/autofill/autofill_cc_infobar_delegate.h4
-rw-r--r--chrome/browser/autofill/autofill_manager.h3
-rw-r--r--chrome/browser/automation/automation_provider.cc2
-rw-r--r--chrome/browser/browser.cc82
-rw-r--r--chrome/browser/browser.h23
-rw-r--r--chrome/browser/browser_browsertest.cc40
-rw-r--r--chrome/browser/browser_focus_uitest.cc13
-rw-r--r--chrome/browser/browser_init.cc4
-rw-r--r--chrome/browser/chromeos/dom_ui/internet_options_handler.cc8
-rw-r--r--chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc3
-rw-r--r--chrome/browser/cocoa/applescript/window_applescript.mm6
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm2
-rw-r--r--chrome/browser/cocoa/tab_strip_controller_unittest.mm2
-rw-r--r--chrome/browser/dom_ui/dom_ui.cc2
-rw-r--r--chrome/browser/dom_ui/dom_ui.h2
-rw-r--r--chrome/browser/dom_ui/filebrowse_ui.cc13
-rw-r--r--chrome/browser/dom_ui/history2_ui.cc8
-rw-r--r--chrome/browser/dom_ui/history_ui.cc8
-rw-r--r--chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc2
-rw-r--r--chrome/browser/dom_ui/mediaplayer_ui.cc6
-rw-r--r--chrome/browser/extensions/extension_dom_ui.cc9
-rw-r--r--chrome/browser/extensions/extension_install_ui.cc3
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc11
-rw-r--r--chrome/browser/external_tab_container_win.h2
-rw-r--r--chrome/browser/find_bar_host_browsertest.cc23
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc5
-rw-r--r--chrome/browser/importer/importer.cc3
-rw-r--r--chrome/browser/platform_util_chromeos.cc4
-rw-r--r--chrome/browser/sessions/session_restore.cc2
-rw-r--r--chrome/browser/sessions/session_restore_browsertest.cc9
-rw-r--r--chrome/browser/ssl/ssl_browser_tests.cc10
-rw-r--r--chrome/browser/tab_contents/match_preview.cc1
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc8
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.cc4
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.h4
-rw-r--r--chrome/browser/tabs/tab_strip_model.h3
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc1
-rw-r--r--chrome/browser/task_manager_browsertest.cc8
-rw-r--r--chrome/browser/translate/translate_manager.cc3
-rw-r--r--chrome/browser/views/app_launcher.cc2
-rw-r--r--chrome/browser/views/find_bar_host_interactive_uitest.cc11
-rw-r--r--chrome/browser/views/frame/browser_view.cc2
-rw-r--r--chrome/browser/views/tabs/browser_tab_strip_controller.cc21
-rw-r--r--chrome/browser/views/tabs/browser_tab_strip_controller.h6
-rw-r--r--chrome/test/browser_with_test_window_test.cc2
-rw-r--r--chrome/test/in_process_browser_test.cc3
48 files changed, 248 insertions, 162 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc
index f567d6b..0b53d19 100644
--- a/chrome/browser/autocomplete/autocomplete_browsertest.cc
+++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc
@@ -144,9 +144,11 @@ IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, TabAwayRevertSelect) {
EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL),
location_bar->location_entry()->GetText());
location_bar->location_entry()->SetUserText(L"");
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(
GURL(chrome::kAboutBlankURL), GURL(), PageTransition::START_PAGE,
- -1, TabStripModel::ADD_SELECTED, NULL, std::string());
+ -1, TabStripModel::ADD_SELECTED, NULL, std::string(), &browser_used);
+ EXPECT_EQ(browser(), browser_used);
ui_test_utils::WaitForNavigation(
&browser()->GetSelectedTabContents()->controller());
EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL),
diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc
index 89c17ba..7953d86 100644
--- a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc
+++ b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc
@@ -9,7 +9,6 @@
#include "base/histogram.h"
#include "chrome/browser/autofill/autofill_cc_infobar.h"
#include "chrome/browser/autofill/autofill_manager.h"
-#include "chrome/browser/browser.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -23,15 +22,9 @@
AutoFillCCInfoBarDelegate::AutoFillCCInfoBarDelegate(TabContents* tab_contents,
AutoFillManager* host)
: ConfirmInfoBarDelegate(tab_contents),
- browser_(NULL),
host_(host) {
- if (tab_contents) {
- // This is NULL for TestTabContents.
- if (tab_contents->delegate())
- browser_ = tab_contents->delegate()->GetBrowser();
-
+ if (tab_contents)
tab_contents->AddInfoBar(this);
- }
}
AutoFillCCInfoBarDelegate::~AutoFillCCInfoBarDelegate() {
@@ -103,8 +96,8 @@ std::wstring AutoFillCCInfoBarDelegate::GetLinkText() {
}
bool AutoFillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
- browser_->OpenURL(GURL(kAutoFillLearnMoreUrl), GURL(), NEW_FOREGROUND_TAB,
- PageTransition::TYPED);
+ host_->tab_contents()->OpenURL(GURL(kAutoFillLearnMoreUrl), GURL(),
+ NEW_FOREGROUND_TAB, PageTransition::TYPED);
return false;
}
diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.h b/chrome/browser/autofill/autofill_cc_infobar_delegate.h
index 32a7c82..6a8091e 100644
--- a/chrome/browser/autofill/autofill_cc_infobar_delegate.h
+++ b/chrome/browser/autofill/autofill_cc_infobar_delegate.h
@@ -11,7 +11,6 @@
#include "chrome/browser/tab_contents/infobar_delegate.h"
class AutoFillManager;
-class Browser;
class SkBitmap;
class TabContents;
@@ -46,9 +45,6 @@ class AutoFillCCInfoBarDelegate : public ConfirmInfoBarDelegate {
}
private:
- // The browser.
- Browser* browser_;
-
// The AutoFillManager that initiated this InfoBar.
AutoFillManager* host_;
diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h
index 964b8bc..4858a5e 100644
--- a/chrome/browser/autofill/autofill_manager.h
+++ b/chrome/browser/autofill/autofill_manager.h
@@ -45,6 +45,9 @@ class AutoFillManager : public RenderViewHostDelegate::AutoFill,
// Registers our Enable/Disable AutoFill pref.
static void RegisterUserPrefs(PrefService* prefs);
+ // Returns the TabContents hosting this AutoFillManager.
+ TabContents* tab_contents() const { return tab_contents_; }
+
// RenderViewHostDelegate::AutoFill implementation:
virtual void FormSubmitted(const webkit_glue::FormData& form);
virtual void FormsSeen(const std::vector<webkit_glue::FormData>& forms);
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index bba2ace..850d613 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -610,7 +610,7 @@ void AutomationProvider::AppendTab(int handle, const GURL& url,
observer = AddTabStripObserver(browser, reply_message);
TabContents* tab_contents = browser->AddTabWithURL(
url, GURL(), PageTransition::TYPED, -1, TabStripModel::ADD_SELECTED,
- NULL, std::string());
+ NULL, std::string(), &browser);
if (tab_contents) {
append_tab_response =
GetIndexForNavigationController(&tab_contents->controller(), browser);
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index a5c9b0c..4956195 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -448,7 +448,7 @@ void Browser::OpenURLOffTheRecord(Profile* profile, const GURL& url) {
// TODO(eroman): should we have referrer here?
browser->AddTabWithURL(
url, GURL(), PageTransition::LINK, -1, TabStripModel::ADD_SELECTED, NULL,
- std::string());
+ std::string(), &browser);
browser->window()->Show();
}
@@ -538,10 +538,10 @@ TabContents* Browser::OpenApplication(Profile* profile,
case Extension::LAUNCH_WINDOW:
case Extension::LAUNCH_PANEL:
tab = Browser::OpenApplicationWindow(profile, extension, container,
- GURL());
+ GURL(), &browser);
break;
case Extension::LAUNCH_TAB: {
- tab = Browser::OpenApplicationTab(profile, extension);
+ tab = Browser::OpenApplicationTab(profile, extension, &browser);
break;
}
default:
@@ -549,7 +549,6 @@ TabContents* Browser::OpenApplication(Profile* profile,
break;
}
if (tab) {
- Browser* browser = tab->delegate()->GetBrowser();
if (browser && extension && extension->launch_fullscreen())
browser->window()->SetFullscreen(true);
}
@@ -561,7 +560,8 @@ TabContents* Browser::OpenApplicationWindow(
Profile* profile,
Extension* extension,
Extension::LaunchContainer container,
- const GURL& url_input) {
+ const GURL& url_input,
+ Browser** browser) {
GURL url;
if (!url_input.is_empty()) {
if (extension)
@@ -577,15 +577,15 @@ TabContents* Browser::OpenApplicationWindow(
RegisterAppPrefs(app_name);
bool as_panel = extension && (container == Extension::LAUNCH_PANEL);
- Browser* browser = Browser::CreateForApp(app_name, extension, profile,
- as_panel);
- TabContents* tab_contents = browser->AddTabWithURL(
+ Browser* local_browser = Browser::CreateForApp(app_name, extension, profile,
+ as_panel);
+ TabContents* tab_contents = local_browser->AddTabWithURL(
url, GURL(), PageTransition::START_PAGE, -1, TabStripModel::ADD_SELECTED,
- NULL, std::string());
+ NULL, std::string(), &local_browser);
tab_contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
tab_contents->render_view_host()->SyncRendererPrefs();
- browser->window()->Show();
+ local_browser->window()->Show();
// TODO(jcampan): http://crbug.com/8123 we should not need to set the initial
// focus explicitly.
@@ -598,33 +598,42 @@ TabContents* Browser::OpenApplicationWindow(
// OnDidGetApplicationInfo, which calls
// web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as
// pending web app action.
- browser->pending_web_app_action_ = UPDATE_SHORTCUT;
+ local_browser->pending_web_app_action_ = UPDATE_SHORTCUT;
}
+ if (browser)
+ *browser = local_browser;
+
return tab_contents;
}
// static
TabContents* Browser::OpenApplicationWindow(Profile* profile,
- GURL& url) {
- return OpenApplicationWindow(profile, NULL, Extension::LAUNCH_WINDOW, url);
+ GURL& url, Browser** browser) {
+ return OpenApplicationWindow(profile, NULL, Extension::LAUNCH_WINDOW, url,
+ browser);
}
// static
TabContents* Browser::OpenApplicationTab(Profile* profile,
- Extension* extension) {
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
- if (!browser || browser->type() != Browser::TYPE_NORMAL)
+ Extension* extension,
+ Browser** browser) {
+ Browser* local_browser = BrowserList::GetLastActiveWithProfile(profile);
+ if (!local_browser || local_browser->type() != Browser::TYPE_NORMAL)
return NULL;
// TODO(erikkay): This doesn't seem like the right transition in all cases.
PageTransition::Type transition = PageTransition::START_PAGE;
GURL url = extension->GetFullLaunchURL();
TabContents* tab_contents =
- browser->CreateTabContentsForURL(url, GURL(), profile,
- transition, false, NULL);
+ local_browser->CreateTabContentsForURL(url, GURL(), profile,
+ transition, false, NULL);
tab_contents->SetExtensionApp(extension);
- browser->AddTab(tab_contents, transition);
+ local_browser->AddTab(tab_contents, transition);
+
+ if (browser)
+ *browser = local_browser;
+
return tab_contents;
}
@@ -881,7 +890,8 @@ TabContents* Browser::AddTabWithURL(const GURL& url,
int index,
int add_types,
SiteInstance* instance,
- const std::string& extension_app_id) {
+ const std::string& extension_app_id,
+ Browser** browser_used) {
TabContents* contents = NULL;
if (CanSupportWindowFeature(FEATURE_TABSTRIP) || tabstrip_model()->empty()) {
GURL url_to_load = url;
@@ -899,6 +909,9 @@ TabContents* Browser::AddTabWithURL(const GURL& url,
// TabStripModel::AddTabContents invokes HideContents if not foreground.
contents->WasHidden();
}
+
+ if (browser_used)
+ *browser_used = this;
} else {
// We're in an app window or a popup window. Find an existing browser to
// open this URL in, creating one if none exists.
@@ -907,8 +920,11 @@ TabContents* Browser::AddTabWithURL(const GURL& url,
if (!b)
b = Browser::Create(profile_);
contents = b->AddTabWithURL(url, referrer, transition, index, add_types,
- instance, extension_app_id);
+ instance, extension_app_id, &b);
b->window()->Show();
+
+ if (browser_used)
+ *browser_used = b;
}
return contents;
}
@@ -1036,7 +1052,7 @@ void Browser::ShowSingletonTab(const GURL& url) {
// Otherwise, just create a new tab.
AddTabWithURL(url, GURL(), PageTransition::AUTO_BOOKMARK, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(), NULL);
}
void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) {
@@ -1847,7 +1863,7 @@ void Browser::OpenUpdateChromeDialog() {
void Browser::OpenHelpTab() {
GURL help_url = google_util::AppendGoogleLocaleParam(GURL(kHelpContentUrl));
AddTabWithURL(help_url, GURL(), PageTransition::AUTO_BOOKMARK, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(), NULL);
}
void Browser::OpenThemeGalleryTabAndActivate() {
@@ -2200,7 +2216,7 @@ TabContents* Browser::AddBlankTabAt(int index, bool foreground) {
TabContents* tab_contents = AddTabWithURL(
GURL(chrome::kChromeUINewTabURL), GURL(), PageTransition::TYPED, index,
foreground ? TabStripModel::ADD_SELECTED : TabStripModel::ADD_NONE, NULL,
- std::string());
+ std::string(), NULL);
tab_contents->set_new_tab_start_time(new_tab_start_time);
return tab_contents;
}
@@ -2390,6 +2406,13 @@ void Browser::ToggleUseVerticalTabs() {
UseVerticalTabsChanged();
}
+bool Browser::LargeIconsPermitted() const {
+ // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because
+ // for those windows, we already have a big icon in the top-left outside any
+ // tab. Having big tab icons too looks kinda redonk.
+ return TYPE_EXTENSION_APP != type();
+}
+
///////////////////////////////////////////////////////////////////////////////
// Browser, TabStripModelObserver implementation:
@@ -2951,10 +2974,6 @@ void Browser::OnDidGetApplicationInfo(TabContents* tab_contents,
pending_web_app_action_ = NONE;
}
-Browser* Browser::GetBrowser() {
- return this;
-}
-
void Browser::ContentTypeChanged(TabContents* source) {
if (source == GetSelectedTabContents())
UpdateZoomCommandsForTabState();
@@ -3763,7 +3782,7 @@ bool Browser::HandleCrossAppNavigation(TabContents* source,
if (destination_extension->launch_container() ==
Extension::LAUNCH_WINDOW) {
Browser::OpenApplicationWindow(profile_, destination_extension,
- Extension::LAUNCH_WINDOW, url);
+ Extension::LAUNCH_WINDOW, url, NULL);
return true;
}
}
@@ -3917,7 +3936,8 @@ void Browser::OpenURLAtIndex(TabContents* source,
Browser* browser = Browser::Create(profile_);
new_contents = browser->AddTabWithURL(
url, referrer, transition, index,
- TabStripModel::ADD_SELECTED | add_types, instance, std::string());
+ TabStripModel::ADD_SELECTED | add_types, instance, std::string(),
+ &browser);
browser->window()->Show();
} else if ((disposition == CURRENT_TAB) && current_tab) {
tabstrip_model_.TabNavigating(current_tab, transition);
@@ -3952,7 +3972,7 @@ void Browser::OpenURLAtIndex(TabContents* source,
if (disposition != NEW_BACKGROUND_TAB)
add_types |= TabStripModel::ADD_SELECTED;
new_contents = AddTabWithURL(url, referrer, transition, index, add_types,
- instance, std::string());
+ instance, std::string(), NULL);
}
if (disposition != NEW_BACKGROUND_TAB && source_tab_was_frontmost &&
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 57da415..17d7955 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -222,20 +222,29 @@ class Browser : public TabStripModelDelegate,
// app panel window, otherwise it will be opened as as either
// Browser::Type::APP a.k.a. "thin frame" (if |extension| is NULL) or
// Browser::Type::EXTENSION_APP (if |extension| is non-NULL).
+ // Returns the browser hosting for the TabContents via optional parameter,
+ // |browser|.
static TabContents* OpenApplicationWindow(
Profile* profile,
Extension* extension,
Extension::LaunchContainer container,
- const GURL& url);
+ const GURL& url,
+ Browser** browser);
// Open an application for |extension| in a new application window or panel.
+ // Returns the browser hosting the TabContents via optional parameter,
+ // |browser|.
static TabContents* OpenApplicationWindow(Profile* profile,
- GURL& url);
+ GURL& url,
+ Browser** browser);
// Open an application for |extension| in a new application tab. Returns
// NULL if there are no appropriate existing browser windows for |profile|.
+ // Returns the browser hosting the TabContents via optional parameter,
+ // |browser|.
static TabContents* OpenApplicationTab(Profile* profile,
- Extension* extension);
+ Extension* extension,
+ Browser** browser);
// Opens a new window and opens the bookmark manager.
static void OpenBookmarkManagerWindow(Profile* profile);
@@ -328,13 +337,17 @@ class Browser : public TabStripModelDelegate,
// values defined by TabStripModel::AddTabTypes; see it for details. If
// |instance| is not null, its process will be used to render the tab. If
// |extension_app_id| is non-empty the new tab is an app tab.
+ // The returned tab may be hosted in a different browser. |browser_used|
+ // will be assigned the browser that satisfied the add tab request.
+ // |browser_used| may be passed
TabContents* AddTabWithURL(const GURL& url,
const GURL& referrer,
PageTransition::Type transition,
int index,
int add_types,
SiteInstance* instance,
- const std::string& extension_app_id);
+ const std::string& extension_app_id,
+ Browser** browser_used);
// Add a new tab, given a TabContents. A TabContents appropriate to
// display the last committed entry is created and returned.
@@ -653,6 +666,7 @@ class Browser : public TabStripModelDelegate,
virtual void ToggleUseVerticalTabs();
virtual bool CanRestoreTab();
virtual void RestoreTab();
+ virtual bool LargeIconsPermitted() const;
// Overridden from TabStripModelObserver:
virtual void TabInsertedAt(TabContents* contents,
@@ -734,7 +748,6 @@ class Browser : public TabStripModelDelegate,
virtual bool ShouldAddNavigationsToHistory() const;
virtual void OnDidGetApplicationInfo(TabContents* tab_contents,
int32 page_id);
- virtual Browser* GetBrowser();
virtual void ContentTypeChanged(TabContents* source);
virtual void CommitMatchPreview(TabContents* source);
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index 3a548ac..19d82d7 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -204,8 +204,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_JavascriptAlertActivatesTab) {
GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory),
FilePath(kTitle1File)));
ui_test_utils::NavigateToURL(browser(), url);
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, 0,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
EXPECT_EQ(2, browser()->tab_count());
EXPECT_EQ(0, browser()->selected_index());
TabContents* second_tab = browser()->GetTabContentsAt(1);
@@ -230,8 +233,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ThirtyFourTabs) {
// There is one initial tab.
for (int ix = 0; ix != 33; ++ix) {
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, 0,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
}
EXPECT_EQ(34, browser()->tab_count());
@@ -698,7 +704,8 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenTab) {
ASSERT_EQ(NULL, Browser::FindAppTab(browser(), extension_app_));
// Open a tab with the app.
- TabContents* tab = Browser::OpenApplicationTab(profile_, extension_app_);
+ TabContents* tab = Browser::OpenApplicationTab(profile_, extension_app_,
+ NULL);
ASSERT_TRUE(WaitForTab(tab));
ASSERT_EQ(2, browser()->tab_count());
@@ -755,7 +762,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenPanel) {
// Open the app in a panel.
Browser::OpenApplicationWindow(profile_, extension_app_,
- Extension::LAUNCH_PANEL, GURL());
+ Extension::LAUNCH_PANEL, GURL(), NULL);
Browser* app_panel = BrowserList::GetLastActive();
ASSERT_TRUE(app_panel);
ASSERT_NE(app_panel, browser()) << "New browser should have opened.";
@@ -788,7 +795,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenWindow) {
// Open a window with the app.
Browser::OpenApplicationWindow(profile_, extension_app_,
- Extension::LAUNCH_WINDOW, GURL());
+ Extension::LAUNCH_WINDOW, GURL(), NULL);
Browser* app_window = BrowserList::GetLastActive();
ASSERT_TRUE(app_window);
ASSERT_NE(app_window, browser()) << "New browser should have opened.";
@@ -816,7 +823,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_WindowBeforeTab) {
ASSERT_EQ(1, browser()->tab_count());
// Open a tab with the app.
- Browser::OpenApplicationTab(profile_, extension_app_);
+ Browser::OpenApplicationTab(profile_, extension_app_, NULL);
ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
ASSERT_EQ(2, browser()->tab_count());
int app_tab_index = browser()->selected_index();
@@ -824,7 +831,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_WindowBeforeTab) {
// Open a window with the app.
Browser::OpenApplicationWindow(profile_, extension_app_,
- Extension::LAUNCH_WINDOW, GURL());
+ Extension::LAUNCH_WINDOW, GURL(), NULL);
Browser* app_window = BrowserList::GetLastActive();
ASSERT_TRUE(app_window);
ASSERT_NE(app_window, browser()) << "New browser should have opened.";
@@ -845,7 +852,8 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_PanelBeforeTab) {
ASSERT_EQ(1, browser()->tab_count());
// Open a tab with the app.
- TabContents* tab = Browser::OpenApplicationTab(profile_, extension_app_);
+ TabContents* tab = Browser::OpenApplicationTab(profile_, extension_app_,
+ NULL);
ASSERT_TRUE(WaitForTab(tab));
ASSERT_EQ(2, browser()->tab_count());
int app_tab_index = browser()->selected_index();
@@ -853,7 +861,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_PanelBeforeTab) {
// Open a panel with the app.
Browser::OpenApplicationWindow(profile_, extension_app_,
- Extension::LAUNCH_PANEL, GURL());
+ Extension::LAUNCH_PANEL, GURL(), NULL);
Browser* app_panel = BrowserList::GetLastActive();
ASSERT_TRUE(app_panel);
ASSERT_NE(app_panel, browser()) << "New browser should have opened.";
@@ -873,7 +881,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_TabInFocusedWindow) {
ASSERT_EQ(1, browser()->tab_count());
- Browser::OpenApplicationTab(profile_, extension_app_);
+ Browser::OpenApplicationTab(profile_, extension_app_, NULL);
ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
ASSERT_EQ(2, browser()->tab_count());
int app_tab_index = browser()->selected_index();
@@ -883,7 +891,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_TabInFocusedWindow) {
Browser* extra_browser = CreateBrowser(profile_);
ASSERT_EQ(extra_browser, BrowserList::GetLastActive());
- Browser::OpenApplicationTab(profile_, extension_app_);
+ Browser::OpenApplicationTab(profile_, extension_app_, NULL);
ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(extra_browser));
ASSERT_EQ(2, extra_browser->tab_count());
app_tab_index = extra_browser->selected_index();
@@ -931,9 +939,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) {
EXPECT_EQ(1, popup_browser->tab_count());
// Now try opening another tab in the popup browser.
+ Browser* browser_used = NULL;
popup_browser->AddTabWithURL(
GURL(chrome::kAboutBlankURL), GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(), &browser_used);
+ EXPECT_EQ(popup_browser, browser_used);
// The popup should still only have one tab.
EXPECT_EQ(1, popup_browser->tab_count());
@@ -950,7 +960,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) {
// Now try opening another tab in the app browser.
app_browser->AddTabWithURL(
GURL(chrome::kAboutBlankURL), GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(), &browser_used);
+ EXPECT_EQ(app_browser, browser_used);
// The popup should still only have one tab.
EXPECT_EQ(1, app_browser->tab_count());
@@ -967,7 +978,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) {
// Now try opening another tab in the app popup browser.
app_popup_browser->AddTabWithURL(
GURL(chrome::kAboutBlankURL), GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(), &browser_used);
+ EXPECT_EQ(app_popup_browser, browser_used);
// The popup should still only have one tab.
EXPECT_EQ(1, app_popup_browser->tab_count());
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 8b421f6..84a2ba8 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -261,8 +261,11 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocus) {
// Create several tabs.
for (int i = 0; i < 4; ++i) {
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
}
// Alternate focus for the tab.
@@ -344,8 +347,11 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) {
browser()->FocusLocationBar();
// Create a 2nd tab.
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
// Focus should be on the recently opened tab page.
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
@@ -765,7 +771,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FLAKY_TabInitialFocus) {
// Open about:blank, focus should be on the location bar.
browser()->AddTabWithURL(GURL("about:blank"), GURL(), PageTransition::LINK,
-1, TabStripModel::ADD_SELECTED, NULL,
- std::string());
+ std::string(),
+ NULL);
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
}
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index 4b26d4a..87d7153 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -625,7 +625,7 @@ bool BrowserInit::LaunchWithProfile::OpenApplicationWindow(Profile* profile) {
ChildProcessSecurityPolicy::GetInstance();
if (policy->IsWebSafeScheme(url.scheme()) ||
url.SchemeIs(chrome::kFileScheme)) {
- Browser::OpenApplicationWindow(profile, url);
+ Browser::OpenApplicationWindow(profile, url, NULL);
return true;
}
}
@@ -771,7 +771,7 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser(
TabContents* tab = browser->AddTabWithURL(
tabs[i].url, GURL(), PageTransition::START_PAGE, index, add_types, NULL,
- tabs[i].app_id);
+ tabs[i].app_id, NULL);
if (profile_ && first_tab && process_startup) {
AddCrashedInfoBarIfNecessary(tab);
diff --git a/chrome/browser/chromeos/dom_ui/internet_options_handler.cc b/chrome/browser/chromeos/dom_ui/internet_options_handler.cc
index 0207484..785ed7b 100644
--- a/chrome/browser/chromeos/dom_ui/internet_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/internet_options_handler.cc
@@ -93,11 +93,9 @@ void InternetOptionsHandler::NetworkChanged(chromeos::NetworkLibrary* cros) {
}
void InternetOptionsHandler::CreateModalPopup(views::WindowDelegate* view) {
- Browser* browser = NULL;
- TabContentsDelegate* delegate = dom_ui_->tab_contents()->delegate();
- if (delegate)
- browser = delegate->GetBrowser();
- DCHECK(browser);
+ // TODO(beng): This is an improper direct dependency on Browser. Route this
+ // through some sort of delegate.
+ Browser* browser = BrowserList::FindBrowserWithProfile(dom_ui_->GetProfile());
views::Window* window = views::Window::CreateChromeWindow(
browser->window()->GetNativeHandle(), gfx::Rect(), view);
window->SetIsAlwaysOnTop(true);
diff --git a/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc b/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc
index 3d01ab1..517aad9 100644
--- a/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc
+++ b/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc
@@ -36,7 +36,8 @@ class TabCloseableStateWatcherTest : public InProcessBrowserTest {
// Wrapper for Browser::AddTabWithURL
void AddTabWithURL(Browser* browser, const GURL& url) {
browser->AddTabWithURL(url, GURL(), PageTransition::TYPED, 0,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser);
// Wait for page to finish loading.
ui_test_utils::WaitForNavigation(
&browser->GetSelectedTabContents()->controller());
diff --git a/chrome/browser/cocoa/applescript/window_applescript.mm b/chrome/browser/cocoa/applescript/window_applescript.mm
index cb2eb81..4b04896 100644
--- a/chrome/browser/cocoa/applescript/window_applescript.mm
+++ b/chrome/browser/cocoa/applescript/window_applescript.mm
@@ -175,7 +175,8 @@
-1, // To indicate tab is inserted at end.
TabStripModel::ADD_SELECTED,
NULL,
- std::string());
+ std::string(),
+ NULL);
tabContents->set_new_tab_start_time(newTabStartTime);
[aTab setTabContent:tabContents];
@@ -196,7 +197,8 @@
index,
TabStripModel::ADD_SELECTED,
NULL,
- std::string());
+ std::string(),
+ NULL);
tabContents->set_new_tab_start_time(newTabStartTime);
[aTab setTabContent:tabContents];
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index 1a907bd..cae8307 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -1653,7 +1653,7 @@ private:
browser_->AddTabWithURL(url, GURL(), PageTransition::TYPED, index,
TabStripModel::ADD_SELECTED |
TabStripModel::ADD_FORCE_INDEX,
- NULL, std::string());
+ NULL, std::string(), NULL);
break;
case CURRENT_TAB:
UserMetrics::RecordAction(UserMetricsAction("Tab_DropURLOnTab"),
diff --git a/chrome/browser/cocoa/tab_strip_controller_unittest.mm b/chrome/browser/cocoa/tab_strip_controller_unittest.mm
index aadea16..032912d 100644
--- a/chrome/browser/cocoa/tab_strip_controller_unittest.mm
+++ b/chrome/browser/cocoa/tab_strip_controller_unittest.mm
@@ -68,6 +68,8 @@ class TestTabStripDelegate : public TabStripModelDelegate {
virtual bool UseVerticalTabs() const { return false; }
virtual void ToggleUseVerticalTabs() {}
+
+ virtual bool LargeIconsPermitted() const { return true; }
};
class TabStripControllerTest : public CocoaTest {
diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc
index 983539e..8d441b0 100644
--- a/chrome/browser/dom_ui/dom_ui.cc
+++ b/chrome/browser/dom_ui/dom_ui.cc
@@ -108,7 +108,7 @@ void DOMUI::RegisterMessageCallback(const std::string &message,
message_callbacks_.insert(std::make_pair(message, callback));
}
-Profile* DOMUI::GetProfile() {
+Profile* DOMUI::GetProfile() const {
return tab_contents()->profile();
}
diff --git a/chrome/browser/dom_ui/dom_ui.h b/chrome/browser/dom_ui/dom_ui.h
index 3aadbd5..66c5455 100644
--- a/chrome/browser/dom_ui/dom_ui.h
+++ b/chrome/browser/dom_ui/dom_ui.h
@@ -114,7 +114,7 @@ class DOMUI {
TabContents* tab_contents() const { return tab_contents_; }
- Profile* GetProfile();
+ Profile* GetProfile() const;
protected:
void AddMessageHandler(DOMMessageHandler* handler);
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc
index 84c813f..14e9748 100644
--- a/chrome/browser/dom_ui/filebrowse_ui.cc
+++ b/chrome/browser/dom_ui/filebrowse_ui.cc
@@ -751,13 +751,9 @@ void FilebrowseHandler::OpenNewWindow(const Value* value, bool popup) {
} else {
browser = BrowserList::GetLastActive();
}
- TabContents* contents = browser->AddTabWithURL(
- GURL(path), GURL(), PageTransition::LINK, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
- // AddTabWithURL could have picked another Browser instance to create this
- // new tab at. So we have to reset the ptr of the browser that we want to
- // talk to.
- browser = contents->delegate()->GetBrowser();
+ browser->AddTabWithURL(GURL(path), GURL(), PageTransition::LINK, -1,
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser);
if (popup) {
// TODO(dhg): Remove these from being hardcoded. Allow javascript
// to specify.
@@ -1120,7 +1116,8 @@ Browser* FileBrowseUI::OpenPopup(Profile* profile,
browser->AddTabWithURL(
GURL(url), GURL(), PageTransition::LINK, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser);
browser->window()->SetBounds(gfx::Rect(kPopupLeft,
kPopupTop,
width,
diff --git a/chrome/browser/dom_ui/history2_ui.cc b/chrome/browser/dom_ui/history2_ui.cc
index d808fe9..114a5b9 100644
--- a/chrome/browser/dom_ui/history2_ui.cc
+++ b/chrome/browser/dom_ui/history2_ui.cc
@@ -19,6 +19,7 @@
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/dom_ui/dom_ui_favicon_source.h"
#include "chrome/browser/metrics/user_metrics.h"
@@ -237,8 +238,11 @@ void BrowsingHistoryHandler2::HandleRemoveURLsOnOneDay(const Value* value) {
}
void BrowsingHistoryHandler2::HandleClearBrowsingData(const Value* value) {
- dom_ui_->tab_contents()->delegate()->GetBrowser()->
- OpenClearBrowsingDataDialog();
+ // TODO(beng): This is an improper direct dependency on Browser. Route this
+ // through some sort of delegate.
+ Browser* browser = BrowserList::FindBrowserWithProfile(dom_ui_->GetProfile());
+ if (browser)
+ browser->OpenClearBrowsingDataDialog();
}
void BrowsingHistoryHandler2::QueryComplete(
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc
index be09542..bb4f210 100644
--- a/chrome/browser/dom_ui/history_ui.cc
+++ b/chrome/browser/dom_ui/history_ui.cc
@@ -19,6 +19,7 @@
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/dom_ui/dom_ui_favicon_source.h"
#include "chrome/browser/metrics/user_metrics.h"
@@ -237,8 +238,11 @@ void BrowsingHistoryHandler::HandleRemoveURLsOnOneDay(const Value* value) {
}
void BrowsingHistoryHandler::HandleClearBrowsingData(const Value* value) {
- dom_ui_->tab_contents()->delegate()->GetBrowser()->
- OpenClearBrowsingDataDialog();
+ // TODO(beng): This is an improper direct dependency on Browser. Route this
+ // through some sort of delegate.
+ Browser* browser = BrowserList::FindBrowserWithProfile(dom_ui_->GetProfile());
+ if (browser)
+ browser->OpenClearBrowsingDataDialog();
}
void BrowsingHistoryHandler::QueryComplete(
diff --git a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
index 64d6d1c..8bec35f 100644
--- a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
+++ b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
@@ -43,7 +43,7 @@ void HtmlDialogTabContentsDelegate::OpenURLFromTab(
TabContents* new_contents =
browser->AddTabWithURL(url, referrer, transition, -1,
TabStripModel::ADD_SELECTED, NULL,
- std::string());
+ std::string(), &browser);
DCHECK(new_contents);
browser->window()->Show();
new_contents->Focus();
diff --git a/chrome/browser/dom_ui/mediaplayer_ui.cc b/chrome/browser/dom_ui/mediaplayer_ui.cc
index d28ef79..df6b6eb 100644
--- a/chrome/browser/dom_ui/mediaplayer_ui.cc
+++ b/chrome/browser/dom_ui/mediaplayer_ui.cc
@@ -520,7 +520,8 @@ void MediaPlayer::PopupPlaylist(Browser* creator) {
profile);
playlist_browser_->AddTabWithURL(
GURL(kMediaplayerPlaylistURL), GURL(), PageTransition::LINK,
- -1, TabStripModel::ADD_SELECTED, NULL, std::string());
+ -1, TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &playlist_browser_);
playlist_browser_->window()->SetBounds(gfx::Rect(kPopupLeft,
kPopupTop,
kPopupWidth,
@@ -553,7 +554,8 @@ void MediaPlayer::PopupMediaPlayer(Browser* creator) {
#endif
mediaplayer_browser_->AddTabWithURL(
GURL(kMediaplayerURL), GURL(), PageTransition::LINK,
- -1, TabStripModel::ADD_SELECTED, NULL, std::string());
+ -1, TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &mediaplayer_browser_);
mediaplayer_browser_->window()->SetBounds(gfx::Rect(kPopupLeft,
kPopupTop,
kPopupWidth,
diff --git a/chrome/browser/extensions/extension_dom_ui.cc b/chrome/browser/extensions/extension_dom_ui.cc
index b23d12c..29768b9 100644
--- a/chrome/browser/extensions/extension_dom_ui.cc
+++ b/chrome/browser/extensions/extension_dom_ui.cc
@@ -177,12 +177,9 @@ void ExtensionDOMUI::ProcessDOMUIMessage(const std::string& message,
}
Browser* ExtensionDOMUI::GetBrowser() const {
- Browser* browser = NULL;
- TabContentsDelegate* tab_contents_delegate = tab_contents()->delegate();
- if (tab_contents_delegate)
- browser = tab_contents_delegate->GetBrowser();
-
- return browser;
+ // TODO(beng): This is an improper direct dependency on Browser. Route this
+ // through some sort of delegate.
+ return BrowserList::FindBrowserWithProfile(DOMUI::GetProfile());
}
Profile* ExtensionDOMUI::GetProfile() {
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index 3468336..bd59dd4 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -200,7 +200,8 @@ void ExtensionInstallUI::OnInstallSuccess(Extension* extension) {
url += "/#";
url += hash_params;
browser->AddTabWithURL(GURL(url), GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ NULL);
}
return;
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index cf15d02..79b3cdf 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -373,7 +373,8 @@ bool CreateWindowFunction::RunImpl() {
Browser* new_window = new Browser(window_type, window_profile);
new_window->CreateBrowserWindow();
new_window->AddTabWithURL(url, GURL(), PageTransition::LINK, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &new_window);
new_window->window()->SetBounds(bounds);
new_window->window()->Show();
@@ -581,15 +582,17 @@ bool CreateTabFunction::RunImpl() {
TabStripModel::ADD_NONE;
add_types |= TabStripModel::ADD_FORCE_INDEX;
TabContents* contents = browser->AddTabWithURL(url, GURL(),
- PageTransition::LINK, index, add_types, NULL, std::string());
- index = tab_strip->GetIndexOfTabContents(contents);
+ PageTransition::LINK, index, add_types, NULL, std::string(), &browser);
+ index = browser->tabstrip_model()->GetIndexOfTabContents(contents);
if (selected)
contents->Focus();
// Return data about the newly created tab.
if (has_callback())
- result_.reset(ExtensionTabUtil::CreateTabValue(contents, tab_strip, index));
+ result_.reset(ExtensionTabUtil::CreateTabValue(contents,
+ browser->tabstrip_model(),
+ index));
return true;
}
diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h
index a957b6a..443b3e8 100644
--- a/chrome/browser/external_tab_container_win.h
+++ b/chrome/browser/external_tab_container_win.h
@@ -147,8 +147,6 @@ class ExternalTabContainer : public TabContentsDelegate,
const NavigationEntry::SSLStatus& ssl,
bool show_history);
- virtual Browser* GetBrowser() { return browser_.get(); }
-
// Overriden from TabContentsDelegate::AutomationResourceRoutingDelegate
virtual void RegisterRenderViewHost(RenderViewHost* render_view_host);
virtual void UnregisterRenderViewHost(RenderViewHost* render_view_host);
diff --git a/chrome/browser/find_bar_host_browsertest.cc b/chrome/browser/find_bar_host_browsertest.cc
index 5d67553..02d51f7 100644
--- a/chrome/browser/find_bar_host_browsertest.cc
+++ b/chrome/browser/find_bar_host_browsertest.cc
@@ -835,8 +835,11 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) {
EXPECT_EQ(1, FindInPageWchar(tab1, L"Default", kFwd, kIgnoreCase, &ordinal));
// Create a second tab.
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
browser()->SelectTabContentsAt(1, false);
TabContents* tab2 = browser()->GetSelectedTabContents();
EXPECT_NE(tab1, tab2);
@@ -912,8 +915,11 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulateInNewTab) {
EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal));
// Now create a second tab and load the same page.
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
browser()->SelectTabContentsAt(1, false);
TabContents* tab2 = browser()->GetSelectedTabContents();
EXPECT_NE(tab1, tab2);
@@ -957,8 +963,11 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) {
FindBarController::kKeepSelection);
// Now create a second tab and load the same page.
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
browser()->SelectTabContentsAt(1, false);
TabContents* tab2 = browser()->GetSelectedTabContents();
EXPECT_NE(tab1, tab2);
@@ -1034,9 +1043,11 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
// Open a new incognito window and navigate to the same page.
Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
Browser* incognito_browser = Browser::Create(incognito_profile);
+ Browser* browser_used = NULL;
incognito_browser->AddTabWithURL(url, GURL(), PageTransition::START_PAGE, -1,
TabStripModel::ADD_SELECTED, NULL,
- std::string());
+ std::string(), &browser_used);
+ EXPECT_EQ(incognito_browser, browser_used);
ui_test_utils::WaitForNavigation(
&incognito_browser->GetSelectedTabContents()->controller());
incognito_browser->window()->Show();
@@ -1057,7 +1068,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
// Now open a new tab in the original (non-incognito) browser.
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
browser()->SelectTabContentsAt(1, false);
TabContents* tab2 = browser()->GetSelectedTabContents();
EXPECT_NE(tab1, tab2);
diff --git a/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc b/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc
index e8c2e74..60d6b8f 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc
@@ -37,9 +37,12 @@ IN_PROC_BROWSER_TEST_F(BookmarkBarGtkBrowserTest, FindBarTest) {
browser()->Find();
// Create new tab with an arbitrary URL.
+ Browser* browser_used = NULL;
GURL url = server->TestServerPage(kSimplePage);
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
// Switch back to the NTP with the active findbar.
browser()->SelectTabContentsAt(1, false);
diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc
index 1f8f13f..4217a80 100644
--- a/chrome/browser/importer/importer.cc
+++ b/chrome/browser/importer/importer.cc
@@ -203,7 +203,8 @@ void ImporterHost::StartImportSettings(
SiteInstance* site = instance->GetSiteInstanceForURL(url);
Browser* browser = BrowserList::GetLastActive();
browser->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, site, std::string());
+ TabStripModel::ADD_SELECTED, site, std::string(),
+ NULL);
MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
this, &ImporterHost::OnLockViewEnd, false));
diff --git a/chrome/browser/platform_util_chromeos.cc b/chrome/browser/platform_util_chromeos.cc
index d3dbee0..591a222 100644
--- a/chrome/browser/platform_util_chromeos.cc
+++ b/chrome/browser/platform_util_chromeos.cc
@@ -81,7 +81,7 @@ void OpenItem(const FilePath& full_path) {
Browser* browser = BrowserList::GetLastActive();
browser->AddTabWithURL(
GURL(path), GURL(), PageTransition::LINK, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(), NULL);
return;
}
if (ext == ".avi" ||
@@ -114,7 +114,7 @@ static void OpenURL(const std::string& url) {
Browser* browser = BrowserList::GetLastActive();
browser->AddTabWithURL(
GURL(url), GURL(), PageTransition::LINK, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(), NULL);
}
void OpenExternal(const GURL& url) {
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 6ec5a66..a75f7de 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -523,7 +523,7 @@ class SessionRestoreImpl : public NotificationObserver {
add_types |= TabStripModel::ADD_SELECTED;
int index = browser->GetIndexForInsertionDuringRestore(i);
browser->AddTabWithURL(urls[i], GURL(), PageTransition::START_PAGE, index,
- add_types, NULL, std::string());
+ add_types, NULL, std::string(), NULL);
}
}
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc
index e2752c1..7c594e4 100644
--- a/chrome/browser/sessions/session_restore_browsertest.cc
+++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -75,13 +75,18 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreIndividualTabFromWindow) {
FilePath(FILE_PATH_LITERAL("title3.html"))));
// Add and navigate three tabs.
+ Browser* browser_used = NULL;
ui_test_utils::NavigateToURL(browser(), url1);
browser()->AddTabWithURL(url2, GURL(), PageTransition::LINK, 1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
ui_test_utils::WaitForNavigationInCurrentTab(browser());
browser()->AddTabWithURL(url3, GURL(), PageTransition::LINK, 2,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
ui_test_utils::WaitForNavigationInCurrentTab(browser());
TabRestoreService* service = browser()->profile()->GetTabRestoreService();
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index aab0cd2..284d6ac 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -499,7 +499,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) {
"files/ssl/page_displays_insecure_content.html");
TabContents* tab2 = browser()->AddTabWithURL(url, GURL(),
PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED,
- tab1->GetSiteInstance(), std::string());
+ tab1->GetSiteInstance(), std::string(), NULL);
ui_test_utils::WaitForNavigation(&(tab2->controller()));
// The new tab has insecure content.
@@ -531,7 +531,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) {
https_server->TestServerPage("files/ssl/page_runs_insecure_content.html");
TabContents* tab2 = browser()->AddTabWithURL(url, GURL(),
PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED,
- tab1->GetSiteInstance(), std::string());
+ tab1->GetSiteInstance(), std::string(), NULL);
ui_test_utils::WaitForNavigation(&(tab2->controller()));
// The new tab has insecure content.
@@ -693,11 +693,15 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) {
// Let's add another tab to make sure the browser does not exit when we close
// the first tab.
GURL url = http_server->TestServerPage("files/ssl/google.html");
+ Browser* browser_used = NULL;
TabContents* tab2 = browser()->AddTabWithURL(
url, GURL(), PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, NULL,
- std::string());
+ std::string(), &browser_used);
ui_test_utils::WaitForNavigation(&(tab2->controller()));
+ // Ensure that the tab was created in the correct browser.
+ EXPECT_EQ(browser(), browser_used);
+
// Close the first tab.
browser()->CloseTabContents(tab1);
}
diff --git a/chrome/browser/tab_contents/match_preview.cc b/chrome/browser/tab_contents/match_preview.cc
index 3c0c43e..c8a8c21 100644
--- a/chrome/browser/tab_contents/match_preview.cc
+++ b/chrome/browser/tab_contents/match_preview.cc
@@ -110,7 +110,6 @@ class MatchPreview::TabContentsDelegateImpl : public TabContentsDelegate {
virtual bool ShouldAddNavigationsToHistory() const { return false; }
virtual void OnDidGetApplicationInfo(TabContents* tab_contents,
int32 page_id) {}
- virtual Browser* GetBrowser() { return NULL; }
virtual gfx::NativeWindow GetFrameNativeWindow() {
return match_preview_->host_->delegate() ?
match_preview_->host_->delegate()->GetFrameNativeWindow() : NULL;
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 1d2e028..c6b8876 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/blocked_plugin_manager.h"
#include "chrome/browser/blocked_popup_container.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
-#include "chrome/browser/browser.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/cert_store.h"
@@ -611,13 +610,6 @@ void TabContents::SetExtensionAppById(const std::string& extension_app_id) {
}
SkBitmap* TabContents::GetExtensionAppIcon() {
- // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because
- // for those windows, we already have a big icon in the top-left outside any
- // tab. Having big tab icons too looks kinda redonk.
- Browser* browser = delegate_ ? delegate_->GetBrowser() : NULL;
- if (browser && browser->type() == Browser::TYPE_EXTENSION_APP)
- return NULL;
-
if (extension_app_icon_.empty())
return NULL;
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.cc b/chrome/browser/tab_contents/tab_contents_delegate.cc
index 18d2bfc..f19422b 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.cc
+++ b/chrome/browser/tab_contents/tab_contents_delegate.cc
@@ -148,10 +148,6 @@ void TabContentsDelegate::OnDidGetApplicationInfo(TabContents* tab_contents,
int32 page_id) {
}
-Browser* TabContentsDelegate::GetBrowser() {
- return NULL;
-}
-
gfx::NativeWindow TabContentsDelegate::GetFrameNativeWindow() {
return NULL;
}
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index c01db78..2a31508 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -22,7 +22,6 @@ class Rect;
class Size;
}
-class Browser;
class DownloadItem;
class ExtensionFunctionDispatcher;
class GURL;
@@ -254,9 +253,6 @@ class TabContentsDelegate : public AutomationResourceRoutingDelegate {
virtual void OnDidGetApplicationInfo(TabContents* tab_contents,
int32 page_id);
- // Returns the browser in which the tab contents is being displayed.
- virtual Browser* GetBrowser();
-
// Returns the native window framing the view containing the tab contents.
virtual gfx::NativeWindow GetFrameNativeWindow();
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index 542b27f..1f75067 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -263,6 +263,9 @@ class TabStripModelDelegate {
// Toggles the use of the vertical tabstrip.
virtual void ToggleUseVerticalTabs() = 0;
+ // Returns true if the tab strip can use large icons.
+ virtual bool LargeIconsPermitted() const = 0;
+
protected:
virtual ~TabStripModelDelegate() {}
};
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 08f2c7b..88afe90 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -81,6 +81,7 @@ class TabStripDummyDelegate : public TabStripModelDelegate {
virtual void BookmarkAllTabs() {}
virtual bool UseVerticalTabs() const { return false; }
virtual void ToggleUseVerticalTabs() {}
+ virtual bool LargeIconsPermitted() const { return true; }
private:
// A dummy TabContents we give to callers that expect us to actually build a
diff --git a/chrome/browser/task_manager_browsertest.cc b/chrome/browser/task_manager_browsertest.cc
index a8eaa2e..65bd806 100644
--- a/chrome/browser/task_manager_browsertest.cc
+++ b/chrome/browser/task_manager_browsertest.cc
@@ -101,8 +101,11 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeTabContentsChanges) {
// Open a new tab and make sure we notice that.
GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory),
FilePath(kTitle1File)));
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, 0,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
WaitForResourceChange(3);
// Close the tab and verify that we notice.
@@ -247,7 +250,8 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest,
GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory),
FilePath(kTitle1File)));
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, 0,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ NULL);
WaitForResourceChange(3);
// Check that we get some value for the cache columns.
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 13810e6..23bfc2f 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -456,7 +456,8 @@ void TranslateManager::ReportLanguageDetectionError(TabContents* tab_contents) {
}
browser->AddTabWithURL(GURL(report_error_url), GURL(),
PageTransition::AUTO_BOOKMARK, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ NULL);
}
void TranslateManager::DoTranslatePage(TabContents* tab,
diff --git a/chrome/browser/views/app_launcher.cc b/chrome/browser/views/app_launcher.cc
index 4fa173d..1b852dc 100644
--- a/chrome/browser/views/app_launcher.cc
+++ b/chrome/browser/views/app_launcher.cc
@@ -388,7 +388,7 @@ void AppLauncher::AddTabWithURL(const GURL& url,
browser_->AddTabWithURL(
url, GURL(), transition, -1,
TabStripModel::ADD_SELECTED | TabStripModel::ADD_FORCE_INDEX, NULL,
- std::string());
+ std::string(), NULL);
}
void AppLauncher::Resize(const gfx::Size& contents_size) {
diff --git a/chrome/browser/views/find_bar_host_interactive_uitest.cc b/chrome/browser/views/find_bar_host_interactive_uitest.cc
index 615008d..991338c 100644
--- a/chrome/browser/views/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/views/find_bar_host_interactive_uitest.cc
@@ -89,7 +89,8 @@ class FindInPageTest : public InProcessBrowserTest {
} // namespace
IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) {
- scoped_refptr<net::HTTPTestServer> server(net::HTTPTestServer::CreateServer(kDocRoot));
+ scoped_refptr<net::HTTPTestServer> server(
+ net::HTTPTestServer::CreateServer(kDocRoot));
ASSERT_TRUE(NULL != server.get());
// First we navigate to our test page (tab A).
@@ -99,8 +100,11 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) {
browser()->Find();
// Open another tab (tab B).
+ Browser* browser_used = NULL;
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser_used);
+ EXPECT_EQ(browser(), browser_used);
browser()->Find();
EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, GetFocusedViewID());
@@ -126,7 +130,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) {
}
IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestore) {
- scoped_refptr<net::HTTPTestServer> server(net::HTTPTestServer::CreateServer(kDocRoot));
+ scoped_refptr<net::HTTPTestServer> server(
+ net::HTTPTestServer::CreateServer(kDocRoot));
ASSERT_TRUE(NULL != server.get());
GURL url = server->TestServerPage("title1.html");
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 85c2d16..daf6b2d 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -1793,7 +1793,7 @@ void BrowserView::InitTabStrip(TabStripModel* model) {
}
BrowserTabStripController* tabstrip_controller =
- new BrowserTabStripController(model);
+ new BrowserTabStripController(browser_.get(), model);
if (UseVerticalTabs())
tabstrip_ = new SideTabStrip(tabstrip_controller);
diff --git a/chrome/browser/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/views/tabs/browser_tab_strip_controller.cc
index 1221133..f0422f1 100644
--- a/chrome/browser/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/views/tabs/browser_tab_strip_controller.cc
@@ -112,9 +112,11 @@ class BrowserTabStripController::TabContextMenuContents
////////////////////////////////////////////////////////////////////////////////
// BrowserTabStripController, public:
-BrowserTabStripController::BrowserTabStripController(TabStripModel* model)
+BrowserTabStripController::BrowserTabStripController(Browser* browser,
+ TabStripModel* model)
: model_(model),
- tabstrip_(NULL) {
+ tabstrip_(NULL),
+ browser_(browser) {
model_->AddObserver(this);
notification_registrar_.Add(this,
@@ -269,12 +271,7 @@ void BrowserTabStripController::CreateNewTab() {
UserMetrics::RecordAction(UserMetricsAction("NewTab_Button"),
model_->profile());
- TabContents* selected_tab = model_->GetSelectedTabContents();
- if (!selected_tab)
- return;
-
- Browser* browser = selected_tab->delegate()->GetBrowser();
- if (browser->OpenAppsPanelAsNewTab())
+ if (browser_ && browser_->OpenAppsPanelAsNewTab())
return;
model_->delegate()->AddBlankTab(true);
@@ -368,7 +365,13 @@ void BrowserTabStripController::SetTabRendererDataFromModel(
TabContents* contents,
int model_index,
TabRendererData* data) {
- SkBitmap* app_icon = contents->GetExtensionAppIcon();
+ SkBitmap* app_icon = NULL;
+
+ // Extension App icons are slightly larger than favicons, so only allow
+ // them if permitted by the model.
+ if (model_->delegate()->LargeIconsPermitted())
+ app_icon = contents->GetExtensionAppIcon();
+
if (app_icon)
data->favicon = *app_icon;
else
diff --git a/chrome/browser/views/tabs/browser_tab_strip_controller.h b/chrome/browser/views/tabs/browser_tab_strip_controller.h
index 662a0c1..e900413 100644
--- a/chrome/browser/views/tabs/browser_tab_strip_controller.h
+++ b/chrome/browser/views/tabs/browser_tab_strip_controller.h
@@ -13,6 +13,7 @@
class BaseTab;
class BaseTabStrip;
+class Browser;
struct TabRendererData;
@@ -22,7 +23,7 @@ class BrowserTabStripController : public TabStripController,
public TabStripModelObserver,
public NotificationObserver {
public:
- explicit BrowserTabStripController(TabStripModel* model);
+ BrowserTabStripController(Browser* browser, TabStripModel* model);
virtual ~BrowserTabStripController();
void InitFromModel(BaseTabStrip* tabstrip);
@@ -104,6 +105,9 @@ class BrowserTabStripController : public TabStripController,
BaseTabStrip* tabstrip_;
+ // Non-owning pointer to the browser which is using this controller.
+ Browser* browser_;
+
// If non-NULL it means we're showing a menu for the tab.
scoped_ptr<TabContextMenuContents> context_menu_contents_;
diff --git a/chrome/test/browser_with_test_window_test.cc b/chrome/test/browser_with_test_window_test.cc
index b0ab2ef..30ec42b 100644
--- a/chrome/test/browser_with_test_window_test.cc
+++ b/chrome/test/browser_with_test_window_test.cc
@@ -58,7 +58,7 @@ TestRenderViewHost* BrowserWithTestWindowTest::TestRenderViewHostForTab(
void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) {
TabContents* new_tab = browser->AddTabWithURL(
url, GURL(), PageTransition::TYPED, 0, TabStripModel::ADD_SELECTED, NULL,
- std::string());
+ std::string(), NULL);
CommitPendingLoad(&new_tab->controller());
}
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 5d7e2be..4761c0a 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -251,7 +251,8 @@ Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) {
browser->AddTabWithURL(GURL(chrome::kAboutBlankURL), GURL(),
PageTransition::START_PAGE, -1,
- TabStripModel::ADD_SELECTED, NULL, std::string());
+ TabStripModel::ADD_SELECTED, NULL, std::string(),
+ &browser);
// Wait for the page to finish loading.
ui_test_utils::WaitForNavigation(