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

Side by Side Diff: chrome/browser/ui/browser_tabstrip.cc

Issue 74133003: linux-aura: Restore middle-click on new-tab button behaviour. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-nit Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser_tabstrip.h" 5 #include "chrome/browser/ui/browser_tabstrip.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_navigator.h" 10 #include "chrome/browser/ui/browser_navigator.h"
11 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 11 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
15 #include "content/public/browser/navigation_entry.h" 15 #include "content/public/browser/navigation_entry.h"
16 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 18
19 namespace chrome { 19 namespace chrome {
20 20
21 void AddBlankTabAt(Browser* browser, int index, bool foreground) { 21 void AddURLTabAt(Browser* browser, const GURL& url, int idx, bool foreground) {
22 // Time new tab page creation time. We keep track of the timing data in 22 // Time new tab page creation time. We keep track of the timing data in
23 // WebContents, but we want to include the time it takes to create the 23 // WebContents, but we want to include the time it takes to create the
24 // WebContents object too. 24 // WebContents object too.
25 base::TimeTicks new_tab_start_time = base::TimeTicks::Now(); 25 base::TimeTicks new_tab_start_time = base::TimeTicks::Now();
26 chrome::NavigateParams params(browser, GURL(chrome::kChromeUINewTabURL), 26 chrome::NavigateParams params(browser,
27 content::PAGE_TRANSITION_TYPED); 27 url.is_empty() ? GURL(chrome::kChromeUINewTabURL) : url,
28 content::PAGE_TRANSITION_TYPED);
28 params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; 29 params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
29 params.tabstrip_index = index; 30 params.tabstrip_index = idx;
30 chrome::Navigate(&params); 31 chrome::Navigate(&params);
31 CoreTabHelper* core_tab_helper = 32 CoreTabHelper* core_tab_helper =
32 CoreTabHelper::FromWebContents(params.target_contents); 33 CoreTabHelper::FromWebContents(params.target_contents);
33 core_tab_helper->set_new_tab_start_time(new_tab_start_time); 34 core_tab_helper->set_new_tab_start_time(new_tab_start_time);
34 } 35 }
35 36
37 void AddBlankTabAt(Browser* browser, int index, bool foreground) {
38 AddURLTabAt(browser, GURL(), index, foreground);
39 }
40
36 content::WebContents* AddSelectedTabWithURL( 41 content::WebContents* AddSelectedTabWithURL(
37 Browser* browser, 42 Browser* browser,
38 const GURL& url, 43 const GURL& url,
39 content::PageTransition transition) { 44 content::PageTransition transition) {
40 NavigateParams params(browser, url, transition); 45 NavigateParams params(browser, url, transition);
41 params.disposition = NEW_FOREGROUND_TAB; 46 params.disposition = NEW_FOREGROUND_TAB;
42 Navigate(&params); 47 Navigate(&params);
43 return params.target_contents; 48 return params.target_contents;
44 } 49 }
45 50
(...skipping 30 matching lines...) Expand all
76 return; 81 return;
77 } 82 }
78 83
79 browser->tab_strip_model()->CloseWebContentsAt( 84 browser->tab_strip_model()->CloseWebContentsAt(
80 index, 85 index,
81 add_to_history ? TabStripModel::CLOSE_CREATE_HISTORICAL_TAB 86 add_to_history ? TabStripModel::CLOSE_CREATE_HISTORICAL_TAB
82 : TabStripModel::CLOSE_NONE); 87 : TabStripModel::CLOSE_NONE);
83 } 88 }
84 89
85 } // namespace chrome 90 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_tabstrip.h ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698