| 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 } | 224 } |
| 225 | 225 |
| 226 void ExtensionTabUtil::CreateTab(WebContents* web_contents, | 226 void ExtensionTabUtil::CreateTab(WebContents* web_contents, |
| 227 const std::string& extension_id, | 227 const std::string& extension_id, |
| 228 WindowOpenDisposition disposition, | 228 WindowOpenDisposition disposition, |
| 229 const gfx::Rect& initial_pos, | 229 const gfx::Rect& initial_pos, |
| 230 bool user_gesture) { | 230 bool user_gesture) { |
| 231 Profile* profile = | 231 Profile* profile = |
| 232 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 232 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 233 chrome::HostDesktopType active_desktop = chrome::GetActiveDesktop(); | 233 chrome::HostDesktopType active_desktop = chrome::GetActiveDesktop(); |
| 234 Browser* browser = browser::FindTabbedBrowser(profile, | 234 Browser* browser = chrome::FindTabbedBrowser(profile, false, active_desktop); |
| 235 false, | |
| 236 active_desktop); | |
| 237 const bool browser_created = !browser; | 235 const bool browser_created = !browser; |
| 238 if (!browser) | 236 if (!browser) |
| 239 browser = new Browser(Browser::CreateParams(profile, active_desktop)); | 237 browser = new Browser(Browser::CreateParams(profile, active_desktop)); |
| 240 chrome::NavigateParams params(browser, web_contents); | 238 chrome::NavigateParams params(browser, web_contents); |
| 241 | 239 |
| 242 // The extension_app_id parameter ends up as app_name in the Browser | 240 // 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 | 241 // which causes the Browser to return true for is_app(). This affects |
| 244 // among other things, whether the location bar gets displayed. | 242 // among other things, whether the location bar gets displayed. |
| 245 // TODO(mpcomplete): This seems wrong. What if the extension content is hosted | 243 // TODO(mpcomplete): This seems wrong. What if the extension content is hosted |
| 246 // in a tab? | 244 // in a tab? |
| (...skipping 20 matching lines...) Expand all Loading... |
| 267 | 265 |
| 268 // static | 266 // static |
| 269 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab( | 267 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab( |
| 270 const WebContents* web_contents) { | 268 const WebContents* web_contents) { |
| 271 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 269 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 272 if (browser != NULL) | 270 if (browser != NULL) |
| 273 return browser->extension_window_controller(); | 271 return browser->extension_window_controller(); |
| 274 | 272 |
| 275 return NULL; | 273 return NULL; |
| 276 } | 274 } |
| OLD | NEW |