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

Unified Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 6020017: Mac: Enable "Check Spelling While Typing" in Edit menu... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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 side-by-side diff with in-line comments
Download patch
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;
+}
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.h ('k') | chrome/browser/renderer_host/render_widget_host_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698