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

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

Issue 691823002: Add WebContents source to methods in WebContentsDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 3378 matching lines...) Expand 10 before | Expand all | Expand 10 after
3389 const base::string16& message, 3389 const base::string16& message,
3390 const base::string16& default_prompt, 3390 const base::string16& default_prompt,
3391 const GURL& frame_url, 3391 const GURL& frame_url,
3392 JavaScriptMessageType javascript_message_type, 3392 JavaScriptMessageType javascript_message_type,
3393 IPC::Message* reply_msg) { 3393 IPC::Message* reply_msg) {
3394 // Suppress JavaScript dialogs when requested. Also suppress messages when 3394 // Suppress JavaScript dialogs when requested. Also suppress messages when
3395 // showing an interstitial as it's shown over the previous page and we don't 3395 // showing an interstitial as it's shown over the previous page and we don't
3396 // want the hidden page's dialogs to interfere with the interstitial. 3396 // want the hidden page's dialogs to interfere with the interstitial.
3397 bool suppress_this_message = 3397 bool suppress_this_message =
3398 static_cast<RenderFrameHostImpl*>(render_frame_host)->is_swapped_out() || 3398 static_cast<RenderFrameHostImpl*>(render_frame_host)->is_swapped_out() ||
3399 ShowingInterstitialPage() || 3399 ShowingInterstitialPage() || !delegate_ ||
3400 !delegate_ || 3400 delegate_->ShouldSuppressDialogs(this) ||
3401 delegate_->ShouldSuppressDialogs() || 3401 !delegate_->GetJavaScriptDialogManager(this);
3402 !delegate_->GetJavaScriptDialogManager();
3403 3402
3404 if (!suppress_this_message) { 3403 if (!suppress_this_message) {
3405 std::string accept_lang = GetContentClient()->browser()-> 3404 std::string accept_lang = GetContentClient()->browser()->
3406 GetAcceptLangs(GetBrowserContext()); 3405 GetAcceptLangs(GetBrowserContext());
3407 dialog_manager_ = delegate_->GetJavaScriptDialogManager(); 3406 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this);
3408 dialog_manager_->RunJavaScriptDialog( 3407 dialog_manager_->RunJavaScriptDialog(
3409 this, 3408 this,
3410 frame_url.GetOrigin(), 3409 frame_url.GetOrigin(),
3411 accept_lang, 3410 accept_lang,
3412 javascript_message_type, 3411 javascript_message_type,
3413 message, 3412 message,
3414 default_prompt, 3413 default_prompt,
3415 base::Bind(&WebContentsImpl::OnDialogClosed, 3414 base::Bind(&WebContentsImpl::OnDialogClosed,
3416 base::Unretained(this), 3415 base::Unretained(this),
3417 render_frame_host->GetProcess()->GetID(), 3416 render_frame_host->GetProcess()->GetID(),
(...skipping 19 matching lines...) Expand all
3437 RenderFrameHost* render_frame_host, 3436 RenderFrameHost* render_frame_host,
3438 const base::string16& message, 3437 const base::string16& message,
3439 bool is_reload, 3438 bool is_reload,
3440 IPC::Message* reply_msg) { 3439 IPC::Message* reply_msg) {
3441 RenderFrameHostImpl* rfhi = 3440 RenderFrameHostImpl* rfhi =
3442 static_cast<RenderFrameHostImpl*>(render_frame_host); 3441 static_cast<RenderFrameHostImpl*>(render_frame_host);
3443 if (delegate_) 3442 if (delegate_)
3444 delegate_->WillRunBeforeUnloadConfirm(); 3443 delegate_->WillRunBeforeUnloadConfirm();
3445 3444
3446 bool suppress_this_message = 3445 bool suppress_this_message =
3447 rfhi->rfh_state() != RenderFrameHostImpl::STATE_DEFAULT || 3446 rfhi->rfh_state() != RenderFrameHostImpl::STATE_DEFAULT || !delegate_ ||
3448 !delegate_ || 3447 delegate_->ShouldSuppressDialogs(this) ||
3449 delegate_->ShouldSuppressDialogs() || 3448 !delegate_->GetJavaScriptDialogManager(this);
3450 !delegate_->GetJavaScriptDialogManager();
3451 if (suppress_this_message) { 3449 if (suppress_this_message) {
3452 rfhi->JavaScriptDialogClosed(reply_msg, true, base::string16(), true); 3450 rfhi->JavaScriptDialogClosed(reply_msg, true, base::string16(), true);
3453 return; 3451 return;
3454 } 3452 }
3455 3453
3456 is_showing_before_unload_dialog_ = true; 3454 is_showing_before_unload_dialog_ = true;
3457 dialog_manager_ = delegate_->GetJavaScriptDialogManager(); 3455 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this);
3458 dialog_manager_->RunBeforeUnloadDialog( 3456 dialog_manager_->RunBeforeUnloadDialog(
3459 this, message, is_reload, 3457 this, message, is_reload,
3460 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), 3458 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this),
3461 render_frame_host->GetProcess()->GetID(), 3459 render_frame_host->GetProcess()->GetID(),
3462 render_frame_host->GetRoutingID(), reply_msg, 3460 render_frame_host->GetRoutingID(), reply_msg,
3463 false)); 3461 false));
3464 } 3462 }
3465 3463
3466 WebContents* WebContentsImpl::GetAsWebContents() { 3464 WebContents* WebContentsImpl::GetAsWebContents() {
3467 return this; 3465 return this;
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
4351 node->render_manager()->ResumeResponseDeferredAtStart(); 4349 node->render_manager()->ResumeResponseDeferredAtStart();
4352 } 4350 }
4353 4351
4354 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4352 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4355 force_disable_overscroll_content_ = force_disable; 4353 force_disable_overscroll_content_ = force_disable;
4356 if (view_) 4354 if (view_)
4357 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4355 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4358 } 4356 }
4359 4357
4360 } // namespace content 4358 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/page_handler.cc ('k') | content/public/browser/web_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698