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

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

Issue 2704383007: Always restart the hung page timer after a beforeunload dialog. (Closed)
Patch Set: fixes Created 3 years, 9 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
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4195 matching lines...) Expand 10 before | Expand all | Expand 10 after
4206 static_cast<RenderFrameHostImpl*>(render_frame_host); 4206 static_cast<RenderFrameHostImpl*>(render_frame_host);
4207 if (delegate_) 4207 if (delegate_)
4208 delegate_->WillRunBeforeUnloadConfirm(); 4208 delegate_->WillRunBeforeUnloadConfirm();
4209 4209
4210 bool suppress_this_message = 4210 bool suppress_this_message =
4211 !rfhi->is_active() || 4211 !rfhi->is_active() ||
4212 ShowingInterstitialPage() || !delegate_ || 4212 ShowingInterstitialPage() || !delegate_ ||
4213 delegate_->ShouldSuppressDialogs(this) || 4213 delegate_->ShouldSuppressDialogs(this) ||
4214 !delegate_->GetJavaScriptDialogManager(this); 4214 !delegate_->GetJavaScriptDialogManager(this);
4215 if (suppress_this_message) { 4215 if (suppress_this_message) {
4216 rfhi->JavaScriptDialogClosed(reply_msg, true, base::string16(), true); 4216 rfhi->JavaScriptDialogClosed(reply_msg, true, base::string16(),
4217 /*is_before_unload_dialog=*/true,
4218 /*dialog_was_suppressed=*/true);
4217 return; 4219 return;
4218 } 4220 }
4219 4221
4220 is_showing_before_unload_dialog_ = true; 4222 is_showing_before_unload_dialog_ = true;
4221 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this); 4223 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this);
4222 dialog_manager_->RunBeforeUnloadDialog( 4224 dialog_manager_->RunBeforeUnloadDialog(
4223 this, is_reload, 4225 this, is_reload,
4224 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), 4226 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this),
4225 render_frame_host->GetProcess()->GetID(), 4227 render_frame_host->GetProcess()->GetID(),
4226 render_frame_host->GetRoutingID(), reply_msg, 4228 render_frame_host->GetRoutingID(), reply_msg,
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
5136 // meantime. Do not reset the navigation state in that case. 5138 // meantime. Do not reset the navigation state in that case.
5137 if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) { 5139 if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) {
5138 rfh->frame_tree_node()->BeforeUnloadCanceled(); 5140 rfh->frame_tree_node()->BeforeUnloadCanceled();
5139 controller_.DiscardNonCommittedEntries(); 5141 controller_.DiscardNonCommittedEntries();
5140 } 5142 }
5141 5143
5142 for (auto& observer : observers_) 5144 for (auto& observer : observers_)
5143 observer.BeforeUnloadDialogCancelled(); 5145 observer.BeforeUnloadDialogCancelled();
5144 } 5146 }
5145 5147
5146 is_showing_javascript_dialog_ = false;
5147 is_showing_before_unload_dialog_ = false;
5148 if (rfh) { 5148 if (rfh) {
5149 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, 5149 rfh->JavaScriptDialogClosed(reply_msg, success, user_input,
5150 is_showing_before_unload_dialog_,
5150 dialog_was_suppressed); 5151 dialog_was_suppressed);
5151 } else { 5152 } else {
5152 // Don't leak the sync IPC reply if the RFH or process is gone. 5153 // Don't leak the sync IPC reply if the RFH or process is gone.
5153 delete reply_msg; 5154 delete reply_msg;
5154 } 5155 }
5156
5157 is_showing_javascript_dialog_ = false;
5158 is_showing_before_unload_dialog_ = false;
5155 } 5159 }
5156 5160
5157 void WebContentsImpl::SetEncoding(const std::string& encoding) { 5161 void WebContentsImpl::SetEncoding(const std::string& encoding) {
5158 if (encoding == last_reported_encoding_) 5162 if (encoding == last_reported_encoding_)
5159 return; 5163 return;
5160 last_reported_encoding_ = encoding; 5164 last_reported_encoding_ = encoding;
5161 5165
5162 canonical_encoding_ = base::GetCanonicalEncodingNameByAliasName(encoding); 5166 canonical_encoding_ = base::GetCanonicalEncodingNameByAliasName(encoding);
5163 } 5167 }
5164 5168
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
5432 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); 5436 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5433 if (!render_view_host) 5437 if (!render_view_host)
5434 continue; 5438 continue;
5435 render_view_host_set.insert(render_view_host); 5439 render_view_host_set.insert(render_view_host);
5436 } 5440 }
5437 for (RenderViewHost* render_view_host : render_view_host_set) 5441 for (RenderViewHost* render_view_host : render_view_host_set)
5438 render_view_host->OnWebkitPreferencesChanged(); 5442 render_view_host->OnWebkitPreferencesChanged();
5439 } 5443 }
5440 5444
5441 } // namespace content 5445 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698