OLD | NEW |
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // Resume navigation | 226 // Resume navigation |
227 Send(suspended_nav_message_.release()); | 227 Send(suspended_nav_message_.release()); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 void RenderViewHost::FirePageBeforeUnload() { | 231 void RenderViewHost::FirePageBeforeUnload() { |
232 if (IsRenderViewLive()) { | 232 if (IsRenderViewLive()) { |
233 // Start the hang monitor in case the renderer hangs in the beforeunload | 233 // Start the hang monitor in case the renderer hangs in the beforeunload |
234 // handler. | 234 // handler. |
235 is_waiting_for_unload_ack_ = true; | 235 is_waiting_for_unload_ack_ = true; |
236 StartHangMonitorTimeout(kUnloadTimeoutMS); | 236 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
237 Send(new ViewMsg_ShouldClose(routing_id_)); | 237 Send(new ViewMsg_ShouldClose(routing_id_)); |
238 } else { | 238 } else { |
239 // This RenderViewHost doesn't have a live renderer, so just skip running | 239 // This RenderViewHost doesn't have a live renderer, so just skip running |
240 // the onbeforeunload handler. | 240 // the onbeforeunload handler. |
241 OnMsgShouldCloseACK(true); | 241 OnMsgShouldCloseACK(true); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 void RenderViewHost::FirePageUnload() { | 245 void RenderViewHost::FirePageUnload() { |
246 // Start the hang monitor in case the renderer hangs in the unload handler. | 246 // Start the hang monitor in case the renderer hangs in the unload handler. |
247 is_waiting_for_unload_ack_ = true; | 247 is_waiting_for_unload_ack_ = true; |
248 StartHangMonitorTimeout(kUnloadTimeoutMS); | 248 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
249 ClosePage(site_instance()->process_host_id(), | 249 ClosePage(site_instance()->process_host_id(), |
250 routing_id()); | 250 routing_id()); |
251 } | 251 } |
252 | 252 |
253 // static | 253 // static |
254 void RenderViewHost::ClosePageIgnoringUnloadEvents(int render_process_host_id, | 254 void RenderViewHost::ClosePageIgnoringUnloadEvents(int render_process_host_id, |
255 int request_id) { | 255 int request_id) { |
256 RenderViewHost* rvh = RenderViewHost::FromID(render_process_host_id, | 256 RenderViewHost* rvh = RenderViewHost::FromID(render_process_host_id, |
257 request_id); | 257 request_id); |
258 if (!rvh) | 258 if (!rvh) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 480 } |
481 | 481 |
482 void RenderViewHost::CaptureThumbnail() { | 482 void RenderViewHost::CaptureThumbnail() { |
483 Send(new ViewMsg_CaptureThumbnail(routing_id_)); | 483 Send(new ViewMsg_CaptureThumbnail(routing_id_)); |
484 } | 484 } |
485 | 485 |
486 void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg, | 486 void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg, |
487 bool success, | 487 bool success, |
488 const std::wstring& prompt) { | 488 const std::wstring& prompt) { |
489 if (is_waiting_for_unload_ack_) | 489 if (is_waiting_for_unload_ack_) |
490 StartHangMonitorTimeout(kUnloadTimeoutMS); | 490 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
491 | 491 |
492 if (--modal_dialog_count_ == 0) | 492 if (--modal_dialog_count_ == 0) |
493 ResetEvent(modal_dialog_event_.Get()); | 493 ResetEvent(modal_dialog_event_.Get()); |
494 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, success, prompt)
; | 494 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, success, prompt)
; |
495 Send(reply_msg); | 495 Send(reply_msg); |
496 } | 496 } |
497 | 497 |
498 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, | 498 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, |
499 const std::string& json_retval) { | 499 const std::string& json_retval) { |
500 if (is_waiting_for_unload_ack_) | 500 if (is_waiting_for_unload_ack_) |
501 StartHangMonitorTimeout(kUnloadTimeoutMS); | 501 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
502 | 502 |
503 if (--modal_dialog_count_ == 0) | 503 if (--modal_dialog_count_ == 0) |
504 ResetEvent(modal_dialog_event_.Get()); | 504 ResetEvent(modal_dialog_event_.Get()); |
505 | 505 |
506 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); | 506 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); |
507 Send(reply_msg); | 507 Send(reply_msg); |
508 } | 508 } |
509 | 509 |
510 void RenderViewHost::CopyImageAt(int x, int y) { | 510 void RenderViewHost::CopyImageAt(int x, int y) { |
511 Send(new ViewMsg_CopyImageAt(routing_id_, x, y)); | 511 Send(new ViewMsg_CopyImageAt(routing_id_, x, y)); |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 event_name, | 1211 event_name, |
1212 event_arg)); | 1212 event_arg)); |
1213 } | 1213 } |
1214 #endif | 1214 #endif |
1215 | 1215 |
1216 void RenderViewHost::ForwardMessageFromExternalHost( | 1216 void RenderViewHost::ForwardMessageFromExternalHost( |
1217 const std::string& target, const std::string& message) { | 1217 const std::string& target, const std::string& message) { |
1218 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message)); | 1218 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message)); |
1219 } | 1219 } |
1220 | 1220 |
OLD | NEW |