| Index: chrome/browser/renderer_host/render_view_host.cc
|
| ===================================================================
|
| --- chrome/browser/renderer_host/render_view_host.cc (revision 71193)
|
| +++ chrome/browser/renderer_host/render_view_host.cc (working copy)
|
| @@ -360,6 +360,22 @@
|
| return pending_request_id_;
|
| }
|
|
|
| +RenderViewHost::CommandState RenderViewHost::GetStateForCommand(
|
| + RenderViewCommand command) const {
|
| + if (command != RENDER_VIEW_COMMAND_TOGGLE_SPELL_CHECK)
|
| + LOG(DFATAL) << "Unknown command " << command;
|
| +
|
| + std::map<RenderViewCommand, CommandState>::const_iterator it =
|
| + command_states_.find(command);
|
| + if (it == command_states_.end()) {
|
| + CommandState state;
|
| + state.is_enabled = false;
|
| + state.checked_state = RENDER_VIEW_COMMAND_CHECKED_STATE_UNCHECKED;
|
| + return state;
|
| + }
|
| + return it->second;
|
| +}
|
| +
|
| void RenderViewHost::Stop() {
|
| Send(new ViewMsg_Stop(routing_id()));
|
| }
|
| @@ -867,6 +883,8 @@
|
| #endif
|
| IPC_MESSAGE_HANDLER(ViewHostMsg_PagesReadyForPreview,
|
| OnPagesReadyForPreview)
|
| + IPC_MESSAGE_HANDLER(ViewHostMsg_CommandStateChanged,
|
| + OnCommandStateChanged)
|
| // Have the super handle all other messages.
|
| IPC_MESSAGE_UNHANDLED(handled = RenderWidgetHost::OnMessageReceived(msg))
|
| IPC_END_MESSAGE_MAP_EX()
|
| @@ -2017,3 +2035,25 @@
|
| // Send the printingDone msg for now.
|
| Send(new ViewMsg_PrintingDone(routing_id(), params.document_cookie, true));
|
| }
|
| +
|
| +void RenderViewHost::OnCommandStateChanged(int command,
|
| + bool is_enabled,
|
| + int checked_state) {
|
| + if (command != RENDER_VIEW_COMMAND_TOGGLE_SPELL_CHECK) {
|
| + LOG(DFATAL) << "Unknown command " << command;
|
| + return;
|
| + }
|
| +
|
| + if (checked_state != RENDER_VIEW_COMMAND_CHECKED_STATE_UNCHECKED &&
|
| + checked_state != RENDER_VIEW_COMMAND_CHECKED_STATE_CHECKED &&
|
| + checked_state != RENDER_VIEW_COMMAND_CHECKED_STATE_MIXED) {
|
| + LOG(DFATAL) << "Invalid checked state " << checked_state;
|
| + return;
|
| + }
|
| +
|
| + CommandState state;
|
| + state.is_enabled = is_enabled;
|
| + state.checked_state =
|
| + static_cast<RenderViewCommandCheckedState>(checked_state);
|
| + command_states_[static_cast<RenderViewCommand>(command)] = state;
|
| +}
|
|
|