Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/extensions/extension_tab_util.cc

Issue 10692195: Consolidate Browser Creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
224 void ExtensionTabUtil::CreateTab(WebContents* web_contents, 224 void ExtensionTabUtil::CreateTab(WebContents* web_contents,
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 = Browser::Create(profile); 234 browser = new Browser(Browser::CreateParams(profile));
235 TabContents* tab_contents = new TabContents(web_contents); 235 TabContents* tab_contents = new TabContents(web_contents);
236 chrome::NavigateParams params(browser, tab_contents); 236 chrome::NavigateParams params(browser, tab_contents);
237 237
238 // The extension_app_id parameter ends up as app_name in the Browser 238 // 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 239 // which causes the Browser to return true for is_app(). This affects
240 // among other things, whether the location bar gets displayed. 240 // among other things, whether the location bar gets displayed.
241 // TODO(mpcomplete): This seems wrong. What if the extension content is hosted 241 // TODO(mpcomplete): This seems wrong. What if the extension content is hosted
242 // in a tab? 242 // in a tab?
243 if (disposition == NEW_POPUP) 243 if (disposition == NEW_POPUP)
244 params.extension_app_id = extension_id; 244 params.extension_app_id = extension_id;
(...skipping 18 matching lines...) Expand all
263 263
264 // static 264 // static
265 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab( 265 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab(
266 const WebContents* web_contents) { 266 const WebContents* web_contents) {
267 Browser* browser = browser::FindBrowserWithWebContents(web_contents); 267 Browser* browser = browser::FindBrowserWithWebContents(web_contents);
268 if (browser != NULL) 268 if (browser != NULL)
269 return browser->extension_window_controller(); 269 return browser->extension_window_controller();
270 270
271 return NULL; 271 return NULL;
272 } 272 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_ui_browsertest.cc ('k') | chrome/browser/managed_mode_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698