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

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 3362 matching lines...) Expand 10 before | Expand all | Expand 10 after
3373 const base::string16& message, 3373 const base::string16& message,
3374 const base::string16& default_prompt, 3374 const base::string16& default_prompt,
3375 const GURL& frame_url, 3375 const GURL& frame_url,
3376 JavaScriptMessageType javascript_message_type, 3376 JavaScriptMessageType javascript_message_type,
3377 IPC::Message* reply_msg) { 3377 IPC::Message* reply_msg) {
3378 // Suppress JavaScript dialogs when requested. Also suppress messages when 3378 // Suppress JavaScript dialogs when requested. Also suppress messages when
3379 // showing an interstitial as it's shown over the previous page and we don't 3379 // showing an interstitial as it's shown over the previous page and we don't
3380 // want the hidden page's dialogs to interfere with the interstitial. 3380 // want the hidden page's dialogs to interfere with the interstitial.
3381 bool suppress_this_message = 3381 bool suppress_this_message =
3382 static_cast<RenderFrameHostImpl*>(render_frame_host)->is_swapped_out() || 3382 static_cast<RenderFrameHostImpl*>(render_frame_host)->is_swapped_out() ||
3383 ShowingInterstitialPage() || 3383 ShowingInterstitialPage() || !delegate_ ||
3384 !delegate_ || 3384 delegate_->ShouldSuppressDialogs(this) ||
3385 delegate_->ShouldSuppressDialogs() || 3385 !delegate_->GetJavaScriptDialogManager(this);
3386 !delegate_->GetJavaScriptDialogManager();
3387 3386
3388 if (!suppress_this_message) { 3387 if (!suppress_this_message) {
3389 std::string accept_lang = GetContentClient()->browser()-> 3388 std::string accept_lang = GetContentClient()->browser()->
3390 GetAcceptLangs(GetBrowserContext()); 3389 GetAcceptLangs(GetBrowserContext());
3391 dialog_manager_ = delegate_->GetJavaScriptDialogManager(); 3390 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this);
3392 dialog_manager_->RunJavaScriptDialog( 3391 dialog_manager_->RunJavaScriptDialog(
3393 this, 3392 this,
3394 frame_url.GetOrigin(), 3393 frame_url.GetOrigin(),
3395 accept_lang, 3394 accept_lang,
3396 javascript_message_type, 3395 javascript_message_type,
3397 message, 3396 message,
3398 default_prompt, 3397 default_prompt,
3399 base::Bind(&WebContentsImpl::OnDialogClosed, 3398 base::Bind(&WebContentsImpl::OnDialogClosed,
3400 base::Unretained(this), 3399 base::Unretained(this),
3401 render_frame_host->GetProcess()->GetID(), 3400 render_frame_host->GetProcess()->GetID(),
(...skipping 19 matching lines...) Expand all
3421 RenderFrameHost* render_frame_host, 3420 RenderFrameHost* render_frame_host,
3422 const base::string16& message, 3421 const base::string16& message,
3423 bool is_reload, 3422 bool is_reload,
3424 IPC::Message* reply_msg) { 3423 IPC::Message* reply_msg) {
3425 RenderFrameHostImpl* rfhi = 3424 RenderFrameHostImpl* rfhi =
3426 static_cast<RenderFrameHostImpl*>(render_frame_host); 3425 static_cast<RenderFrameHostImpl*>(render_frame_host);
3427 if (delegate_) 3426 if (delegate_)
3428 delegate_->WillRunBeforeUnloadConfirm(); 3427 delegate_->WillRunBeforeUnloadConfirm();
3429 3428
3430 bool suppress_this_message = 3429 bool suppress_this_message =
3431 rfhi->rfh_state() != RenderFrameHostImpl::STATE_DEFAULT || 3430 rfhi->rfh_state() != RenderFrameHostImpl::STATE_DEFAULT || !delegate_ ||
3432 !delegate_ || 3431 delegate_->ShouldSuppressDialogs(this) ||
3433 delegate_->ShouldSuppressDialogs() || 3432 !delegate_->GetJavaScriptDialogManager(this);
3434 !delegate_->GetJavaScriptDialogManager();
3435 if (suppress_this_message) { 3433 if (suppress_this_message) {
3436 rfhi->JavaScriptDialogClosed(reply_msg, true, base::string16(), true); 3434 rfhi->JavaScriptDialogClosed(reply_msg, true, base::string16(), true);
3437 return; 3435 return;
3438 } 3436 }
3439 3437
3440 is_showing_before_unload_dialog_ = true; 3438 is_showing_before_unload_dialog_ = true;
3441 dialog_manager_ = delegate_->GetJavaScriptDialogManager(); 3439 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this);
3442 dialog_manager_->RunBeforeUnloadDialog( 3440 dialog_manager_->RunBeforeUnloadDialog(
3443 this, message, is_reload, 3441 this, message, is_reload,
3444 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), 3442 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this),
3445 render_frame_host->GetProcess()->GetID(), 3443 render_frame_host->GetProcess()->GetID(),
3446 render_frame_host->GetRoutingID(), reply_msg, 3444 render_frame_host->GetRoutingID(), reply_msg,
3447 false)); 3445 false));
3448 } 3446 }
3449 3447
3450 WebContents* WebContentsImpl::GetAsWebContents() { 3448 WebContents* WebContentsImpl::GetAsWebContents() {
3451 return this; 3449 return this;
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
4331 node->render_manager()->ResumeResponseDeferredAtStart(); 4329 node->render_manager()->ResumeResponseDeferredAtStart();
4332 } 4330 }
4333 4331
4334 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4332 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4335 force_disable_overscroll_content_ = force_disable; 4333 force_disable_overscroll_content_ = force_disable;
4336 if (view_) 4334 if (view_)
4337 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4335 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4338 } 4336 }
4339 4337
4340 } // namespace content 4338 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698