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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2906133004: JavaScript dialogs cause a page to lose fullscreen. (Closed)
Patch Set: with a test Created 3 years, 6 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 (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 "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 4407 matching lines...) Expand 10 before | Expand all | Expand 10 after
4418 render_view_host_delegate_view_->ShowContextMenu(render_frame_host, 4418 render_view_host_delegate_view_->ShowContextMenu(render_frame_host,
4419 context_menu_params); 4419 context_menu_params);
4420 } 4420 }
4421 4421
4422 void WebContentsImpl::RunJavaScriptDialog(RenderFrameHost* render_frame_host, 4422 void WebContentsImpl::RunJavaScriptDialog(RenderFrameHost* render_frame_host,
4423 const base::string16& message, 4423 const base::string16& message,
4424 const base::string16& default_prompt, 4424 const base::string16& default_prompt,
4425 const GURL& frame_url, 4425 const GURL& frame_url,
4426 JavaScriptDialogType dialog_type, 4426 JavaScriptDialogType dialog_type,
4427 IPC::Message* reply_msg) { 4427 IPC::Message* reply_msg) {
4428 // Running a dialog causes an exit to webpage-initiated fullscreen.
4429 // http://crbug.com/728276
4430 if (IsFullscreenForCurrentTab())
4431 ExitFullscreen(false);
Matt Giuca 2017/06/09 06:16:37 I think this should be true... documentation says
Avi (use Gerrit) 2017/06/09 14:36:23 Done.
4432
4428 // Suppress JavaScript dialogs when requested. Also suppress messages when 4433 // Suppress JavaScript dialogs when requested. Also suppress messages when
4429 // showing an interstitial as it's shown over the previous page and we don't 4434 // showing an interstitial as it's shown over the previous page and we don't
4430 // want the hidden page's dialogs to interfere with the interstitial. 4435 // want the hidden page's dialogs to interfere with the interstitial.
4431 bool suppress_this_message = 4436 bool suppress_this_message =
4432 ShowingInterstitialPage() || !delegate_ || 4437 ShowingInterstitialPage() || !delegate_ ||
4433 delegate_->ShouldSuppressDialogs(this) || 4438 delegate_->ShouldSuppressDialogs(this) ||
4434 !delegate_->GetJavaScriptDialogManager(this); 4439 !delegate_->GetJavaScriptDialogManager(this);
4435 4440
4436 if (!suppress_this_message) { 4441 if (!suppress_this_message) {
4437 is_showing_javascript_dialog_ = true; 4442 is_showing_javascript_dialog_ = true;
(...skipping 12 matching lines...) Expand all
4450 OnDialogClosed(render_frame_host->GetProcess()->GetID(), 4455 OnDialogClosed(render_frame_host->GetProcess()->GetID(),
4451 render_frame_host->GetRoutingID(), reply_msg, 4456 render_frame_host->GetRoutingID(), reply_msg,
4452 true, false, base::string16()); 4457 true, false, base::string16());
4453 } 4458 }
4454 } 4459 }
4455 4460
4456 void WebContentsImpl::RunBeforeUnloadConfirm( 4461 void WebContentsImpl::RunBeforeUnloadConfirm(
4457 RenderFrameHost* render_frame_host, 4462 RenderFrameHost* render_frame_host,
4458 bool is_reload, 4463 bool is_reload,
4459 IPC::Message* reply_msg) { 4464 IPC::Message* reply_msg) {
4465 // Running a dialog causes an exit to webpage-initiated fullscreen.
4466 // http://crbug.com/728276
4467 if (IsFullscreenForCurrentTab())
4468 ExitFullscreen(false);
Matt Giuca 2017/06/09 06:16:37 Same as above.
Avi (use Gerrit) 2017/06/09 14:36:23 Done.
4469
4460 RenderFrameHostImpl* rfhi = 4470 RenderFrameHostImpl* rfhi =
4461 static_cast<RenderFrameHostImpl*>(render_frame_host); 4471 static_cast<RenderFrameHostImpl*>(render_frame_host);
4462 if (delegate_) 4472 if (delegate_)
4463 delegate_->WillRunBeforeUnloadConfirm(); 4473 delegate_->WillRunBeforeUnloadConfirm();
4464 4474
4465 bool suppress_this_message = 4475 bool suppress_this_message =
4466 !rfhi->is_active() || 4476 !rfhi->is_active() ||
4467 ShowingInterstitialPage() || !delegate_ || 4477 ShowingInterstitialPage() || !delegate_ ||
4468 delegate_->ShouldSuppressDialogs(this) || 4478 delegate_->ShouldSuppressDialogs(this) ||
4469 !delegate_->GetJavaScriptDialogManager(this); 4479 !delegate_->GetJavaScriptDialogManager(this);
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
5720 new_root->SetOriginalOpener(opener->frame_tree()->root()); 5730 new_root->SetOriginalOpener(opener->frame_tree()->root());
5721 5731
5722 if (!opener_suppressed) { 5732 if (!opener_suppressed) {
5723 new_root->SetOpener(opener); 5733 new_root->SetOpener(opener);
5724 created_with_opener_ = true; 5734 created_with_opener_ = true;
5725 } 5735 }
5726 } 5736 }
5727 } 5737 }
5728 5738
5729 } // namespace content 5739 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698