| OLD | NEW |
| 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 "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 <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 | 624 |
| 625 void RenderViewHost::DragSourceSystemDragEnded() { | 625 void RenderViewHost::DragSourceSystemDragEnded() { |
| 626 Send(new ViewMsg_DragSourceSystemDragEnded(routing_id())); | 626 Send(new ViewMsg_DragSourceSystemDragEnded(routing_id())); |
| 627 } | 627 } |
| 628 | 628 |
| 629 void RenderViewHost::AllowBindings(int bindings_flags) { | 629 void RenderViewHost::AllowBindings(int bindings_flags) { |
| 630 DCHECK(!renderer_initialized_); | 630 DCHECK(!renderer_initialized_); |
| 631 enabled_bindings_ |= bindings_flags; | 631 enabled_bindings_ |= bindings_flags; |
| 632 } | 632 } |
| 633 | 633 |
| 634 void RenderViewHost::SetDOMUIProperty(const std::string& name, | 634 void RenderViewHost::SetWebUIProperty(const std::string& name, |
| 635 const std::string& value) { | 635 const std::string& value) { |
| 636 DCHECK(BindingsPolicy::is_dom_ui_enabled(enabled_bindings_)); | 636 DCHECK(BindingsPolicy::is_dom_ui_enabled(enabled_bindings_)); |
| 637 Send(new ViewMsg_SetDOMUIProperty(routing_id(), name, value)); | 637 Send(new ViewMsg_SetWebUIProperty(routing_id(), name, value)); |
| 638 } | 638 } |
| 639 | 639 |
| 640 void RenderViewHost::GotFocus() { | 640 void RenderViewHost::GotFocus() { |
| 641 RenderWidgetHost::GotFocus(); // Notifies the renderer it got focus. | 641 RenderWidgetHost::GotFocus(); // Notifies the renderer it got focus. |
| 642 | 642 |
| 643 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 643 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
| 644 if (view) | 644 if (view) |
| 645 view->GotFocus(); | 645 view->GotFocus(); |
| 646 } | 646 } |
| 647 | 647 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame, | 757 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame, |
| 758 OnMsgDocumentOnLoadCompletedInMainFrame) | 758 OnMsgDocumentOnLoadCompletedInMainFrame) |
| 759 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCodeFinished, | 759 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCodeFinished, |
| 760 OnExecuteCodeFinished) | 760 OnExecuteCodeFinished) |
| 761 IPC_MESSAGE_HANDLER(ViewHostMsg_ContextMenu, OnMsgContextMenu) | 761 IPC_MESSAGE_HANDLER(ViewHostMsg_ContextMenu, OnMsgContextMenu) |
| 762 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnMsgOpenURL) | 762 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnMsgOpenURL) |
| 763 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, | 763 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, |
| 764 OnMsgDidContentsPreferredSizeChange) | 764 OnMsgDidContentsPreferredSizeChange) |
| 765 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, | 765 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, |
| 766 OnMsgDomOperationResponse) | 766 OnMsgDomOperationResponse) |
| 767 IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend, OnMsgDOMUISend) | 767 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnMsgWebUISend) |
| 768 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, | 768 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, |
| 769 OnMsgForwardMessageToExternalHost) | 769 OnMsgForwardMessageToExternalHost) |
| 770 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) | 770 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) |
| 771 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage, | 771 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage, |
| 772 OnMsgRunJavaScriptMessage) | 772 OnMsgRunJavaScriptMessage) |
| 773 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, | 773 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, |
| 774 OnMsgRunBeforeUnloadConfirm) | 774 OnMsgRunBeforeUnloadConfirm) |
| 775 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ShowModalHTMLDialog, | 775 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ShowModalHTMLDialog, |
| 776 OnMsgShowModalHTMLDialog) | 776 OnMsgShowModalHTMLDialog) |
| 777 IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging) | 777 IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging) |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 const std::string& json_string, int automation_id) { | 1124 const std::string& json_string, int automation_id) { |
| 1125 delegate_->DomOperationResponse(json_string, automation_id); | 1125 delegate_->DomOperationResponse(json_string, automation_id); |
| 1126 | 1126 |
| 1127 // We also fire a notification for more loosely-coupled use cases. | 1127 // We also fire a notification for more loosely-coupled use cases. |
| 1128 DomOperationNotificationDetails details(json_string, automation_id); | 1128 DomOperationNotificationDetails details(json_string, automation_id); |
| 1129 NotificationService::current()->Notify( | 1129 NotificationService::current()->Notify( |
| 1130 NotificationType::DOM_OPERATION_RESPONSE, Source<RenderViewHost>(this), | 1130 NotificationType::DOM_OPERATION_RESPONSE, Source<RenderViewHost>(this), |
| 1131 Details<DomOperationNotificationDetails>(&details)); | 1131 Details<DomOperationNotificationDetails>(&details)); |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 void RenderViewHost::OnMsgDOMUISend( | 1134 void RenderViewHost::OnMsgWebUISend( |
| 1135 const GURL& source_url, const std::string& message, | 1135 const GURL& source_url, const std::string& message, |
| 1136 const std::string& content) { | 1136 const std::string& content) { |
| 1137 if (!ChildProcessSecurityPolicy::GetInstance()-> | 1137 if (!ChildProcessSecurityPolicy::GetInstance()-> |
| 1138 HasWebUIBindings(process()->id())) { | 1138 HasWebUIBindings(process()->id())) { |
| 1139 NOTREACHED() << "Blocked unauthorized use of WebUIBindings."; | 1139 NOTREACHED() << "Blocked unauthorized use of WebUIBindings."; |
| 1140 return; | 1140 return; |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 scoped_ptr<Value> value; | 1143 scoped_ptr<Value> value; |
| 1144 if (!content.empty()) { | 1144 if (!content.empty()) { |
| 1145 value.reset(base::JSONReader::Read(content, false)); | 1145 value.reset(base::JSONReader::Read(content, false)); |
| 1146 if (!value.get() || !value->IsType(Value::TYPE_LIST)) { | 1146 if (!value.get() || !value->IsType(Value::TYPE_LIST)) { |
| 1147 // The page sent us something that we didn't understand. | 1147 // The page sent us something that we didn't understand. |
| 1148 // This probably indicates a programming error. | 1148 // This probably indicates a programming error. |
| 1149 NOTREACHED() << "Invalid JSON argument in OnMsgDOMUISend."; | 1149 NOTREACHED() << "Invalid JSON argument in OnMsgWebUISend."; |
| 1150 return; | 1150 return; |
| 1151 } | 1151 } |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 ViewHostMsg_DomMessage_Params params; | 1154 ViewHostMsg_DomMessage_Params params; |
| 1155 params.name = message; | 1155 params.name = message; |
| 1156 if (value.get()) | 1156 if (value.get()) |
| 1157 params.arguments.Swap(static_cast<ListValue*>(value.get())); | 1157 params.arguments.Swap(static_cast<ListValue*>(value.get())); |
| 1158 params.source_url = source_url; | 1158 params.source_url = source_url; |
| 1159 // WebUI doesn't use these values yet. | 1159 // WebUI doesn't use these values yet. |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 LOG(DFATAL) << "Invalid checked state " << checked_state; | 1713 LOG(DFATAL) << "Invalid checked state " << checked_state; |
| 1714 return; | 1714 return; |
| 1715 } | 1715 } |
| 1716 | 1716 |
| 1717 CommandState state; | 1717 CommandState state; |
| 1718 state.is_enabled = is_enabled; | 1718 state.is_enabled = is_enabled; |
| 1719 state.checked_state = | 1719 state.checked_state = |
| 1720 static_cast<RenderViewCommandCheckedState>(checked_state); | 1720 static_cast<RenderViewCommandCheckedState>(checked_state); |
| 1721 command_states_[static_cast<RenderViewCommand>(command)] = state; | 1721 command_states_[static_cast<RenderViewCommand>(command)] = state; |
| 1722 } | 1722 } |
| OLD | NEW |