| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 void AddBlankTabAt(Browser* browser, int index, bool foreground) { | 58 void AddBlankTabAt(Browser* browser, int index, bool foreground) { |
| 59 // TODO(scottmg): http://crbug.com/128578 |
| 60 // This is necessary because WebContentsViewAura doesn't have enough context |
| 61 // to get the right StackingClient (and therefore parent window) otherwise. |
| 62 ScopedForceDesktopType force_desktop_type(browser->host_desktop_type()); |
| 63 |
| 59 // Time new tab page creation time. We keep track of the timing data in | 64 // Time new tab page creation time. We keep track of the timing data in |
| 60 // WebContents, but we want to include the time it takes to create the | 65 // WebContents, but we want to include the time it takes to create the |
| 61 // WebContents object too. | 66 // WebContents object too. |
| 62 base::TimeTicks new_tab_start_time = base::TimeTicks::Now(); | 67 base::TimeTicks new_tab_start_time = base::TimeTicks::Now(); |
| 63 chrome::NavigateParams params(browser, GURL(chrome::kChromeUINewTabURL), | 68 chrome::NavigateParams params(browser, GURL(chrome::kChromeUINewTabURL), |
| 64 content::PAGE_TRANSITION_TYPED); | 69 content::PAGE_TRANSITION_TYPED); |
| 65 params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; | 70 params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; |
| 66 params.tabstrip_index = index; | 71 params.tabstrip_index = index; |
| 67 chrome::Navigate(¶ms); | 72 chrome::Navigate(¶ms); |
| 68 params.target_contents->web_contents()->SetNewTabStartTime( | 73 params.target_contents->web_contents()->SetNewTabStartTime( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 return BrowserTabstripTabContentsCreator::CreateTabContents( | 192 return BrowserTabstripTabContentsCreator::CreateTabContents( |
| 188 content::WebContents::CreateWithSessionStorage( | 193 content::WebContents::CreateWithSessionStorage( |
| 189 profile, | 194 profile, |
| 190 site_instance, | 195 site_instance, |
| 191 routing_id, | 196 routing_id, |
| 192 base_web_contents, | 197 base_web_contents, |
| 193 session_storage_namespace_map)); | 198 session_storage_namespace_map)); |
| 194 } | 199 } |
| 195 | 200 |
| 196 } // namespace chrome | 201 } // namespace chrome |
| OLD | NEW |