From 616381f0a55322de447465573e39612e5af18b31 Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Tue, 2 Nov 2010 15:15:33 +0000 Subject: Make all browser code use browser::Navigate to open tabs. BUG=none TEST=existing unittests. Also, test all places where new tabs and windows are opened from UI, e.g. links in options, new tab button, Ctrl+T, popup windows, etc. Review URL: http://codereview.chromium.org/3834002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64745 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/applescript/window_applescript.mm | 17 ++++++++++------- chrome/browser/cocoa/tab_strip_controller.mm | 10 ++++++---- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'chrome/browser/cocoa') diff --git a/chrome/browser/cocoa/applescript/window_applescript.mm b/chrome/browser/cocoa/applescript/window_applescript.mm index c51e9d8..07401d3 100644 --- a/chrome/browser/cocoa/applescript/window_applescript.mm +++ b/chrome/browser/cocoa/applescript/window_applescript.mm @@ -11,6 +11,7 @@ #import "chrome/browser/app_controller_mac.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" +#include "chrome/browser/browser_navigator.h" #include "chrome/browser/browser_window.h" #import "chrome/browser/chrome_browser_application_mac.h" #include "chrome/browser/cocoa/applescript/constants_applescript.h" @@ -185,13 +186,15 @@ // Set how long it takes a tab to be created. base::TimeTicks newTabStartTime = base::TimeTicks::Now(); - Browser::AddTabWithURLParams params(GURL(chrome::kChromeUINewTabURL), - PageTransition::TYPED); - params.index = index; - TabContents* contents = browser_->AddTabWithURL(¶ms); - contents->set_new_tab_start_time(newTabStartTime); - - [aTab setTabContent:contents]; + browser::NavigateParams params(browser_, + GURL(chrome::kChromeUINewTabURL), + PageTransition::TYPED); + params.disposition = NEW_FOREGROUND_TAB; + params.tabstrip_index = index; + browser::Navigate(¶ms); + params.target_contents->set_new_tab_start_time(newTabStartTime); + + [aTab setTabContent:params.target_contents]; } - (void)removeFromTabsAtIndex:(int)index { diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm index fab844b..e3d5a1d 100644 --- a/chrome/browser/cocoa/tab_strip_controller.mm +++ b/chrome/browser/cocoa/tab_strip_controller.mm @@ -16,6 +16,7 @@ #include "base/sys_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/browser.h" +#include "chrome/browser/browser_navigator.h" #include "chrome/browser/find_bar.h" #include "chrome/browser/find_bar_controller.h" #include "chrome/browser/metrics/user_metrics.h" @@ -1697,11 +1698,12 @@ private: case NEW_FOREGROUND_TAB: { UserMetrics::RecordAction(UserMetricsAction("Tab_DropURLBetweenTabs"), browser_->profile()); - Browser::AddTabWithURLParams params(url, PageTransition::TYPED); - params.index = index; - params.add_types = + browser::NavigateParams params(browser_, url, PageTransition::TYPED); + params.disposition = disposition; + params.tabstrip_index = index; + params.tabstrip_add_types = TabStripModel::ADD_SELECTED | TabStripModel::ADD_FORCE_INDEX; - browser_->AddTabWithURL(¶ms); + browser::Navigate(¶ms); break; } case CURRENT_TAB: -- cgit v1.1