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

Side by Side Diff: content/browser/renderer_host/render_view_host.cc

Issue 6627063: Ignore JavaScript messages (alert/confirm/prompt) during unload handlers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer_host/render_view_host.h" 5 #include "content/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 void RenderViewHost::OnMsgSelectionChanged(const std::string& text) { 1209 void RenderViewHost::OnMsgSelectionChanged(const std::string& text) {
1210 if (view()) 1210 if (view())
1211 view()->SelectionChanged(text); 1211 view()->SelectionChanged(text);
1212 } 1212 }
1213 1213
1214 void RenderViewHost::OnMsgRunJavaScriptMessage( 1214 void RenderViewHost::OnMsgRunJavaScriptMessage(
1215 const std::wstring& message, 1215 const std::wstring& message,
1216 const std::wstring& default_prompt, 1216 const std::wstring& default_prompt,
1217 const GURL& frame_url, 1217 const GURL& frame_url,
1218 const int flags, 1218 const int flags,
1219 const bool unload_handler_being_run,
1219 IPC::Message* reply_msg) { 1220 IPC::Message* reply_msg) {
1220 // While a JS message dialog is showing, tabs in the same process shouldn't 1221 // While a JS message dialog is showing, tabs in the same process shouldn't
1221 // process input events. 1222 // process input events.
1222 process()->set_ignore_input_events(true); 1223 process()->set_ignore_input_events(true);
1223 StopHangMonitorTimeout(); 1224 StopHangMonitorTimeout();
1224 delegate_->RunJavaScriptMessage(message, default_prompt, frame_url, flags, 1225 delegate_->RunJavaScriptMessage(message, default_prompt, frame_url, flags,
1225 reply_msg, 1226 unload_handler_being_run, reply_msg,
1226 &are_javascript_messages_suppressed_); 1227 &are_javascript_messages_suppressed_);
1227 } 1228 }
1228 1229
1229 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, 1230 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url,
1230 const std::wstring& message, 1231 const std::wstring& message,
1231 IPC::Message* reply_msg) { 1232 IPC::Message* reply_msg) {
1232 // While a JS before unload dialog is showing, tabs in the same process 1233 // While a JS before unload dialog is showing, tabs in the same process
1233 // shouldn't process input events. 1234 // shouldn't process input events.
1234 process()->set_ignore_input_events(true); 1235 process()->set_ignore_input_events(true);
1235 StopHangMonitorTimeout(); 1236 StopHangMonitorTimeout();
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 LOG(DFATAL) << "Invalid checked state " << checked_state; 1703 LOG(DFATAL) << "Invalid checked state " << checked_state;
1703 return; 1704 return;
1704 } 1705 }
1705 1706
1706 CommandState state; 1707 CommandState state;
1707 state.is_enabled = is_enabled; 1708 state.is_enabled = is_enabled;
1708 state.checked_state = 1709 state.checked_state =
1709 static_cast<RenderViewCommandCheckedState>(checked_state); 1710 static_cast<RenderViewCommandCheckedState>(checked_state);
1710 command_states_[static_cast<RenderViewCommand>(command)] = state; 1711 command_states_[static_cast<RenderViewCommand>(command)] = state;
1711 } 1712 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698