Chromium Code Reviews| Index: content/shell/browser/shell.cc |
| diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc |
| index a214d2a61a115dee8bce6f6fef68deda6a2b5185..30f091435ef50c3f43999f0d5ef886b71625cf05 100644 |
| --- a/content/shell/browser/shell.cc |
| +++ b/content/shell/browser/shell.cc |
| @@ -312,9 +312,43 @@ gfx::NativeView Shell::GetContentView() { |
| WebContents* Shell::OpenURLFromTab(WebContents* source, |
| const OpenURLParams& params) { |
| - // This implementation only handles CURRENT_TAB. |
| - if (params.disposition != WindowOpenDisposition::CURRENT_TAB) |
| + WebContents* target = nullptr; |
| + switch (params.disposition) { |
| + case WindowOpenDisposition::CURRENT_TAB: |
|
nasko
2016/10/20 18:28:07
Shouldn't case be indented from switch?
Łukasz Anforowicz
2016/10/20 22:56:42
Ooops. Done. I've incorrectly assumed that git c
|
| + target = source; |
| + break; |
| + |
| + // NEW_POPUP and NEW_WINDOW can be treated in the same way in content shell |
| + // and layout tests. |
| + case WindowOpenDisposition::NEW_POPUP: |
| + case WindowOpenDisposition::NEW_WINDOW: { |
|
Łukasz Anforowicz
2016/10/19 20:48:50
It seems to be that the only difference between NE
nasko
2016/10/20 18:28:07
I'm ok with leaving it in, but please put part of
Łukasz Anforowicz
2016/10/20 22:56:42
Done.
|
| + Shell* new_window = Shell::CreateNewWindow( |
| + source->GetBrowserContext(), |
|
Łukasz Anforowicz
2016/10/19 20:48:50
I've verified that shift-clicked windows stay in t
|
| + GURL(), // Don't load anything just yet. |
| + source->GetSiteInstance(), |
|
Łukasz Anforowicz
2016/10/19 20:48:50
I am not quite sure what I should use as the site
Łukasz Anforowicz
2016/10/19 22:23:00
Some notes from my little research:
- I see that
nasko
2016/10/20 18:28:07
Setting a null SiteInstance is probably better. Th
Łukasz Anforowicz
2016/10/20 22:56:42
Interesting. FWIW, I see that WebContentsImpl::In
nasko
2016/10/21 16:32:47
Staying consistent with the //chrome layer sgtm an
Łukasz Anforowicz
2016/10/21 20:02:50
I've opened https://crbug.com/658386 to try to ans
|
| + gfx::Size()); // Use default size. |
| + target = new_window->web_contents(); |
| + if (switches::IsRunLayoutTestSwitchPresent()) |
| + SecondaryTestWindowObserver::CreateForWebContents(target); |
| + break; |
| + } |
| + |
| + // No tabs in content_shell: |
| + case WindowOpenDisposition::SINGLETON_TAB: |
| + case WindowOpenDisposition::NEW_FOREGROUND_TAB: |
| + case WindowOpenDisposition::NEW_BACKGROUND_TAB: |
| + // No incognito mode in content_shell: |
| + case WindowOpenDisposition::OFF_THE_RECORD: |
| + // TODO(lukasza): Investigate if some layout tests might need support for |
| + // SAVE_TO_DISK disposition. This would probably require that |
| + // BlinkTestController always sets up and cleans up a temporary directory |
| + // as the default downloads destinations for the duration of a test. |
| + case WindowOpenDisposition::SAVE_TO_DISK: |
| + // Ignoring requests with disposition == IGNORE_ACTION... |
| + case WindowOpenDisposition::IGNORE_ACTION: |
| + default: |
| return nullptr; |
| + } |
| NavigationController::LoadURLParams load_url_params(params.url); |
| load_url_params.source_site_instance = params.source_site_instance; |
| @@ -332,8 +366,8 @@ WebContents* Shell::OpenURLFromTab(WebContents* source, |
| load_url_params.post_data = params.post_data; |
| } |
| - source->GetController().LoadURLWithParams(load_url_params); |
| - return source; |
| + target->GetController().LoadURLWithParams(load_url_params); |
| + return target; |
| } |
| void Shell::LoadingStateChanged(WebContents* source, |