OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ipc/attachment_broker_win.h" | 5 #include "ipc/attachment_broker_win.h" |
6 | 6 |
| 7 #include "base/process/process.h" |
7 #include "ipc/attachment_broker_messages.h" | 8 #include "ipc/attachment_broker_messages.h" |
8 #include "ipc/brokerable_attachment.h" | 9 #include "ipc/brokerable_attachment.h" |
9 #include "ipc/handle_attachment_win.h" | 10 #include "ipc/handle_attachment_win.h" |
10 #include "ipc/ipc_sender.h" | 11 #include "ipc/ipc_sender.h" |
11 | 12 |
12 namespace IPC { | 13 namespace IPC { |
13 | 14 |
14 AttachmentBrokerWin::AttachmentBrokerWin() { | 15 AttachmentBrokerWin::AttachmentBrokerWin() { |
15 } | 16 } |
16 | 17 |
(...skipping 21 matching lines...) Expand all Loading... |
38 return false; | 39 return false; |
39 } | 40 } |
40 | 41 |
41 bool AttachmentBrokerWin::GetAttachmentWithId( | 42 bool AttachmentBrokerWin::GetAttachmentWithId( |
42 BrokerableAttachment::AttachmentId id, | 43 BrokerableAttachment::AttachmentId id, |
43 BrokerableAttachment* attachment) { | 44 BrokerableAttachment* attachment) { |
44 // TODO(erikchen): Implement me. http://crbug.com/493414 | 45 // TODO(erikchen): Implement me. http://crbug.com/493414 |
45 return false; | 46 return false; |
46 } | 47 } |
47 | 48 |
| 49 bool AttachmentBrokerWin::OnMessageReceived(const Message& msg) { |
| 50 bool handled = true; |
| 51 IPC_BEGIN_MESSAGE_MAP(AttachmentBrokerWin, msg) |
| 52 IPC_MESSAGE_HANDLER(AttachmentBrokerMsg_WinHandleHasBeenDuplicated, |
| 53 OnWinHandleHasBeenDuplicated) |
| 54 IPC_MESSAGE_UNHANDLED(handled = false) |
| 55 IPC_END_MESSAGE_MAP() |
| 56 return handled; |
| 57 } |
| 58 |
| 59 void AttachmentBrokerWin::OnWinHandleHasBeenDuplicated( |
| 60 const IPC::internal::HandleAttachmentWin::WireFormat& wire_format) { |
| 61 // The IPC message was intended for a different process. Ignore it. |
| 62 if (wire_format.destination_process != base::Process::Current().Pid()) |
| 63 return; |
| 64 |
| 65 scoped_refptr<BrokerableAttachment> attachment( |
| 66 new IPC::internal::HandleAttachmentWin(wire_format)); |
| 67 attachments_.push_back(attachment); |
| 68 } |
| 69 |
48 } // namespace IPC | 70 } // namespace IPC |
OLD | NEW |