Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 int request_id) { | 354 int request_id) { |
| 355 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( | 355 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( |
| 356 process()->id(), routing_id(), has_pending_request); | 356 process()->id(), routing_id(), has_pending_request); |
| 357 pending_request_id_ = request_id; | 357 pending_request_id_ = request_id; |
| 358 } | 358 } |
| 359 | 359 |
| 360 int RenderViewHost::GetPendingRequestId() { | 360 int RenderViewHost::GetPendingRequestId() { |
| 361 return pending_request_id_; | 361 return pending_request_id_; |
| 362 } | 362 } |
| 363 | 363 |
| 364 RenderViewHost::CommandState RenderViewHost::GetStateForCommand( | |
| 365 const std::string& command_name) const { | |
| 366 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.
| |
| 367 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.
| |
| 368 if (it == command_states_.end()) { | |
| 369 CommandState state; | |
| 370 state.is_enabled = false; | |
| 371 state.checked_state = 0; | |
| 372 return state; | |
| 373 } | |
| 374 return it->second; | |
| 375 } | |
| 376 | |
| 364 void RenderViewHost::Stop() { | 377 void RenderViewHost::Stop() { |
| 365 Send(new ViewMsg_Stop(routing_id())); | 378 Send(new ViewMsg_Stop(routing_id())); |
| 366 } | 379 } |
| 367 | 380 |
| 368 void RenderViewHost::ReloadFrame() { | 381 void RenderViewHost::ReloadFrame() { |
| 369 Send(new ViewMsg_ReloadFrame(routing_id())); | 382 Send(new ViewMsg_ReloadFrame(routing_id())); |
| 370 } | 383 } |
| 371 | 384 |
| 372 bool RenderViewHost::PrintPages() { | 385 bool RenderViewHost::PrintPages() { |
| 373 return Send(new ViewMsg_PrintPages(routing_id())); | 386 return Send(new ViewMsg_PrintPages(routing_id())); |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 IPC_MESSAGE_HANDLER(ViewHostMsg_DetectedPhishingSite, | 888 IPC_MESSAGE_HANDLER(ViewHostMsg_DetectedPhishingSite, |
| 876 OnDetectedPhishingSite) | 889 OnDetectedPhishingSite) |
| 877 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) | 890 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) |
| 878 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, | 891 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, |
| 879 OnUpdateContentRestrictions) | 892 OnUpdateContentRestrictions) |
| 880 #if defined(OS_MACOSX) | 893 #if defined(OS_MACOSX) |
| 881 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) | 894 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) |
| 882 #endif | 895 #endif |
| 883 IPC_MESSAGE_HANDLER(ViewHostMsg_PagesReadyForPreview, | 896 IPC_MESSAGE_HANDLER(ViewHostMsg_PagesReadyForPreview, |
| 884 OnPagesReadyForPreview) | 897 OnPagesReadyForPreview) |
| 898 IPC_MESSAGE_HANDLER(ViewHostMsg_CommandStateChanged, | |
| 899 OnCommandStateChanged) | |
| 885 // Have the super handle all other messages. | 900 // Have the super handle all other messages. |
| 886 IPC_MESSAGE_UNHANDLED(handled = RenderWidgetHost::OnMessageReceived(msg)) | 901 IPC_MESSAGE_UNHANDLED(handled = RenderWidgetHost::OnMessageReceived(msg)) |
| 887 IPC_END_MESSAGE_MAP_EX() | 902 IPC_END_MESSAGE_MAP_EX() |
| 888 | 903 |
| 889 if (!msg_is_ok) { | 904 if (!msg_is_ok) { |
| 890 // The message had a handler, but its de-serialization failed. | 905 // The message had a handler, but its de-serialization failed. |
| 891 // Kill the renderer. | 906 // Kill the renderer. |
| 892 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); | 907 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); |
| 893 process()->ReceivedBadMessage(); | 908 process()->ReceivedBadMessage(); |
| 894 } | 909 } |
| (...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2180 if (printer_query.get()) { | 2195 if (printer_query.get()) { |
| 2181 BrowserThread::PostTask( | 2196 BrowserThread::PostTask( |
| 2182 BrowserThread::IO, FROM_HERE, | 2197 BrowserThread::IO, FROM_HERE, |
| 2183 NewRunnableMethod(printer_query.get(), | 2198 NewRunnableMethod(printer_query.get(), |
| 2184 &printing::PrinterQuery::StopWorker)); | 2199 &printing::PrinterQuery::StopWorker)); |
| 2185 } | 2200 } |
| 2186 | 2201 |
| 2187 // Send the printingDone msg for now. | 2202 // Send the printingDone msg for now. |
| 2188 Send(new ViewMsg_PrintingDone(routing_id(), params.document_cookie, true)); | 2203 Send(new ViewMsg_PrintingDone(routing_id(), params.document_cookie, true)); |
| 2189 } | 2204 } |
| 2205 | |
| 2206 void RenderViewHost::OnCommandStateChanged(std::string command_name, | |
| 2207 bool is_enabled, | |
| 2208 int checked_state) { | |
| 2209 CommandState state; | |
| 2210 state.is_enabled = is_enabled; | |
| 2211 state.checked_state = checked_state; | |
| 2212 command_states_[command_name] = state; | |
| 2213 } | |
| OLD | NEW |