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