summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 01:55:38 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 01:55:38 +0000
commit715af7e54de3111942c62841a64c6f3584c93877 (patch)
tree2668603d9deb872ea71a7ca319639a68f81e0b0a /chrome
parent451bbe386a9fc28d4ea7c43277fce65248edba20 (diff)
downloadchromium_src-715af7e54de3111942c62841a64c6f3584c93877.zip
chromium_src-715af7e54de3111942c62841a64c6f3584c93877.tar.gz
chromium_src-715af7e54de3111942c62841a64c6f3584c93877.tar.bz2
Nukes one of the AddTabWithURL variants.
BUG=none TEST=none Review URL: http://codereview.chromium.org/1736022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45902 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete/autocomplete_browsertest.cc5
-rw-r--r--chrome/browser/automation/automation_provider.cc6
-rw-r--r--chrome/browser/browser.cc50
-rw-r--r--chrome/browser/browser.h17
-rw-r--r--chrome/browser/browser_browsertest.cc4
-rw-r--r--chrome/browser/browser_focus_uitest.cc10
-rw-r--r--chrome/browser/browser_init.cc2
-rw-r--r--chrome/browser/browser_unittest.cc15
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm5
-rw-r--r--chrome/browser/dom_ui/filebrowse_ui.cc8
-rw-r--r--chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc4
-rw-r--r--chrome/browser/dom_ui/mediaplayer_ui.cc4
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc8
-rw-r--r--chrome/browser/find_bar_host_browsertest.cc20
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc4
-rw-r--r--chrome/browser/importer/importer.cc4
-rw-r--r--chrome/browser/sessions/session_restore.cc6
-rw-r--r--chrome/browser/ssl/ssl_browser_tests.cc14
-rw-r--r--chrome/browser/task_manager_browsertest.cc8
-rw-r--r--chrome/browser/views/app_launcher.cc13
-rw-r--r--chrome/browser/views/find_bar_host_interactive_uitest.cc4
-rw-r--r--chrome/test/browser_with_test_window_test.cc6
-rw-r--r--chrome/test/in_process_browser_test.cc3
23 files changed, 110 insertions, 110 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc
index ba77285..742d6d6 100644
--- a/chrome/browser/autocomplete/autocomplete_browsertest.cc
+++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc
@@ -134,8 +134,9 @@ IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, TabAwayRevertSelect) {
EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL),
location_bar->location_entry()->GetText());
location_bar->location_entry()->SetUserText(L"");
- browser()->AddTabWithURL(GURL(chrome::kAboutBlankURL), GURL(),
- PageTransition::START_PAGE, true, -1, false, NULL);
+ browser()->AddTabWithURL(
+ GURL(chrome::kAboutBlankURL), GURL(), PageTransition::START_PAGE,
+ -1, Browser::ADD_SELECTED, NULL, std::string());
ui_test_utils::WaitForNavigation(
&browser()->GetSelectedTabContents()->controller());
EXPECT_EQ(UTF8ToWide(chrome::kAboutBlankURL),
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 04bb3d3..7aec832 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -593,9 +593,9 @@ void AutomationProvider::AppendTab(int handle, const GURL& url,
if (browser_tracker_->ContainsHandle(handle)) {
Browser* browser = browser_tracker_->GetResource(handle);
observer = AddTabStripObserver(browser, reply_message);
- TabContents* tab_contents = browser->AddTabWithURL(url, GURL(),
- PageTransition::TYPED,
- true, -1, false, NULL);
+ TabContents* tab_contents = browser->AddTabWithURL(
+ url, GURL(), PageTransition::TYPED, -1, Browser::ADD_SELECTED, NULL,
+ std::string());
if (tab_contents) {
append_tab_response =
GetIndexForNavigationController(&tab_contents->controller(), browser);
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index d06f748..efb6f1a 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -379,8 +379,9 @@ void Browser::OpenURLOffTheRecord(Profile* profile, const GURL& url) {
if (!browser)
browser = Browser::Create(off_the_record_profile);
// TODO(eroman): should we have referrer here?
- browser->AddTabWithURL(url, GURL(), PageTransition::LINK, true, -1, false,
- NULL);
+ browser->AddTabWithURL(
+ url, GURL(), PageTransition::LINK, -1, Browser::ADD_SELECTED, NULL,
+ std::string());
browser->window()->Show();
}
@@ -443,8 +444,8 @@ TabContents* Browser::OpenApplicationWindow(
Browser* browser = Browser::CreateForApp(app_name, extension, profile,
as_panel);
browser->AddTabWithURL(extension ? extension->GetFullLaunchURL() : url,
- GURL(), PageTransition::START_PAGE, true, -1,
- false, NULL);
+ GURL(), PageTransition::START_PAGE,
+ -1, Browser::ADD_SELECTED, NULL, std::string());
TabContents* tab_contents = browser->GetSelectedTabContents();
tab_contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
@@ -727,19 +728,6 @@ void Browser::InProgressDownloadResponse(bool cancel_downloads) {
////////////////////////////////////////////////////////////////////////////////
// Browser, Tab adding/showing functions:
-TabContents* Browser::AddTabWithURL(
- const GURL& url, const GURL& referrer, PageTransition::Type transition,
- bool foreground, int index, bool force_index,
- SiteInstance* instance) {
- int add_types = 0;
- if (force_index)
- add_types |= ADD_FORCE_INDEX;
- if (foreground)
- add_types |= ADD_SELECTED;
- return AddTabWithURL(url, referrer, transition, index, add_types, instance,
- std::string());
-}
-
TabContents* Browser::AddTabWithURL(const GURL& url,
const GURL& referrer,
PageTransition::Type transition,
@@ -905,8 +893,8 @@ void Browser::ShowSingletonTab(const GURL& url) {
}
// Otherwise, just create a new tab.
- AddTabWithURL(url, GURL(), PageTransition::AUTO_BOOKMARK, true, -1,
- false, NULL);
+ AddTabWithURL(url, GURL(), PageTransition::AUTO_BOOKMARK,
+ -1, Browser::ADD_SELECTED, NULL, std::string());
}
void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) {
@@ -1594,8 +1582,8 @@ void Browser::OpenAboutChromeDialog() {
void Browser::OpenHelpTab() {
GURL help_url = google_util::AppendGoogleLocaleParam(GURL(kHelpContentUrl));
- AddTabWithURL(help_url, GURL(), PageTransition::AUTO_BOOKMARK, true, -1,
- false, NULL);
+ AddTabWithURL(help_url, GURL(), PageTransition::AUTO_BOOKMARK,
+ -1, Browser::ADD_SELECTED, NULL, std::string());
}
void Browser::OpenThemeGalleryTabAndActivate() {
@@ -1930,8 +1918,10 @@ TabContents* Browser::AddBlankTabAt(int index, bool foreground) {
// TabContents, but we want to include the time it takes to create the
// TabContents object too.
base::TimeTicks new_tab_start_time = base::TimeTicks::Now();
- TabContents* tab_contents = AddTabWithURL(GURL(chrome::kChromeUINewTabURL),
- GURL(), PageTransition::TYPED, foreground, index, false, NULL);
+ TabContents* tab_contents = AddTabWithURL(
+ GURL(chrome::kChromeUINewTabURL), GURL(), PageTransition::TYPED, index,
+ foreground ? Browser::ADD_SELECTED : Browser::ADD_NONE, NULL,
+ std::string());
tab_contents->set_new_tab_start_time(new_tab_start_time);
return tab_contents;
}
@@ -3411,8 +3401,10 @@ void Browser::OpenURLAtIndex(TabContents* source,
return;
} else if (disposition == NEW_WINDOW) {
Browser* browser = Browser::Create(profile_);
- new_contents = browser->AddTabWithURL(url, referrer, transition, true,
- index, force_index, instance);
+ int add_types = force_index ? Browser::ADD_FORCE_INDEX : Browser::ADD_NONE;
+ add_types |= Browser::ADD_SELECTED;
+ new_contents = browser->AddTabWithURL(url, referrer, transition, index,
+ add_types, instance, std::string());
browser->window()->Show();
} else if ((disposition == CURRENT_TAB) && current_tab) {
tabstrip_model_.TabNavigating(current_tab, transition);
@@ -3444,8 +3436,12 @@ void Browser::OpenURLAtIndex(TabContents* source,
OpenURLOffTheRecord(profile_, url);
return;
} else if (disposition != SUPPRESS_OPEN) {
- new_contents = AddTabWithURL(url, referrer, transition,
- disposition != NEW_BACKGROUND_TAB, index, force_index, instance);
+ int add_types = disposition != NEW_BACKGROUND_TAB ?
+ Browser::ADD_SELECTED : Browser::ADD_NONE;
+ if (force_index)
+ add_types |= Browser::ADD_FORCE_INDEX;
+ new_contents = AddTabWithURL(url, referrer, transition, index, add_types,
+ instance, std::string());
}
if (disposition != NEW_BACKGROUND_TAB && source_tab_was_frontmost &&
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 2604fa3..15123da 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -102,6 +102,10 @@ class Browser : public TabStripModelDelegate,
// Constants passed to AddTabWithURL.
enum AddTabTypes {
+ // Used to indicate nothing special should happen to the newly inserted
+ // tab.
+ ADD_NONE = 0,
+
// The tab should be selected.
ADD_SELECTED = 1 << 0,
@@ -316,19 +320,6 @@ class Browser : public TabStripModelDelegate,
// Tab adding/showing functions /////////////////////////////////////////////
- // Add a new tab with the specified URL. If instance is not null, its process
- // will be used to render the tab. |force_index| is passed through to
- // TabStripModel::AddTabContents and its meaning is documented with its
- // declaration.
- // TODO(sky): nuke this and convert callers to new AddTablWithURL variant.
- TabContents* AddTabWithURL(const GURL& url,
- const GURL& referrer,
- PageTransition::Type transition,
- bool foreground,
- int index,
- bool force_index,
- SiteInstance* instance);
-
// Adds a new tab at the specified index. |add_types| is a bitmask of the
// values defined by AddTabTypes; see AddTabTypes for details. If |instance|
// is not null, its process will be used to render the tab. If
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index ff2b40e..d09be56 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -204,7 +204,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_JavascriptAlertActivatesTab) {
FilePath(kTitle1File)));
ui_test_utils::NavigateToURL(browser(), url);
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED,
- true, 0, false, NULL);
+ 0, Browser::ADD_SELECTED, NULL, std::string());
EXPECT_EQ(2, browser()->tab_count());
EXPECT_EQ(0, browser()->selected_index());
TabContents* second_tab = browser()->GetTabContentsAt(1);
@@ -228,7 +228,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ThirtyFourTabs) {
// There is one initial tab.
for (int ix = 0; ix != 33; ++ix) {
browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED,
- true, 0, false, NULL);
+ 0, Browser::ADD_SELECTED, NULL, std::string());
}
EXPECT_EQ(34, browser()->tab_count());
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 77008e8..d6a1d28 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -260,8 +260,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocus) {
// Create several tabs.
for (int i = 0; i < 4; ++i) {
- browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
- false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
}
// Alternate focus for the tab.
@@ -341,8 +341,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) {
browser()->FocusLocationBar();
// Create a 2nd tab.
- browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
- false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED,
+ -1, Browser::ADD_SELECTED, NULL, std::string());
// Focus should be on the recently opened tab page.
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
@@ -724,7 +724,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabInitialFocus) {
// Open about:blank, focus should be on the location bar.
browser()->AddTabWithURL(GURL("about:blank"), GURL(), PageTransition::LINK,
- true, -1, false, NULL);
+ -1, Browser::ADD_SELECTED, NULL, std::string());
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
}
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index 93a5ba5..df87771 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -725,7 +725,7 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser(
if (!process_startup && !URLRequest::IsHandledURL(tabs[i].url))
continue;
- int add_types = first_tab ? Browser::ADD_SELECTED : 0;
+ int add_types = first_tab ? Browser::ADD_SELECTED : Browser::ADD_NONE;
if (tabs[i].is_pinned)
add_types |= Browser::ADD_PINNED;
diff --git a/chrome/browser/browser_unittest.cc b/chrome/browser/browser_unittest.cc
index 4a3db43..d388eb0 100644
--- a/chrome/browser/browser_unittest.cc
+++ b/chrome/browser/browser_unittest.cc
@@ -37,8 +37,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NoTabsInPopups) {
EXPECT_EQ(1, popup_browser->tab_count());
// Now try opening another tab in the popup browser.
- popup_browser->AddTabWithURL(GURL(chrome::kAboutBlankURL), GURL(),
- PageTransition::TYPED, true, -1, NULL);
+ popup_browser->AddTabWithURL(
+ GURL(chrome::kAboutBlankURL), GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
// The popup should still only have one tab.
EXPECT_EQ(1, popup_browser->tab_count());
@@ -53,8 +54,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NoTabsInPopups) {
EXPECT_EQ(1, app_browser->tab_count());
// Now try opening another tab in the app browser.
- app_browser->AddTabWithURL(GURL(chrome::kAboutBlankURL), GURL(),
- PageTransition::TYPED, true, -1, NULL);
+ app_browser->AddTabWithURL(
+ GURL(chrome::kAboutBlankURL), GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
// The popup should still only have one tab.
EXPECT_EQ(1, app_browser->tab_count());
@@ -69,8 +71,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NoTabsInPopups) {
EXPECT_EQ(1, app_popup_browser->tab_count());
// Now try opening another tab in the app popup browser.
- app_popup_browser->AddTabWithURL(GURL(chrome::kAboutBlankURL), GURL(),
- PageTransition::TYPED, true, -1, NULL);
+ app_popup_browser->AddTabWithURL(
+ GURL(chrome::kAboutBlankURL), GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
// The popup should still only have one tab.
EXPECT_EQ(1, app_popup_browser->tab_count());
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index 0a0386b..0563ebd 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -1572,8 +1572,9 @@ private:
case NEW_FOREGROUND_TAB:
UserMetrics::RecordAction(UserMetricsAction("Tab_DropURLBetweenTabs"),
browser_->profile());
- browser_->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, index,
- true, NULL);
+ browser_->AddTabWithURL(url, GURL(), PageTransition::TYPED, index,
+ Browser::ADD_SELECTED | Browser::ADD_FORCE_INDEX,
+ NULL, std::string());
break;
case CURRENT_TAB:
UserMetrics::RecordAction(UserMetricsAction("Tab_DropURLOnTab"),
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc
index 7730e6c..39e4474 100644
--- a/chrome/browser/dom_ui/filebrowse_ui.cc
+++ b/chrome/browser/dom_ui/filebrowse_ui.cc
@@ -644,8 +644,8 @@ void FilebrowseHandler::OpenNewWindow(const Value* value, bool popup) {
browser = BrowserList::GetLastActive();
}
browser->AddTabWithURL(
- GURL(path), GURL(), PageTransition::LINK,
- true, -1, false, NULL);
+ GURL(path), GURL(), PageTransition::LINK, -1, Browser::ADD_SELECTED,
+ NULL, std::string());
if (popup) {
// TODO(dhg): Remove these from being hardcoded. Allow javascript
// to specify.
@@ -975,8 +975,8 @@ Browser* FileBrowseUI::OpenPopup(Profile* profile,
}
browser->AddTabWithURL(
- GURL(url), GURL(), PageTransition::LINK,
- true, -1, false, NULL);
+ GURL(url), GURL(), PageTransition::LINK, -1, Browser::ADD_SELECTED,
+ NULL, std::string());
browser->window()->SetBounds(gfx::Rect(kPopupLeft,
kPopupTop,
width,
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 411982c..6864386 100644
--- a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
+++ b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
@@ -41,8 +41,8 @@ void HtmlDialogTabContentsDelegate::OpenURLFromTab(
// Browser::OpenURLFromTab() with disposition == NEW_WINDOW.
Browser* browser = CreateBrowser();
TabContents* new_contents =
- browser->AddTabWithURL(url, referrer, transition, true, -1, false,
- NULL);
+ browser->AddTabWithURL(url, referrer, transition, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
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 12421e5..c5f9891 100644
--- a/chrome/browser/dom_ui/mediaplayer_ui.cc
+++ b/chrome/browser/dom_ui/mediaplayer_ui.cc
@@ -475,7 +475,7 @@ void MediaPlayer::PopupPlaylist() {
playlist_browser_ = Browser::CreateForPopup(profile);
playlist_browser_->AddTabWithURL(
GURL(kMediaplayerPlaylistURL), GURL(), PageTransition::LINK,
- true, -1, false, NULL);
+ -1, Browser::ADD_SELECTED, NULL, std::string());
playlist_browser_->window()->SetBounds(gfx::Rect(kPopupLeft,
kPopupTop,
kPopupWidth,
@@ -494,7 +494,7 @@ void MediaPlayer::PopupMediaPlayer() {
mediaplayer_browser_ = Browser::CreateForPopup(profile);
mediaplayer_browser_->AddTabWithURL(
GURL(kMediaplayerURL), GURL(), PageTransition::LINK,
- true, -1, false, NULL);
+ -1, Browser::ADD_SELECTED, NULL, std::string());
mediaplayer_browser_->window()->SetBounds(gfx::Rect(kPopupLeft,
kPopupTop,
kPopupWidth,
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index 46e0e89..6a9c86b 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -389,8 +389,8 @@ bool CreateWindowFunction::RunImpl() {
Browser* new_window = new Browser(window_type, window_profile);
new_window->CreateBrowserWindow();
- new_window->AddTabWithURL(url, GURL(), PageTransition::LINK, true,
- -1, false, NULL);
+ new_window->AddTabWithURL(url, GURL(), PageTransition::LINK, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
new_window->window()->SetBounds(bounds);
new_window->window()->Show();
@@ -591,8 +591,10 @@ bool CreateTabFunction::RunImpl() {
index = tab_strip->count();
}
+ int add_types = selected ? Browser::ADD_SELECTED : Browser::ADD_NONE;
+ add_types |= Browser::ADD_FORCE_INDEX;
TabContents* contents = browser->AddTabWithURL(url, GURL(),
- PageTransition::LINK, selected, index, true, NULL);
+ PageTransition::LINK, index, add_types, NULL, std::string());
index = tab_strip->GetIndexOfTabContents(contents);
browser->window()->Show();
diff --git a/chrome/browser/find_bar_host_browsertest.cc b/chrome/browser/find_bar_host_browsertest.cc
index 8ac5a6c..d11794e 100644
--- a/chrome/browser/find_bar_host_browsertest.cc
+++ b/chrome/browser/find_bar_host_browsertest.cc
@@ -842,8 +842,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) {
EXPECT_EQ(1, FindInPageWchar(tab1, L"Default", kFwd, kIgnoreCase, &ordinal));
// Create a second tab.
- browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
- false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
browser()->SelectTabContentsAt(1, false);
TabContents* tab2 = browser()->GetSelectedTabContents();
EXPECT_NE(tab1, tab2);
@@ -919,8 +919,8 @@ 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()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
- false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
browser()->SelectTabContentsAt(1, false);
TabContents* tab2 = browser()->GetSelectedTabContents();
EXPECT_NE(tab1, tab2);
@@ -964,8 +964,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) {
FindBarController::kKeepSelection);
// Now create a second tab and load the same page.
- browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
- false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
browser()->SelectTabContentsAt(1, false);
TabContents* tab2 = browser()->GetSelectedTabContents();
EXPECT_NE(tab1, tab2);
@@ -1038,8 +1038,8 @@ 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);
- incognito_browser->AddTabWithURL(url, GURL(), PageTransition::START_PAGE,
- true, -1, false, NULL);
+ incognito_browser->AddTabWithURL(url, GURL(), PageTransition::START_PAGE, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
ui_test_utils::WaitForNavigation(
&incognito_browser->GetSelectedTabContents()->controller());
incognito_browser->window()->Show();
@@ -1059,8 +1059,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
FindBarController::kKeepSelection);
// Now open a new tab in the original (non-incognito) browser.
- browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
- false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
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 a3ef797..7b0f1f2 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc
@@ -37,8 +37,8 @@ IN_PROC_BROWSER_TEST_F(BookmarkBarGtkBrowserTest, FindBarTest) {
// Create new tab with an arbitrary URL.
GURL url = server->TestServerPageW(kSimplePage);
- browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
- false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
// 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 27ba58a..e08ecba 100644
--- a/chrome/browser/importer/importer.cc
+++ b/chrome/browser/importer/importer.cc
@@ -556,8 +556,8 @@ void ImporterHost::StartImportSettings(
BrowsingInstance* instance = new BrowsingInstance(writer_->GetProfile());
SiteInstance* site = instance->GetSiteInstanceForURL(url);
Browser* browser = BrowserList::GetLastActive();
- browser->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
- false, site);
+ browser->AddTabWithURL(url, GURL(), PageTransition::TYPED,
+ -1, Browser::ADD_SELECTED, site, std::string());
MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
this, &ImporterHost::OnLockViewEnd, false));
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index bd9ad1c..bcc9f98 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -431,8 +431,10 @@ class SessionRestoreImpl : public NotificationObserver {
void AppendURLsToBrowser(Browser* browser,
const std::vector<GURL>& urls) {
for (size_t i = 0; i < urls.size(); ++i) {
- browser->AddTabWithURL(urls[i], GURL(), PageTransition::START_PAGE,
- (i == 0), -1, false, NULL);
+ browser->AddTabWithURL(
+ urls[i], GURL(), PageTransition::START_PAGE, -1,
+ (i == 0) ? Browser::ADD_SELECTED : Browser::ADD_NONE, NULL,
+ std::string());
}
}
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index 5d6ba7b..d158ac2 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -489,10 +489,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestMixedContentsTwoTabs) {
// Create a new tab.
GURL url =
https_server->TestServerPageW(L"files/ssl/page_with_http_script.html");
- TabContents* tab2 = browser()->AddTabWithURL(url,
- GURL(),
- PageTransition::TYPED, true, 0,
- false, NULL);
+ TabContents* tab2 = browser()->AddTabWithURL(
+ url, GURL(), PageTransition::TYPED, 0, Browser::ADD_SELECTED,
+ NULL, std::string());
ui_test_utils::WaitForNavigation(&(tab2->controller()));
// The new tab has mixed content.
@@ -626,10 +625,9 @@ 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->TestServerPageW(L"files/ssl/google.html");
- TabContents* tab2 = browser()->AddTabWithURL(url,
- GURL(),
- PageTransition::TYPED,
- true, 0, false, NULL);
+ TabContents* tab2 = browser()->AddTabWithURL(
+ url, GURL(), PageTransition::TYPED, 0, Browser::ADD_SELECTED, NULL,
+ std::string());
ui_test_utils::WaitForNavigation(&(tab2->controller()));
// Close the first tab.
diff --git a/chrome/browser/task_manager_browsertest.cc b/chrome/browser/task_manager_browsertest.cc
index 08d5490..392d77c 100644
--- a/chrome/browser/task_manager_browsertest.cc
+++ b/chrome/browser/task_manager_browsertest.cc
@@ -93,8 +93,8 @@ 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()->AddTabWithURL(url, GURL(), PageTransition::TYPED,
- true, 0, false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, 0,
+ Browser::ADD_SELECTED, NULL, std::string());
WaitForResourceChange(3);
// Close the tab and verify that we notice.
@@ -239,8 +239,8 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest,
// Open a new tab and make sure we notice that.
GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory),
FilePath(kTitle1File)));
- browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED,
- true, 0, false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, 0,
+ Browser::ADD_SELECTED, NULL, std::string());
WaitForResourceChange(3);
// Check that we get some value for the cache columns.
diff --git a/chrome/browser/views/app_launcher.cc b/chrome/browser/views/app_launcher.cc
index 7cea6af..240a926 100644
--- a/chrome/browser/views/app_launcher.cc
+++ b/chrome/browser/views/app_launcher.cc
@@ -392,8 +392,9 @@ void AppLauncher::AddTabWithURL(const GURL& url,
case chromeos::StatusAreaView::OPEN_TABS_ON_LEFT: {
// Add the new tab at the first non-pinned location.
int index = browser_->tabstrip_model()->IndexOfFirstNonMiniTab();
- browser_->AddTabWithURL(url, GURL(), transition,
- true, index, true, NULL);
+ browser_->AddTabWithURL(url, GURL(), transition, index,
+ Browser::ADD_SELECTED | Browser::ADD_FORCE_INDEX,
+ NULL, std::string());
break;
}
case chromeos::StatusAreaView::OPEN_TABS_CLOBBER: {
@@ -402,11 +403,15 @@ void AppLauncher::AddTabWithURL(const GURL& url,
break;
}
case chromeos::StatusAreaView::OPEN_TABS_ON_RIGHT: {
- browser_->AddTabWithURL(url, GURL(), transition, true, -1, true, NULL);
+ browser_->AddTabWithURL(url, GURL(), transition, -1,
+ Browser::ADD_SELECTED | Browser::ADD_FORCE_INDEX,
+ NULL, std::string());
break;
}
}
#else
- browser_->AddTabWithURL(url, GURL(), transition, true, -1, true, NULL);
+ browser_->AddTabWithURL(url, GURL(), transition, -1,
+ Browser::ADD_SELECTED | Browser::ADD_FORCE_INDEX,
+ NULL, std::string());
#endif
}
diff --git a/chrome/browser/views/find_bar_host_interactive_uitest.cc b/chrome/browser/views/find_bar_host_interactive_uitest.cc
index e0819e6..f4e9b27 100644
--- a/chrome/browser/views/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/views/find_bar_host_interactive_uitest.cc
@@ -92,8 +92,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) {
browser()->Find();
// Open another tab (tab B).
- browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
- false, NULL);
+ browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
browser()->Find();
EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, GetFocusedViewID());
diff --git a/chrome/test/browser_with_test_window_test.cc b/chrome/test/browser_with_test_window_test.cc
index 85c77e0..d1b6c49 100644
--- a/chrome/test/browser_with_test_window_test.cc
+++ b/chrome/test/browser_with_test_window_test.cc
@@ -56,9 +56,9 @@ TestRenderViewHost* BrowserWithTestWindowTest::TestRenderViewHostForTab(
}
void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) {
- TabContents* new_tab = browser->AddTabWithURL(url, GURL(),
- PageTransition::TYPED, true,
- 0, false, NULL);
+ TabContents* new_tab = browser->AddTabWithURL(
+ url, GURL(), PageTransition::TYPED, 0, Browser::ADD_SELECTED, NULL,
+ std::string());
CommitPendingLoad(&new_tab->controller());
}
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 2e8006a..451dd2e 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -242,7 +242,8 @@ Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) {
Browser* browser = Browser::Create(profile);
browser->AddTabWithURL(GURL(chrome::kAboutBlankURL), GURL(),
- PageTransition::START_PAGE, true, -1, false, NULL);
+ PageTransition::START_PAGE, -1,
+ Browser::ADD_SELECTED, NULL, std::string());
// Wait for the page to finish loading.
ui_test_utils::WaitForNavigation(