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

Side by Side Diff: chrome/browser/render_view_host.cc

Issue 9477: Continue with crosssite navigations if alerts are suppressed... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/render_view_host.h ('k') | chrome/browser/render_view_host_delegate.h » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/render_view_host.h" 5 #include "chrome/browser/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 enable_external_host_bindings_(false), 81 enable_external_host_bindings_(false),
82 delegate_(delegate), 82 delegate_(delegate),
83 renderer_initialized_(false), 83 renderer_initialized_(false),
84 waiting_for_drag_context_response_(false), 84 waiting_for_drag_context_response_(false),
85 debugger_attached_(false), 85 debugger_attached_(false),
86 modal_dialog_count_(0), 86 modal_dialog_count_(0),
87 navigations_suspended_(false), 87 navigations_suspended_(false),
88 suspended_nav_message_(NULL), 88 suspended_nav_message_(NULL),
89 run_modal_reply_msg_(NULL), 89 run_modal_reply_msg_(NULL),
90 has_unload_listener_(false), 90 has_unload_listener_(false),
91 is_waiting_for_unload_ack_(false) { 91 is_waiting_for_unload_ack_(false),
92 are_javascript_messages_suppressed_(false) {
92 DCHECK(instance_); 93 DCHECK(instance_);
93 DCHECK(delegate_); 94 DCHECK(delegate_);
94 if (modal_dialog_event == NULL) 95 if (modal_dialog_event == NULL)
95 modal_dialog_event = CreateEvent(NULL, TRUE, FALSE, NULL); 96 modal_dialog_event = CreateEvent(NULL, TRUE, FALSE, NULL);
96 97
97 modal_dialog_event_.Set(modal_dialog_event); 98 modal_dialog_event_.Set(modal_dialog_event);
98 #ifdef CHROME_PERSONALIZATION 99 #ifdef CHROME_PERSONALIZATION
99 personalization_ = Personalization::CreateHostPersonalization(this); 100 personalization_ = Personalization::CreateHostPersonalization(this);
100 #endif 101 #endif
101 } 102 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 Send(new ViewMsg_GetApplicationInfo(routing_id_, page_id)); 471 Send(new ViewMsg_GetApplicationInfo(routing_id_, page_id));
471 } 472 }
472 473
473 void RenderViewHost::CaptureThumbnail() { 474 void RenderViewHost::CaptureThumbnail() {
474 Send(new ViewMsg_CaptureThumbnail(routing_id_)); 475 Send(new ViewMsg_CaptureThumbnail(routing_id_));
475 } 476 }
476 477
477 void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg, 478 void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg,
478 bool success, 479 bool success,
479 const std::wstring& prompt) { 480 const std::wstring& prompt) {
480 if (is_waiting_for_unload_ack_) 481 if (is_waiting_for_unload_ack_) {
481 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); 482 if (are_javascript_messages_suppressed_) {
483 delegate_->RendererUnresponsive(this, is_waiting_for_unload_ack_);
484 return;
485 } else {
darin (slow to review) 2008/11/07 00:00:45 nit: no need for else after return. alternatively
486 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
487 }
488 }
482 489
483 if (--modal_dialog_count_ == 0) 490 if (--modal_dialog_count_ == 0)
484 ResetEvent(modal_dialog_event_.Get()); 491 ResetEvent(modal_dialog_event_.Get());
485 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, success, prompt) ; 492 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, success, prompt) ;
486 Send(reply_msg); 493 Send(reply_msg);
487 } 494 }
488 495
489 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, 496 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg,
490 const std::string& json_retval) { 497 const std::string& json_retval) {
491 if (is_waiting_for_unload_ack_) 498 if (is_waiting_for_unload_ack_)
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 1049
1043 void RenderViewHost::OnMsgRunJavaScriptMessage( 1050 void RenderViewHost::OnMsgRunJavaScriptMessage(
1044 const std::wstring& message, 1051 const std::wstring& message,
1045 const std::wstring& default_prompt, 1052 const std::wstring& default_prompt,
1046 const int flags, 1053 const int flags,
1047 IPC::Message* reply_msg) { 1054 IPC::Message* reply_msg) {
1048 StopHangMonitorTimeout(); 1055 StopHangMonitorTimeout();
1049 if (modal_dialog_count_++ == 0) 1056 if (modal_dialog_count_++ == 0)
1050 SetEvent(modal_dialog_event_.Get()); 1057 SetEvent(modal_dialog_event_.Get());
1051 bool did_suppress_message = false; 1058 bool did_suppress_message = false;
1052 delegate_->RunJavaScriptMessage(message, default_prompt, flags, reply_msg); 1059 delegate_->RunJavaScriptMessage(message, default_prompt, flags, reply_msg,
1060 &are_javascript_messages_suppressed_);
1053 } 1061 }
1054 1062
1055 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const std::wstring& message, 1063 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const std::wstring& message,
1056 IPC::Message* reply_msg) { 1064 IPC::Message* reply_msg) {
1057 StopHangMonitorTimeout(); 1065 StopHangMonitorTimeout();
1058 if (modal_dialog_count_++ == 0) 1066 if (modal_dialog_count_++ == 0)
1059 SetEvent(modal_dialog_event_.Get()); 1067 SetEvent(modal_dialog_event_.Get());
1060 delegate_->RunBeforeUnloadConfirm(message, reply_msg); 1068 delegate_->RunBeforeUnloadConfirm(message, reply_msg);
1061 } 1069 }
1062 1070
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 Send(new ViewMsg_PersonalizationEvent(routing_id_, 1291 Send(new ViewMsg_PersonalizationEvent(routing_id_,
1284 event_name, 1292 event_name,
1285 event_arg)); 1293 event_arg));
1286 } 1294 }
1287 #endif 1295 #endif
1288 1296
1289 void RenderViewHost::ForwardMessageFromExternalHost( 1297 void RenderViewHost::ForwardMessageFromExternalHost(
1290 const std::string& target, const std::string& message) { 1298 const std::string& target, const std::string& message) {
1291 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message)); 1299 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message));
1292 } 1300 }
OLDNEW
« no previous file with comments | « chrome/browser/render_view_host.h ('k') | chrome/browser/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698