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

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 71029)
+++ chrome/browser/renderer_host/render_view_host.cc (working copy)
@@ -360,6 +360,27 @@
return pending_request_id_;
}
+RenderViewHost::CommandState RenderViewHost::GetStateForCommand(
+ RenderViewCommand command) const {
+ switch (command) {
brettw 2011/01/13 05:59:55 Any reason this isn't an if statement? It will be
sail 2011/01/13 23:38:15 Done.
+ case RENDER_VIEW_COMMAND_TOGGLE_SPELL_CHECK:
+ break;
+ default:
+ LOG(DFATAL) << "Unknown command " << command;
+ break;
+ }
+
+ 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 = COMMAND_CHECKED_STATE_UNCHECKED;
+ return state;
+ }
+ return it->second;
+}
+
void RenderViewHost::Stop() {
Send(new ViewMsg_Stop(routing_id()));
}
@@ -867,6 +888,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 +2040,34 @@
// 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) {
+ RenderViewCommand render_view_command;
+ switch (command) {
brettw 2011/01/13 05:59:55 I'd probably use an if for these switches as well
sail 2011/01/13 23:38:15 Done.
+ case RENDER_VIEW_COMMAND_TOGGLE_SPELL_CHECK:
+ render_view_command = static_cast<RenderViewCommand>(command);
+ break;
+ default:
+ LOG(DFATAL) << "Unknown command " << command;
+ return;
+ }
+
+ CommandCheckedState command_checked_state;
+ switch (checked_state) {
+ case COMMAND_CHECKED_STATE_UNCHECKED:
+ case COMMAND_CHECKED_STATE_CHECKED:
+ case COMMAND_CHECKED_STATE_MIXED:
+ command_checked_state = static_cast<CommandCheckedState>(checked_state);
+ break;
+ default:
+ LOG(DFATAL) << "Invalid checked state " << checked_state;
+ return;
+ }
+
+ CommandState state;
+ state.is_enabled = is_enabled;
+ state.checked_state = command_checked_state;
+ command_states_[render_view_command] = state;
+}

Powered by Google App Engine
This is Rietveld 408576698