| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 browser->tab_strip_model()->ActivateTabAt(index, user_gesture); | 46 browser->tab_strip_model()->ActivateTabAt(index, user_gesture); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool IsTabStripEditable(Browser* browser) { | 49 bool IsTabStripEditable(Browser* browser) { |
| 50 return browser->window()->IsTabStripEditable(); | 50 return browser->window()->IsTabStripEditable(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 TabContents* AddSelectedTabWithURL(Browser* browser, | 53 TabContents* AddSelectedTabWithURL(Browser* browser, |
| 54 const GURL& url, | 54 const GURL& url, |
| 55 content::PageTransition transition) { | 55 content::PageTransition transition) { |
| 56 browser::NavigateParams params(browser, url, transition); | 56 NavigateParams params(browser, url, transition); |
| 57 params.disposition = NEW_FOREGROUND_TAB; | 57 params.disposition = NEW_FOREGROUND_TAB; |
| 58 browser::Navigate(¶ms); | 58 Navigate(¶ms); |
| 59 return params.target_contents; | 59 return params.target_contents; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void AddTab(Browser* browser, | 62 void AddTab(Browser* browser, |
| 63 TabContents* tab_contents, | 63 TabContents* tab_contents, |
| 64 content::PageTransition type) { | 64 content::PageTransition type) { |
| 65 browser->tab_strip_model()->AddTabContents(tab_contents, -1, type, | 65 browser->tab_strip_model()->AddTabContents(tab_contents, -1, type, |
| 66 TabStripModel::ADD_ACTIVE); | 66 TabStripModel::ADD_ACTIVE); |
| 67 } | 67 } |
| 68 | 68 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Unrequested popups from normal pages are constrained unless they're in | 104 // Unrequested popups from normal pages are constrained unless they're in |
| 105 // the white list. The popup owner will handle checking this. | 105 // the white list. The popup owner will handle checking this. |
| 106 source_tab_contents->blocked_content_tab_helper()-> | 106 source_tab_contents->blocked_content_tab_helper()-> |
| 107 AddPopup(new_tab_contents, initial_pos, user_gesture); | 107 AddPopup(new_tab_contents, initial_pos, user_gesture); |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 | 110 |
| 111 new_contents->GetRenderViewHost()->DisassociateFromPopupCount(); | 111 new_contents->GetRenderViewHost()->DisassociateFromPopupCount(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 browser::NavigateParams params(browser, new_tab_contents); | 114 NavigateParams params(browser, new_tab_contents); |
| 115 params.source_contents = source_contents ? | 115 params.source_contents = source_contents ? |
| 116 GetTabContentsAt(browser, GetIndexOfTab(browser, source_contents)) : NULL; | 116 GetTabContentsAt(browser, GetIndexOfTab(browser, source_contents)) : NULL; |
| 117 params.disposition = disposition; | 117 params.disposition = disposition; |
| 118 params.window_bounds = initial_pos; | 118 params.window_bounds = initial_pos; |
| 119 params.window_action = browser::NavigateParams::SHOW_WINDOW; | 119 params.window_action = NavigateParams::SHOW_WINDOW; |
| 120 params.user_gesture = user_gesture; | 120 params.user_gesture = user_gesture; |
| 121 browser::Navigate(¶ms); | 121 Navigate(¶ms); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void CloseWebContents(Browser* browser, content::WebContents* contents) { | 124 void CloseWebContents(Browser* browser, content::WebContents* contents) { |
| 125 int index = browser->tab_strip_model()->GetIndexOfWebContents(contents); | 125 int index = browser->tab_strip_model()->GetIndexOfWebContents(contents); |
| 126 if (index == TabStripModel::kNoTab) { | 126 if (index == TabStripModel::kNoTab) { |
| 127 NOTREACHED() << "CloseWebContents called for tab not in our strip"; | 127 NOTREACHED() << "CloseWebContents called for tab not in our strip"; |
| 128 return; | 128 return; |
| 129 } | 129 } |
| 130 browser->tab_strip_model()->CloseTabContentsAt( | 130 browser->tab_strip_model()->CloseTabContentsAt( |
| 131 index, | 131 index, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 144 content::SessionStorageNamespace* session_storage_namespace) { | 144 content::SessionStorageNamespace* session_storage_namespace) { |
| 145 return new TabContents(content::WebContents::Create( | 145 return new TabContents(content::WebContents::Create( |
| 146 profile, | 146 profile, |
| 147 site_instance, | 147 site_instance, |
| 148 routing_id, | 148 routing_id, |
| 149 base_web_contents, | 149 base_web_contents, |
| 150 session_storage_namespace)); | 150 session_storage_namespace)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace chrome | 153 } // namespace chrome |
| OLD | NEW |