Index: chrome/browser/renderer_host/render_view_host.cc |
=================================================================== |
--- chrome/browser/renderer_host/render_view_host.cc (revision 70404) |
+++ chrome/browser/renderer_host/render_view_host.cc (working copy) |
@@ -361,6 +361,19 @@ |
return pending_request_id_; |
} |
+RenderViewHost::CommandState RenderViewHost::GetStateForCommand( |
+ const std::string& command_name) const { |
+ std::map<std::string, CommandState>::const_iterator it = |
brettw
2011/01/09 00:06:06
A couple of comments on this: where does the comma
sail
2011/01/11 18:45:51
Enum sounds good. Should I put it in render_messag
sail
2011/01/12 01:26:36
Done.
|
+ command_states_.find(command_name); |
brettw
2011/01/09 00:06:06
Style nit: wrapped lines get indented 4 spaces
sail
2011/01/12 01:26:36
Done.
|
+ if (it == command_states_.end()) { |
+ CommandState state; |
+ state.is_enabled = false; |
+ state.checked_state = 0; |
+ return state; |
+ } |
+ return it->second; |
+} |
+ |
void RenderViewHost::Stop() { |
Send(new ViewMsg_Stop(routing_id())); |
} |
@@ -882,6 +895,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() |
@@ -2187,3 +2202,12 @@ |
// Send the printingDone msg for now. |
Send(new ViewMsg_PrintingDone(routing_id(), params.document_cookie, true)); |
} |
+ |
+void RenderViewHost::OnCommandStateChanged(std::string command_name, |
+ bool is_enabled, |
+ int checked_state) { |
+ CommandState state; |
+ state.is_enabled = is_enabled; |
+ state.checked_state = checked_state; |
+ command_states_[command_name] = state; |
+} |