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

Side by Side Diff: chrome/renderer/mock_render_thread.cc

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/mock_render_thread.h ('k') | chrome/renderer/notification_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 delete msg; 75 delete msg;
76 return true; 76 return true;
77 } 77 }
78 78
79 void MockRenderThread::SendCloseMessage() { 79 void MockRenderThread::SendCloseMessage() {
80 ViewMsg_Close msg(routing_id_); 80 ViewMsg_Close msg(routing_id_);
81 widget_->OnMessageReceived(msg); 81 widget_->OnMessageReceived(msg);
82 } 82 }
83 83
84 void MockRenderThread::OnMessageReceived(const IPC::Message& msg) { 84 bool MockRenderThread::OnMessageReceived(const IPC::Message& msg) {
85 // Save the message in the sink. 85 // Save the message in the sink.
86 sink_.OnMessageReceived(msg); 86 sink_.OnMessageReceived(msg);
87 87
88 // Some messages we do special handling. 88 // Some messages we do special handling.
89 bool handled = true; 89 bool handled = true;
90 bool msg_is_ok = true; 90 bool msg_is_ok = true;
91 IPC_BEGIN_MESSAGE_MAP_EX(MockRenderThread, msg, msg_is_ok) 91 IPC_BEGIN_MESSAGE_MAP_EX(MockRenderThread, msg, msg_is_ok)
92 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget) 92 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget)
93 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension, 93 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension,
94 OnMsgOpenChannelToExtension) 94 OnMsgOpenChannelToExtension)
(...skipping 14 matching lines...) Expand all
109 OnAllocateSharedMemoryBuffer) 109 OnAllocateSharedMemoryBuffer)
110 #endif 110 #endif
111 #if defined(OS_LINUX) 111 #if defined(OS_LINUX)
112 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateTempFileForPrinting, 112 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateTempFileForPrinting,
113 OnAllocateTempFileForPrinting) 113 OnAllocateTempFileForPrinting)
114 IPC_MESSAGE_HANDLER(ViewHostMsg_TempFileForPrintingWritten, 114 IPC_MESSAGE_HANDLER(ViewHostMsg_TempFileForPrintingWritten,
115 OnTempFileForPrintingWritten) 115 OnTempFileForPrintingWritten)
116 #endif 116 #endif
117 IPC_MESSAGE_UNHANDLED(handled = false) 117 IPC_MESSAGE_UNHANDLED(handled = false)
118 IPC_END_MESSAGE_MAP_EX() 118 IPC_END_MESSAGE_MAP_EX()
119 return handled;
119 } 120 }
120 121
121 // The Widget expects to be returned valid route_id. 122 // The Widget expects to be returned valid route_id.
122 void MockRenderThread::OnMsgCreateWidget(int opener_id, 123 void MockRenderThread::OnMsgCreateWidget(int opener_id,
123 WebKit::WebPopupType popup_type, 124 WebKit::WebPopupType popup_type,
124 int* route_id) { 125 int* route_id) {
125 opener_id_ = opener_id; 126 opener_id_ = opener_id;
126 *route_id = routing_id_; 127 *route_id = routing_id_;
127 } 128 }
128 129
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void MockRenderThread::OnDidGetPrintedPagesCount(int cookie, int number_pages) { 196 void MockRenderThread::OnDidGetPrintedPagesCount(int cookie, int number_pages) {
196 if (printer_.get()) 197 if (printer_.get())
197 printer_->SetPrintedPagesCount(cookie, number_pages); 198 printer_->SetPrintedPagesCount(cookie, number_pages);
198 } 199 }
199 200
200 void MockRenderThread::OnDidPrintPage( 201 void MockRenderThread::OnDidPrintPage(
201 const ViewHostMsg_DidPrintPage_Params& params) { 202 const ViewHostMsg_DidPrintPage_Params& params) {
202 if (printer_.get()) 203 if (printer_.get())
203 printer_->PrintPage(params); 204 printer_->PrintPage(params);
204 } 205 }
OLDNEW
« no previous file with comments | « chrome/renderer/mock_render_thread.h ('k') | chrome/renderer/notification_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698