Stub in more IPC attachment brokering functionality.
This CL fills in most of the logic for sending a Windows HANDLE from a
non-broker process to the broker process. This consists of several small
changes:
- Create the new IPC messages AttachmentBrokerMsg_WinHandleHasBeenBrokered and
AttachmentBrokerMsg_RequestBrokerageOfWinHandle.
- Add a sender_ member variable to AttachmentBrokerWin.
- Define the wire format for HandleAttachmentWin.
- Add logic to ChannelWin to send
AttachmentBrokerMsg_RequestBrokerageOfWinHandle for each HANDLE attachment.
BUG=466437
Review URL: https://codereview.chromium.org/1188923003
Cr-Commit-Position: refs/heads/master@{#337689}
diff --git a/ipc/handle_attachment_win.cc b/ipc/handle_attachment_win.cc
new file mode 100644
index 0000000..3c18828
--- /dev/null
+++ b/ipc/handle_attachment_win.cc
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ipc/handle_attachment_win.h"
+
+#include <windows.h>
+
+namespace IPC {
+namespace internal {
+
+HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle)
+ : handle_(handle) {
+}
+
+HandleAttachmentWin::~HandleAttachmentWin() {
+}
+
+HandleAttachmentWin::BrokerableType HandleAttachmentWin::GetBrokerableType()
+ const {
+ return WIN_HANDLE;
+}
+
+HandleAttachmentWin::WireFormat HandleAttachmentWin::GetWireFormat(
+ const base::ProcessId& destination) const {
+ WireFormat format;
+ format.handle = HandleToLong(handle_);
+ format.attachment_id = GetIdentifier();
+ format.destination_process = destination;
+ return format;
+}
+
+} // namespace internal
+} // namespace IPC