| OLD | NEW |
| 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/blocked_content/blocked_content_tab_helper.h" | 9 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 content::WebContents* GetWebContentsAt(const Browser* browser, int index) { | 49 content::WebContents* GetWebContentsAt(const Browser* browser, int index) { |
| 50 TabContents* tab = GetTabContentsAt(browser, index); | 50 TabContents* tab = GetTabContentsAt(browser, index); |
| 51 return tab ? tab->web_contents() : NULL; | 51 return tab ? tab->web_contents() : NULL; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void ActivateTabAt(Browser* browser, int index, bool user_gesture) { | 54 void ActivateTabAt(Browser* browser, int index, bool user_gesture) { |
| 55 browser->tab_strip_model()->ActivateTabAt(index, user_gesture); | 55 browser->tab_strip_model()->ActivateTabAt(index, user_gesture); |
| 56 } | 56 } |
| 57 | 57 |
| 58 TabContents* AddBlankTab(Browser* browser, bool foreground) { | 58 void AddBlankTabAt(Browser* browser, int index, bool foreground) { |
| 59 return AddBlankTabAt(browser, -1, foreground); | |
| 60 } | |
| 61 | |
| 62 TabContents* AddBlankTabAt(Browser* browser, int index, bool foreground) { | |
| 63 // Time new tab page creation time. We keep track of the timing data in | 59 // Time new tab page creation time. We keep track of the timing data in |
| 64 // WebContents, but we want to include the time it takes to create the | 60 // WebContents, but we want to include the time it takes to create the |
| 65 // WebContents object too. | 61 // WebContents object too. |
| 66 base::TimeTicks new_tab_start_time = base::TimeTicks::Now(); | 62 base::TimeTicks new_tab_start_time = base::TimeTicks::Now(); |
| 67 chrome::NavigateParams params(browser, GURL(chrome::kChromeUINewTabURL), | 63 chrome::NavigateParams params(browser, GURL(chrome::kChromeUINewTabURL), |
| 68 content::PAGE_TRANSITION_TYPED); | 64 content::PAGE_TRANSITION_TYPED); |
| 69 params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; | 65 params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; |
| 70 params.tabstrip_index = index; | 66 params.tabstrip_index = index; |
| 71 chrome::Navigate(¶ms); | 67 chrome::Navigate(¶ms); |
| 72 params.target_contents->web_contents()->SetNewTabStartTime( | 68 params.target_contents->web_contents()->SetNewTabStartTime( |
| 73 new_tab_start_time); | 69 new_tab_start_time); |
| 74 return params.target_contents; | |
| 75 } | 70 } |
| 76 | 71 |
| 77 bool IsTabStripEditable(Browser* browser) { | 72 bool IsTabStripEditable(Browser* browser) { |
| 78 return browser->window()->IsTabStripEditable(); | 73 return browser->window()->IsTabStripEditable(); |
| 79 } | 74 } |
| 80 | 75 |
| 81 TabContents* AddSelectedTabWithURL(Browser* browser, | 76 TabContents* AddSelectedTabWithURL(Browser* browser, |
| 82 const GURL& url, | 77 const GURL& url, |
| 83 content::PageTransition transition) { | 78 content::PageTransition transition) { |
| 84 NavigateParams params(browser, url, transition); | 79 NavigateParams params(browser, url, transition); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 return BrowserTabstripTabContentsCreator::CreateTabContents( | 187 return BrowserTabstripTabContentsCreator::CreateTabContents( |
| 193 content::WebContents::CreateWithSessionStorage( | 188 content::WebContents::CreateWithSessionStorage( |
| 194 profile, | 189 profile, |
| 195 site_instance, | 190 site_instance, |
| 196 routing_id, | 191 routing_id, |
| 197 base_web_contents, | 192 base_web_contents, |
| 198 session_storage_namespace_map)); | 193 session_storage_namespace_map)); |
| 199 } | 194 } |
| 200 | 195 |
| 201 } // namespace chrome | 196 } // namespace chrome |
| OLD | NEW |