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/webui/chrome_web_contents_handler.h" | 5 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const gfx::Rect& initial_pos, | 75 const gfx::Rect& initial_pos, |
76 bool user_gesture) { | 76 bool user_gesture) { |
77 if (!context) | 77 if (!context) |
78 return; | 78 return; |
79 | 79 |
80 Profile* profile = Profile::FromBrowserContext(context); | 80 Profile* profile = Profile::FromBrowserContext(context); |
81 Browser* browser = browser::FindTabbedBrowser(profile, false); | 81 Browser* browser = browser::FindTabbedBrowser(profile, false); |
82 const bool browser_created = !browser; | 82 const bool browser_created = !browser; |
83 if (!browser) | 83 if (!browser) |
84 browser = new Browser(Browser::CreateParams(profile)); | 84 browser = new Browser(Browser::CreateParams(profile)); |
85 TabContents* tab_contents = new TabContents(new_contents); | 85 TabContents* tab_contents = |
| 86 TabContents::Factory::CreateTabContents(new_contents); |
86 chrome::NavigateParams params(browser, tab_contents); | 87 chrome::NavigateParams params(browser, tab_contents); |
87 // TODO(pinkerton): no way to get a TabContents for this. | 88 // TODO(pinkerton): no way to get a TabContents for this. |
88 // params.source_contents = source; | 89 // params.source_contents = source; |
89 params.disposition = disposition; | 90 params.disposition = disposition; |
90 params.window_bounds = initial_pos; | 91 params.window_bounds = initial_pos; |
91 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 92 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
92 params.user_gesture = true; | 93 params.user_gesture = true; |
93 chrome::Navigate(¶ms); | 94 chrome::Navigate(¶ms); |
94 | 95 |
95 // Close the browser if chrome::Navigate created a new one. | 96 // Close the browser if chrome::Navigate created a new one. |
96 if (browser_created && (browser != params.browser)) | 97 if (browser_created && (browser != params.browser)) |
97 browser->window()->Close(); | 98 browser->window()->Close(); |
98 } | 99 } |
OLD | NEW |