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 "ipc/attachment_broker_messages.h" | |
8 #include "ipc/brokerable_attachment.h" | |
9 #include "ipc/handle_attachment_win.h" | |
10 #include "ipc/ipc_sender.h" | |
11 | |
7 namespace IPC { | 12 namespace IPC { |
8 | 13 |
9 AttachmentBrokerWin::AttachmentBrokerWin() { | 14 AttachmentBrokerWin::AttachmentBrokerWin() { |
10 } | 15 } |
11 | 16 |
12 AttachmentBrokerWin::~AttachmentBrokerWin() { | 17 AttachmentBrokerWin::~AttachmentBrokerWin() { |
13 } | 18 } |
14 | 19 |
15 void AttachmentBrokerWin::OnReceiveDuplicatedHandle( | 20 void AttachmentBrokerWin::OnReceiveDuplicatedHandle( |
16 HANDLE, | 21 HANDLE, |
17 BrokerableAttachment::AttachmentId id) { | 22 BrokerableAttachment::AttachmentId id) { |
18 // TODO(erikchen): Implement me. http://crbug.com/493414 | 23 // TODO(erikchen): Implement me. http://crbug.com/493414 |
19 } | 24 } |
20 | 25 |
21 void AttachmentBrokerWin::SendAttachmentToProcess( | 26 bool AttachmentBrokerWin::SendAttachmentToProcess( |
22 BrokerableAttachment* attachment, | 27 BrokerableAttachment* attachment, |
23 base::ProcessId destination_process) { | 28 base::ProcessId destination_process) { |
24 // TODO(erikchen): Implement me. http://crbug.com/493414 | 29 switch (attachment->GetBrokerableType()) { |
30 case BrokerableAttachment::WIN_HANDLE: | |
31 internal::HandleAttachmentWin* handle_attachment = | |
32 static_cast<internal::HandleAttachmentWin*>(attachment); | |
33 internal::HandleAttachmentWin::WireFormat format = | |
34 handle_attachment->GetWireFormat(destination_process); | |
35 Message* m = new AttachmentBrokerMsg_RequestBrokerageOfWinHandle(format); | |
Tom Sepez
2015/06/19 18:04:10
nit: no need for |m|, the pattern is usually just
erikchen
2015/06/23 22:36:59
Done.
| |
36 return sender_->Send(m); | |
37 } | |
38 return false; | |
25 } | 39 } |
26 | 40 |
27 bool AttachmentBrokerWin::GetAttachmentWithId( | 41 bool AttachmentBrokerWin::GetAttachmentWithId( |
28 BrokerableAttachment::AttachmentId id, | 42 BrokerableAttachment::AttachmentId id, |
29 BrokerableAttachment* attachment) { | 43 BrokerableAttachment* attachment) { |
30 // TODO(erikchen): Implement me. http://crbug.com/493414 | 44 // TODO(erikchen): Implement me. http://crbug.com/493414 |
31 return false; | 45 return false; |
32 } | 46 } |
33 | 47 |
48 void AttachmentBrokerWin::SetSender(IPC::Sender* sender) { | |
Tom Sepez
2015/06/19 18:04:10
nit: move trivial setter to header.
erikchen
2015/06/23 22:36:59
Done.
| |
49 sender_ = sender; | |
50 } | |
51 | |
34 } // namespace IPC | 52 } // namespace IPC |
OLD | NEW |