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

Side by Side Diff: content/shell/browser/shell.cc

Issue 2417983002: Form submissions opening in a new window don't need special treatment anymore. (Closed)
Patch Set: Add support for NEW_WINDOW disposition in content::Shell::OpenURLFromTab. Created 4 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell.h" 5 #include "content/shell/browser/shell.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 305 }
306 306
307 gfx::NativeView Shell::GetContentView() { 307 gfx::NativeView Shell::GetContentView() {
308 if (!web_contents_) 308 if (!web_contents_)
309 return NULL; 309 return NULL;
310 return web_contents_->GetNativeView(); 310 return web_contents_->GetNativeView();
311 } 311 }
312 312
313 WebContents* Shell::OpenURLFromTab(WebContents* source, 313 WebContents* Shell::OpenURLFromTab(WebContents* source,
314 const OpenURLParams& params) { 314 const OpenURLParams& params) {
315 // This implementation only handles CURRENT_TAB. 315 WebContents* target = nullptr;
316 if (params.disposition != WindowOpenDisposition::CURRENT_TAB) 316 switch (params.disposition) {
317 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
318 target = source;
319 break;
320
321 // NEW_POPUP and NEW_WINDOW can be treated in the same way in content shell
322 // and layout tests.
323 case WindowOpenDisposition::NEW_POPUP:
324 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.
325 Shell* new_window = Shell::CreateNewWindow(
326 source->GetBrowserContext(),
Łukasz Anforowicz 2016/10/19 20:48:50 I've verified that shift-clicked windows stay in t
327 GURL(), // Don't load anything just yet.
328 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
329 gfx::Size()); // Use default size.
330 target = new_window->web_contents();
331 if (switches::IsRunLayoutTestSwitchPresent())
332 SecondaryTestWindowObserver::CreateForWebContents(target);
333 break;
334 }
335
336 // No tabs in content_shell:
337 case WindowOpenDisposition::SINGLETON_TAB:
338 case WindowOpenDisposition::NEW_FOREGROUND_TAB:
339 case WindowOpenDisposition::NEW_BACKGROUND_TAB:
340 // No incognito mode in content_shell:
341 case WindowOpenDisposition::OFF_THE_RECORD:
342 // TODO(lukasza): Investigate if some layout tests might need support for
343 // SAVE_TO_DISK disposition. This would probably require that
344 // BlinkTestController always sets up and cleans up a temporary directory
345 // as the default downloads destinations for the duration of a test.
346 case WindowOpenDisposition::SAVE_TO_DISK:
347 // Ignoring requests with disposition == IGNORE_ACTION...
348 case WindowOpenDisposition::IGNORE_ACTION:
349 default:
317 return nullptr; 350 return nullptr;
351 }
318 352
319 NavigationController::LoadURLParams load_url_params(params.url); 353 NavigationController::LoadURLParams load_url_params(params.url);
320 load_url_params.source_site_instance = params.source_site_instance; 354 load_url_params.source_site_instance = params.source_site_instance;
321 load_url_params.transition_type = params.transition; 355 load_url_params.transition_type = params.transition;
322 load_url_params.frame_tree_node_id = params.frame_tree_node_id; 356 load_url_params.frame_tree_node_id = params.frame_tree_node_id;
323 load_url_params.referrer = params.referrer; 357 load_url_params.referrer = params.referrer;
324 load_url_params.redirect_chain = params.redirect_chain; 358 load_url_params.redirect_chain = params.redirect_chain;
325 load_url_params.extra_headers = params.extra_headers; 359 load_url_params.extra_headers = params.extra_headers;
326 load_url_params.is_renderer_initiated = params.is_renderer_initiated; 360 load_url_params.is_renderer_initiated = params.is_renderer_initiated;
327 load_url_params.should_replace_current_entry = 361 load_url_params.should_replace_current_entry =
328 params.should_replace_current_entry; 362 params.should_replace_current_entry;
329 363
330 if (params.uses_post) { 364 if (params.uses_post) {
331 load_url_params.load_type = NavigationController::LOAD_TYPE_HTTP_POST; 365 load_url_params.load_type = NavigationController::LOAD_TYPE_HTTP_POST;
332 load_url_params.post_data = params.post_data; 366 load_url_params.post_data = params.post_data;
333 } 367 }
334 368
335 source->GetController().LoadURLWithParams(load_url_params); 369 target->GetController().LoadURLWithParams(load_url_params);
336 return source; 370 return target;
337 } 371 }
338 372
339 void Shell::LoadingStateChanged(WebContents* source, 373 void Shell::LoadingStateChanged(WebContents* source,
340 bool to_different_document) { 374 bool to_different_document) {
341 UpdateNavigationControls(to_different_document); 375 UpdateNavigationControls(to_different_document);
342 PlatformSetIsLoading(source->IsLoading()); 376 PlatformSetIsLoading(source->IsLoading());
343 } 377 }
344 378
345 void Shell::EnterFullscreenModeForTab(WebContents* web_contents, 379 void Shell::EnterFullscreenModeForTab(WebContents* web_contents,
346 const GURL& origin) { 380 const GURL& origin) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 if (entry) 496 if (entry)
463 PlatformSetTitle(entry->GetTitle()); 497 PlatformSetTitle(entry->GetTitle());
464 } 498 }
465 499
466 void Shell::OnDevToolsWebContentsDestroyed() { 500 void Shell::OnDevToolsWebContentsDestroyed() {
467 devtools_observer_.reset(); 501 devtools_observer_.reset();
468 devtools_frontend_ = NULL; 502 devtools_frontend_ = NULL;
469 } 503 }
470 504
471 } // namespace content 505 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698