OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/mock_render_thread.h" | 5 #include "chrome/renderer/mock_render_thread.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool msg_is_ok = true; | 105 bool msg_is_ok = true; |
106 IPC_BEGIN_MESSAGE_MAP_EX(MockRenderThread, msg, msg_is_ok) | 106 IPC_BEGIN_MESSAGE_MAP_EX(MockRenderThread, msg, msg_is_ok) |
107 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget) | 107 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget) |
108 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension, | 108 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension, |
109 OnMsgOpenChannelToExtension) | 109 OnMsgOpenChannelToExtension) |
110 IPC_MESSAGE_HANDLER(PrintHostMsg_GetDefaultPrintSettings, | 110 IPC_MESSAGE_HANDLER(PrintHostMsg_GetDefaultPrintSettings, |
111 OnGetDefaultPrintSettings) | 111 OnGetDefaultPrintSettings) |
112 IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint, | 112 IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint, |
113 OnScriptedPrint) | 113 OnScriptedPrint) |
114 #if defined(OS_WIN) || defined(OS_MACOSX) | 114 #if defined(OS_WIN) || defined(OS_MACOSX) |
115 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, | 115 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetBasicPrintJobInfo, |
116 OnDidGetPrintedPagesCount) | 116 OnDidGetBasicPrintJobInfo) |
117 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) | 117 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) |
118 #endif | 118 #endif |
119 #if defined(OS_WIN) | 119 #if defined(OS_WIN) |
120 IPC_MESSAGE_HANDLER(PrintHostMsg_DuplicateSection, OnDuplicateSection) | 120 IPC_MESSAGE_HANDLER(PrintHostMsg_DuplicateSection, OnDuplicateSection) |
121 #endif | 121 #endif |
122 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateSharedMemoryBuffer, | 122 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateSharedMemoryBuffer, |
123 OnAllocateSharedMemoryBuffer) | 123 OnAllocateSharedMemoryBuffer) |
124 #if defined(OS_CHROMEOS) | 124 #if defined(OS_CHROMEOS) |
125 IPC_MESSAGE_HANDLER(PrintHostMsg_AllocateTempFileForPrinting, | 125 IPC_MESSAGE_HANDLER(PrintHostMsg_AllocateTempFileForPrinting, |
126 OnAllocateTempFileForPrinting) | 126 OnAllocateTempFileForPrinting) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 const PrintHostMsg_ScriptedPrint_Params& params, | 198 const PrintHostMsg_ScriptedPrint_Params& params, |
199 PrintMsg_PrintPages_Params* settings) { | 199 PrintMsg_PrintPages_Params* settings) { |
200 if (print_dialog_user_response_ && printer_.get()) { | 200 if (print_dialog_user_response_ && printer_.get()) { |
201 printer_->ScriptedPrint(params.cookie, | 201 printer_->ScriptedPrint(params.cookie, |
202 params.expected_pages_count, | 202 params.expected_pages_count, |
203 params.has_selection, | 203 params.has_selection, |
204 settings); | 204 settings); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 void MockRenderThread::OnDidGetPrintedPagesCount(int cookie, int number_pages) { | 208 void MockRenderThread::OnDidGetBasicPrintJobInfo( |
| 209 int cookie, int number_pages, const string16& job_title) { |
209 if (printer_.get()) | 210 if (printer_.get()) |
210 printer_->SetPrintedPagesCount(cookie, number_pages); | 211 printer_->SetPrintedPagesCount(cookie, number_pages); |
211 } | 212 } |
212 | 213 |
213 void MockRenderThread::OnDidPrintPage( | 214 void MockRenderThread::OnDidPrintPage( |
214 const PrintHostMsg_DidPrintPage_Params& params) { | 215 const PrintHostMsg_DidPrintPage_Params& params) { |
215 if (printer_.get()) | 216 if (printer_.get()) |
216 printer_->PrintPage(params); | 217 printer_->PrintPage(params); |
217 } | 218 } |
218 | 219 |
219 void MockRenderThread::set_print_dialog_user_response(bool response) { | 220 void MockRenderThread::set_print_dialog_user_response(bool response) { |
220 print_dialog_user_response_ = response; | 221 print_dialog_user_response_ = response; |
221 } | 222 } |
OLD | NEW |