| 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_privileged_win.h" | 5 #include "ipc/attachment_broker_privileged_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
| 10 #include "ipc/attachment_broker_messages.h" | 10 #include "ipc/attachment_broker_messages.h" |
| 11 #include "ipc/brokerable_attachment.h" | 11 #include "ipc/brokerable_attachment.h" |
| 12 #include "ipc/handle_attachment_win.h" | 12 #include "ipc/handle_attachment_win.h" |
| 13 #include "ipc/ipc_channel.h" | 13 #include "ipc/ipc_channel.h" |
| 14 | 14 |
| 15 namespace IPC { | 15 namespace IPC { |
| 16 | 16 |
| 17 AttachmentBrokerPrivilegedWin::AttachmentBrokerPrivilegedWin() {} | 17 AttachmentBrokerPrivilegedWin::AttachmentBrokerPrivilegedWin() {} |
| 18 | 18 |
| 19 AttachmentBrokerPrivilegedWin::~AttachmentBrokerPrivilegedWin() {} | 19 AttachmentBrokerPrivilegedWin::~AttachmentBrokerPrivilegedWin() {} |
| 20 | 20 |
| 21 bool AttachmentBrokerPrivilegedWin::SendAttachmentToProcess( | 21 bool AttachmentBrokerPrivilegedWin::SendAttachmentToProcess( |
| 22 BrokerableAttachment* attachment, | 22 const scoped_refptr<IPC::BrokerableAttachment>& attachment, |
| 23 base::ProcessId destination_process) { | 23 base::ProcessId destination_process) { |
| 24 switch (attachment->GetBrokerableType()) { | 24 switch (attachment->GetBrokerableType()) { |
| 25 case BrokerableAttachment::WIN_HANDLE: { | 25 case BrokerableAttachment::WIN_HANDLE: { |
| 26 const internal::HandleAttachmentWin* handle_attachment = | 26 const internal::HandleAttachmentWin* handle_attachment = |
| 27 static_cast<const internal::HandleAttachmentWin*>(attachment); | 27 static_cast<const internal::HandleAttachmentWin*>(attachment.get()); |
| 28 HandleWireFormat wire_format = | 28 HandleWireFormat wire_format = |
| 29 handle_attachment->GetWireFormat(destination_process); | 29 handle_attachment->GetWireFormat(destination_process); |
| 30 HandleWireFormat new_wire_format = | 30 HandleWireFormat new_wire_format = |
| 31 DuplicateWinHandle(wire_format, base::Process::Current().Pid()); | 31 DuplicateWinHandle(wire_format, base::Process::Current().Pid()); |
| 32 if (new_wire_format.handle == 0) | 32 if (new_wire_format.handle == 0) |
| 33 return false; | 33 return false; |
| 34 RouteDuplicatedHandle(new_wire_format); | 34 RouteDuplicatedHandle(new_wire_format); |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 case BrokerableAttachment::MACH_PORT: | 37 case BrokerableAttachment::MACH_PORT: |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 AttachmentBrokerPrivilegedWin::HandleWireFormat | 136 AttachmentBrokerPrivilegedWin::HandleWireFormat |
| 137 AttachmentBrokerPrivilegedWin::CopyWireFormat( | 137 AttachmentBrokerPrivilegedWin::CopyWireFormat( |
| 138 const HandleWireFormat& wire_format, | 138 const HandleWireFormat& wire_format, |
| 139 int handle) { | 139 int handle) { |
| 140 return HandleWireFormat(handle, wire_format.destination_process, | 140 return HandleWireFormat(handle, wire_format.destination_process, |
| 141 wire_format.permissions, wire_format.attachment_id); | 141 wire_format.permissions, wire_format.attachment_id); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace IPC | 144 } // namespace IPC |
| OLD | NEW |