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/extensions/extension_tab_util.h" | 5 #include "chrome/browser/extensions/extension_tab_util.h" |
6 | 6 |
7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
8 #include "chrome/browser/extensions/tab_helper.h" | 8 #include "chrome/browser/extensions/tab_helper.h" |
9 #include "chrome/browser/extensions/window_controller.h" | 9 #include "chrome/browser/extensions/window_controller.h" |
10 #include "chrome/browser/net/url_fixer_upper.h" | 10 #include "chrome/browser/net/url_fixer_upper.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 fixed_url.host() == chrome::kChromeUICrashHost)); | 224 fixed_url.host() == chrome::kChromeUICrashHost)); |
225 } | 225 } |
226 | 226 |
227 void ExtensionTabUtil::CreateTab(WebContents* web_contents, | 227 void ExtensionTabUtil::CreateTab(WebContents* web_contents, |
228 const std::string& extension_id, | 228 const std::string& extension_id, |
229 WindowOpenDisposition disposition, | 229 WindowOpenDisposition disposition, |
230 const gfx::Rect& initial_pos, | 230 const gfx::Rect& initial_pos, |
231 bool user_gesture) { | 231 bool user_gesture) { |
232 Profile* profile = | 232 Profile* profile = |
233 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 233 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
234 Browser* browser = browser::FindTabbedBrowserDeprecated(profile, false); | 234 Browser* browser = browser::FindTabbedBrowser(profile, |
| 235 false, |
| 236 chrome::GetActiveDesktop()); |
235 const bool browser_created = !browser; | 237 const bool browser_created = !browser; |
236 if (!browser) | 238 if (!browser) |
237 browser = new Browser(Browser::CreateParams(profile)); | 239 browser = new Browser(Browser::CreateParams(profile)); |
238 TabContents* tab_contents = | 240 TabContents* tab_contents = |
239 TabContents::Factory::CreateTabContents(web_contents); | 241 TabContents::Factory::CreateTabContents(web_contents); |
240 chrome::NavigateParams params(browser, tab_contents); | 242 chrome::NavigateParams params(browser, tab_contents); |
241 | 243 |
242 // The extension_app_id parameter ends up as app_name in the Browser | 244 // The extension_app_id parameter ends up as app_name in the Browser |
243 // which causes the Browser to return true for is_app(). This affects | 245 // which causes the Browser to return true for is_app(). This affects |
244 // among other things, whether the location bar gets displayed. | 246 // among other things, whether the location bar gets displayed. |
(...skipping 22 matching lines...) Expand all Loading... |
267 | 269 |
268 // static | 270 // static |
269 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab( | 271 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab( |
270 const WebContents* web_contents) { | 272 const WebContents* web_contents) { |
271 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 273 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
272 if (browser != NULL) | 274 if (browser != NULL) |
273 return browser->extension_window_controller(); | 275 return browser->extension_window_controller(); |
274 | 276 |
275 return NULL; | 277 return NULL; |
276 } | 278 } |
OLD | NEW |