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 21 matching lines...) Expand all Loading... |
32 content::BrowserContext* context, | 32 content::BrowserContext* context, |
33 WebContents* source, | 33 WebContents* source, |
34 const OpenURLParams& params) { | 34 const OpenURLParams& params) { |
35 if (!context) | 35 if (!context) |
36 return NULL; | 36 return NULL; |
37 | 37 |
38 Profile* profile = Profile::FromBrowserContext(context); | 38 Profile* profile = Profile::FromBrowserContext(context); |
39 Browser* browser = browser::FindTabbedBrowser(profile, false); | 39 Browser* browser = browser::FindTabbedBrowser(profile, false); |
40 const bool browser_created = !browser; | 40 const bool browser_created = !browser; |
41 if (!browser) | 41 if (!browser) |
42 browser = Browser::Create(profile); | 42 browser = new Browser(Browser::CreateParams(profile)); |
43 chrome::NavigateParams nav_params(browser, params.url, params.transition); | 43 chrome::NavigateParams nav_params(browser, params.url, params.transition); |
44 nav_params.referrer = params.referrer; | 44 nav_params.referrer = params.referrer; |
45 if (source && source->IsCrashed() && | 45 if (source && source->IsCrashed() && |
46 params.disposition == CURRENT_TAB && | 46 params.disposition == CURRENT_TAB && |
47 params.transition == content::PAGE_TRANSITION_LINK) { | 47 params.transition == content::PAGE_TRANSITION_LINK) { |
48 nav_params.disposition = NEW_FOREGROUND_TAB; | 48 nav_params.disposition = NEW_FOREGROUND_TAB; |
49 } else { | 49 } else { |
50 nav_params.disposition = params.disposition; | 50 nav_params.disposition = params.disposition; |
51 } | 51 } |
52 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 52 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
(...skipping 21 matching lines...) Expand all Loading... |
74 WindowOpenDisposition disposition, | 74 WindowOpenDisposition disposition, |
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 = Browser::Create(profile); | 84 browser = new Browser(Browser::CreateParams(profile)); |
85 TabContents* tab_contents = new TabContents(new_contents); | 85 TabContents* tab_contents = new TabContents(new_contents); |
86 chrome::NavigateParams params(browser, tab_contents); | 86 chrome::NavigateParams params(browser, tab_contents); |
87 // TODO(pinkerton): no way to get a TabContents for this. | 87 // TODO(pinkerton): no way to get a TabContents for this. |
88 // params.source_contents = source; | 88 // params.source_contents = source; |
89 params.disposition = disposition; | 89 params.disposition = disposition; |
90 params.window_bounds = initial_pos; | 90 params.window_bounds = initial_pos; |
91 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 91 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
92 params.user_gesture = true; | 92 params.user_gesture = true; |
93 chrome::Navigate(¶ms); | 93 chrome::Navigate(¶ms); |
94 | 94 |
95 // Close the browser if chrome::Navigate created a new one. | 95 // Close the browser if chrome::Navigate created a new one. |
96 if (browser_created && (browser != params.browser)) | 96 if (browser_created && (browser != params.browser)) |
97 browser->window()->Close(); | 97 browser->window()->Close(); |
98 } | 98 } |
OLD | NEW |