| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/renderer_host/render_view_host.h" | 5 #include "chrome/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 552 |
| 553 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 553 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
| 554 } | 554 } |
| 555 | 555 |
| 556 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, | 556 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, |
| 557 success, prompt); | 557 success, prompt); |
| 558 Send(reply_msg); | 558 Send(reply_msg); |
| 559 } | 559 } |
| 560 | 560 |
| 561 void RenderViewHost::JavaScriptMessageBoxWindowDestroyed() { | 561 void RenderViewHost::JavaScriptMessageBoxWindowDestroyed() { |
| 562 if (--modal_dialog_count_ == 0) | 562 ResetModalDialogEvent(); |
| 563 modal_dialog_event_->Reset(); | |
| 564 } | 563 } |
| 565 | 564 |
| 566 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, | 565 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, |
| 567 const std::string& json_retval) { | 566 const std::string& json_retval) { |
| 568 if (is_waiting_for_unload_ack_) | 567 if (is_waiting_for_unload_ack_) |
| 569 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 568 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
| 570 | 569 |
| 571 if (--modal_dialog_count_ == 0) | 570 ResetModalDialogEvent(); |
| 572 modal_dialog_event_->Reset(); | |
| 573 | 571 |
| 574 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); | 572 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); |
| 575 Send(reply_msg); | 573 Send(reply_msg); |
| 576 } | 574 } |
| 577 | 575 |
| 578 void RenderViewHost::CopyImageAt(int x, int y) { | 576 void RenderViewHost::CopyImageAt(int x, int y) { |
| 579 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); | 577 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); |
| 580 } | 578 } |
| 581 | 579 |
| 582 void RenderViewHost::DragSourceCancelledAt( | 580 void RenderViewHost::DragSourceCancelledAt( |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 if (!msg_is_ok) { | 803 if (!msg_is_ok) { |
| 806 // The message had a handler, but its de-serialization failed. | 804 // The message had a handler, but its de-serialization failed. |
| 807 // Kill the renderer. | 805 // Kill the renderer. |
| 808 process()->ReceivedBadMessage(msg.type()); | 806 process()->ReceivedBadMessage(msg.type()); |
| 809 } | 807 } |
| 810 } | 808 } |
| 811 | 809 |
| 812 void RenderViewHost::Shutdown() { | 810 void RenderViewHost::Shutdown() { |
| 813 // If we are being run modally (see RunModal), then we need to cleanup. | 811 // If we are being run modally (see RunModal), then we need to cleanup. |
| 814 if (run_modal_reply_msg_) { | 812 if (run_modal_reply_msg_) { |
| 815 if (--modal_dialog_count_ == 0) | 813 ResetModalDialogEvent(); |
| 816 modal_dialog_event_->Reset(); | |
| 817 Send(run_modal_reply_msg_); | 814 Send(run_modal_reply_msg_); |
| 818 run_modal_reply_msg_ = NULL; | 815 run_modal_reply_msg_ = NULL; |
| 819 } | 816 } |
| 820 RenderWidgetHost::Shutdown(); | 817 RenderWidgetHost::Shutdown(); |
| 821 } | 818 } |
| 822 | 819 |
| 823 void RenderViewHost::CreateNewWindow(int route_id, | 820 void RenderViewHost::CreateNewWindow(int route_id, |
| 824 ModalDialogEvent modal_dialog_event) { | 821 ModalDialogEvent modal_dialog_event) { |
| 825 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 822 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 826 if (!view) | 823 if (!view) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 const gfx::Rect& initial_pos) { | 855 const gfx::Rect& initial_pos) { |
| 859 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 856 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 860 if (view) { | 857 if (view) { |
| 861 view->ShowCreatedWidget(route_id, initial_pos); | 858 view->ShowCreatedWidget(route_id, initial_pos); |
| 862 Send(new ViewMsg_Move_ACK(route_id)); | 859 Send(new ViewMsg_Move_ACK(route_id)); |
| 863 } | 860 } |
| 864 } | 861 } |
| 865 | 862 |
| 866 void RenderViewHost::OnMsgRunModal(IPC::Message* reply_msg) { | 863 void RenderViewHost::OnMsgRunModal(IPC::Message* reply_msg) { |
| 867 DCHECK(!run_modal_reply_msg_); | 864 DCHECK(!run_modal_reply_msg_); |
| 868 if (modal_dialog_count_++ == 0) | 865 SignalModalDialogEvent(); |
| 869 modal_dialog_event_->Signal(); | |
| 870 run_modal_reply_msg_ = reply_msg; | 866 run_modal_reply_msg_ = reply_msg; |
| 871 | 867 |
| 872 // TODO(darin): Bug 1107929: Need to inform our delegate to show this view in | 868 // TODO(darin): Bug 1107929: Need to inform our delegate to show this view in |
| 873 // an app-modal fashion. | 869 // an app-modal fashion. |
| 874 } | 870 } |
| 875 | 871 |
| 876 void RenderViewHost::OnMsgRenderViewReady() { | 872 void RenderViewHost::OnMsgRenderViewReady() { |
| 877 WasResized(); | 873 WasResized(); |
| 878 delegate_->RenderViewReady(this); | 874 delegate_->RenderViewReady(this); |
| 879 } | 875 } |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 delegate_->RunFileChooser(multiple_files, title, default_file); | 1189 delegate_->RunFileChooser(multiple_files, title, default_file); |
| 1194 } | 1190 } |
| 1195 | 1191 |
| 1196 void RenderViewHost::OnMsgRunJavaScriptMessage( | 1192 void RenderViewHost::OnMsgRunJavaScriptMessage( |
| 1197 const std::wstring& message, | 1193 const std::wstring& message, |
| 1198 const std::wstring& default_prompt, | 1194 const std::wstring& default_prompt, |
| 1199 const GURL& frame_url, | 1195 const GURL& frame_url, |
| 1200 const int flags, | 1196 const int flags, |
| 1201 IPC::Message* reply_msg) { | 1197 IPC::Message* reply_msg) { |
| 1202 StopHangMonitorTimeout(); | 1198 StopHangMonitorTimeout(); |
| 1203 if (modal_dialog_count_++ == 0) | 1199 SignalModalDialogEvent(); |
| 1204 modal_dialog_event_->Signal(); | |
| 1205 delegate_->RunJavaScriptMessage(message, default_prompt, frame_url, flags, | 1200 delegate_->RunJavaScriptMessage(message, default_prompt, frame_url, flags, |
| 1206 reply_msg, | 1201 reply_msg, |
| 1207 &are_javascript_messages_suppressed_); | 1202 &are_javascript_messages_suppressed_); |
| 1208 } | 1203 } |
| 1209 | 1204 |
| 1210 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, | 1205 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, |
| 1211 const std::wstring& message, | 1206 const std::wstring& message, |
| 1212 IPC::Message* reply_msg) { | 1207 IPC::Message* reply_msg) { |
| 1213 StopHangMonitorTimeout(); | 1208 StopHangMonitorTimeout(); |
| 1214 if (modal_dialog_count_++ == 0) | 1209 SignalModalDialogEvent(); |
| 1215 modal_dialog_event_->Signal(); | |
| 1216 delegate_->RunBeforeUnloadConfirm(message, reply_msg); | 1210 delegate_->RunBeforeUnloadConfirm(message, reply_msg); |
| 1217 } | 1211 } |
| 1218 | 1212 |
| 1219 void RenderViewHost::OnMsgShowModalHTMLDialog( | 1213 void RenderViewHost::OnMsgShowModalHTMLDialog( |
| 1220 const GURL& url, int width, int height, const std::string& json_arguments, | 1214 const GURL& url, int width, int height, const std::string& json_arguments, |
| 1221 IPC::Message* reply_msg) { | 1215 IPC::Message* reply_msg) { |
| 1222 StopHangMonitorTimeout(); | 1216 StopHangMonitorTimeout(); |
| 1223 if (modal_dialog_count_++ == 0) | 1217 SignalModalDialogEvent(); |
| 1224 modal_dialog_event_->Signal(); | |
| 1225 delegate_->ShowModalHTMLDialog(url, width, height, json_arguments, reply_msg); | 1218 delegate_->ShowModalHTMLDialog(url, width, height, json_arguments, reply_msg); |
| 1226 } | 1219 } |
| 1227 | 1220 |
| 1228 void RenderViewHost::OnMsgPasswordFormsSeen( | 1221 void RenderViewHost::OnMsgPasswordFormsSeen( |
| 1229 const std::vector<webkit_glue::PasswordForm>& forms) { | 1222 const std::vector<webkit_glue::PasswordForm>& forms) { |
| 1230 delegate_->PasswordFormsSeen(forms); | 1223 delegate_->PasswordFormsSeen(forms); |
| 1231 } | 1224 } |
| 1232 | 1225 |
| 1233 void RenderViewHost::OnMsgAutofillFormSubmitted( | 1226 void RenderViewHost::OnMsgAutofillFormSubmitted( |
| 1234 const webkit_glue::AutofillForm& form) { | 1227 const webkit_glue::AutofillForm& form) { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 BrowserAccessibilityManager::GetInstance()-> | 1495 BrowserAccessibilityManager::GetInstance()-> |
| 1503 ChangeAccessibilityFocus(acc_obj_id, process()->pid(), routing_id()); | 1496 ChangeAccessibilityFocus(acc_obj_id, process()->pid(), routing_id()); |
| 1504 #else | 1497 #else |
| 1505 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. | 1498 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. |
| 1506 #endif | 1499 #endif |
| 1507 } | 1500 } |
| 1508 | 1501 |
| 1509 void RenderViewHost::OnCSSInserted() { | 1502 void RenderViewHost::OnCSSInserted() { |
| 1510 delegate_->DidInsertCSS(); | 1503 delegate_->DidInsertCSS(); |
| 1511 } | 1504 } |
| 1505 |
| 1506 void RenderViewHost::SignalModalDialogEvent() { |
| 1507 if (modal_dialog_count_++ == 0) |
| 1508 modal_dialog_event_->Signal(); |
| 1509 } |
| 1510 |
| 1511 void RenderViewHost::ResetModalDialogEvent() { |
| 1512 if (--modal_dialog_count_ == 0) |
| 1513 modal_dialog_event_->Reset(); |
| 1514 } |
| OLD | NEW |