Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5707)

Unified Diff: chrome/browser/ui/browser_tabstrip.cc

Issue 10696148: Move TabStripModelDelegate off Browser into its own class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_tabstrip.h ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_tabstrip.cc
===================================================================
--- chrome/browser/ui/browser_tabstrip.cc (revision 145765)
+++ chrome/browser/ui/browser_tabstrip.cc (working copy)
@@ -13,6 +13,7 @@
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/url_constants.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
@@ -46,6 +47,25 @@
browser->tab_strip_model()->ActivateTabAt(index, user_gesture);
}
+TabContents* AddBlankTab(Browser* browser, bool foreground) {
+ return AddBlankTabAt(browser, -1, foreground);
+}
+
+TabContents* AddBlankTabAt(Browser* browser, int index, bool foreground) {
+ // Time new tab page creation time. We keep track of the timing data in
+ // WebContents, but we want to include the time it takes to create the
+ // WebContents object too.
+ base::TimeTicks new_tab_start_time = base::TimeTicks::Now();
+ chrome::NavigateParams params(browser, GURL(chrome::kChromeUINewTabURL),
+ content::PAGE_TRANSITION_TYPED);
+ params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
+ params.tabstrip_index = index;
+ chrome::Navigate(&params);
+ params.target_contents->web_contents()->SetNewTabStartTime(
+ new_tab_start_time);
+ return params.target_contents;
+}
+
bool IsTabStripEditable(Browser* browser) {
return browser->window()->IsTabStripEditable();
}
« no previous file with comments | « chrome/browser/ui/browser_tabstrip.h ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698