OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_mock_render_thread.h" | 5 #include "chrome/renderer/chrome_mock_render_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/renderer/mock_printer.h" | 10 #include "chrome/renderer/mock_printer.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const scoped_refptr<base::MessageLoopProxy>& proxy) { | 46 const scoped_refptr<base::MessageLoopProxy>& proxy) { |
47 io_message_loop_proxy_ = proxy; | 47 io_message_loop_proxy_ = proxy; |
48 } | 48 } |
49 | 49 |
50 bool ChromeMockRenderThread::OnMessageReceived(const IPC::Message& msg) { | 50 bool ChromeMockRenderThread::OnMessageReceived(const IPC::Message& msg) { |
51 if (content::MockRenderThread::OnMessageReceived(msg)) | 51 if (content::MockRenderThread::OnMessageReceived(msg)) |
52 return true; | 52 return true; |
53 | 53 |
54 // Some messages we do special handling. | 54 // Some messages we do special handling. |
55 bool handled = true; | 55 bool handled = true; |
56 bool msg_is_ok = true; | 56 IPC_BEGIN_MESSAGE_MAP(ChromeMockRenderThread, msg) |
57 IPC_BEGIN_MESSAGE_MAP_EX(ChromeMockRenderThread, msg, msg_is_ok) | |
58 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension, | 57 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension, |
59 OnOpenChannelToExtension) | 58 OnOpenChannelToExtension) |
60 #if defined(ENABLE_PRINTING) | 59 #if defined(ENABLE_PRINTING) |
61 IPC_MESSAGE_HANDLER(PrintHostMsg_GetDefaultPrintSettings, | 60 IPC_MESSAGE_HANDLER(PrintHostMsg_GetDefaultPrintSettings, |
62 OnGetDefaultPrintSettings) | 61 OnGetDefaultPrintSettings) |
63 IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint, OnScriptedPrint) | 62 IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint, OnScriptedPrint) |
64 IPC_MESSAGE_HANDLER(PrintHostMsg_UpdatePrintSettings, OnUpdatePrintSettings) | 63 IPC_MESSAGE_HANDLER(PrintHostMsg_UpdatePrintSettings, OnUpdatePrintSettings) |
65 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, | 64 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, |
66 OnDidGetPrintedPagesCount) | 65 OnDidGetPrintedPagesCount) |
67 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) | 66 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) |
68 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount, | 67 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount, |
69 OnDidGetPreviewPageCount) | 68 OnDidGetPreviewPageCount) |
70 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage, OnDidPreviewPage) | 69 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage, OnDidPreviewPage) |
71 IPC_MESSAGE_HANDLER(PrintHostMsg_CheckForCancel, OnCheckForCancel) | 70 IPC_MESSAGE_HANDLER(PrintHostMsg_CheckForCancel, OnCheckForCancel) |
72 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
73 IPC_MESSAGE_HANDLER(PrintHostMsg_DuplicateSection, OnDuplicateSection) | 72 IPC_MESSAGE_HANDLER(PrintHostMsg_DuplicateSection, OnDuplicateSection) |
74 #endif | 73 #endif |
75 #if defined(OS_CHROMEOS) | 74 #if defined(OS_CHROMEOS) |
76 IPC_MESSAGE_HANDLER(PrintHostMsg_AllocateTempFileForPrinting, | 75 IPC_MESSAGE_HANDLER(PrintHostMsg_AllocateTempFileForPrinting, |
77 OnAllocateTempFileForPrinting) | 76 OnAllocateTempFileForPrinting) |
78 IPC_MESSAGE_HANDLER(PrintHostMsg_TempFileForPrintingWritten, | 77 IPC_MESSAGE_HANDLER(PrintHostMsg_TempFileForPrintingWritten, |
79 OnTempFileForPrintingWritten) | 78 OnTempFileForPrintingWritten) |
80 #endif // defined(OS_CHROMEOS) | 79 #endif // defined(OS_CHROMEOS) |
81 #endif // defined(ENABLE_PRINTING) | 80 #endif // defined(ENABLE_PRINTING) |
82 IPC_MESSAGE_UNHANDLED(handled = false) | 81 IPC_MESSAGE_UNHANDLED(handled = false) |
83 IPC_END_MESSAGE_MAP_EX() | 82 IPC_END_MESSAGE_MAP() |
84 return handled; | 83 return handled; |
85 } | 84 } |
86 | 85 |
87 void ChromeMockRenderThread::OnOpenChannelToExtension( | 86 void ChromeMockRenderThread::OnOpenChannelToExtension( |
88 int routing_id, | 87 int routing_id, |
89 const ExtensionMsg_ExternalConnectionInfo& info, | 88 const ExtensionMsg_ExternalConnectionInfo& info, |
90 const std::string& channel_name, | 89 const std::string& channel_name, |
91 bool include_tls_channel_id, | 90 bool include_tls_channel_id, |
92 int* port_id) { | 91 int* port_id) { |
93 *port_id = 0; | 92 *port_id = 0; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 219 } |
221 | 220 |
222 void ChromeMockRenderThread::set_print_preview_cancel_page_number(int page) { | 221 void ChromeMockRenderThread::set_print_preview_cancel_page_number(int page) { |
223 print_preview_cancel_page_number_ = page; | 222 print_preview_cancel_page_number_ = page; |
224 } | 223 } |
225 | 224 |
226 int ChromeMockRenderThread::print_preview_pages_remaining() const { | 225 int ChromeMockRenderThread::print_preview_pages_remaining() const { |
227 return print_preview_pages_remaining_; | 226 return print_preview_pages_remaining_; |
228 } | 227 } |
229 #endif // defined(ENABLE_PRINTING) | 228 #endif // defined(ENABLE_PRINTING) |
OLD | NEW |