Remove base's implicit_cast.
[chromium-blink-merge.git] / ipc / handle_attachment_win.h
blobcd086b9eb3397671eed1ae6e9f6bb9e9b2c47de7
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
3 // found in the LICENSE file.
5 #ifndef IPC_HANDLE_ATTACHMENT_WIN_H_
6 #define IPC_HANDLE_ATTACHMENT_WIN_H_
8 #include <stdint.h>
10 #include "base/process/process_handle.h"
11 #include "ipc/brokerable_attachment.h"
12 #include "ipc/handle_win.h"
13 #include "ipc/ipc_export.h"
15 namespace IPC {
16 namespace internal {
18 // This class represents a Windows HANDLE attached to a Chrome IPC message.
19 class IPC_EXPORT HandleAttachmentWin : public BrokerableAttachment {
20 public:
21 // The wire format for this handle.
22 struct IPC_EXPORT WireFormat {
23 // The HANDLE that is intended for duplication, or the HANDLE that has been
24 // duplicated, depending on context.
25 // The type is int32_t instead of HANDLE because HANDLE gets typedefed to
26 // void*, whose size varies between 32 and 64-bit processes. Using a
27 // int32_t means that 64-bit processes will need to perform both up-casting
28 // and down-casting. This is performed using the appropriate Windows apis.
29 // A value of 0 is equivalent to an invalid handle.
30 int32_t handle;
31 // The id of the destination process that the handle is duplicated into.
32 base::ProcessId destination_process;
33 // The permissions to use when duplicating the handle.
34 HandleWin::Permissions permissions;
35 AttachmentId attachment_id;
38 HandleAttachmentWin(const HANDLE& handle, HandleWin::Permissions permissions);
39 explicit HandleAttachmentWin(const WireFormat& wire_format);
40 explicit HandleAttachmentWin(const BrokerableAttachment::AttachmentId& id);
42 BrokerableType GetBrokerableType() const override;
44 // Returns the wire format of this attachment.
45 WireFormat GetWireFormat(const base::ProcessId& destination) const;
47 HANDLE get_handle() const { return handle_; }
49 private:
50 ~HandleAttachmentWin() override;
51 HANDLE handle_;
52 HandleWin::Permissions permissions_;
55 } // namespace internal
56 } // namespace IPC
58 #endif // IPC_HANDLE_ATTACHMENT_WIN_H_