OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef IPC_BROKERABLE_ATTACHMENT_H_ | |
6 #define IPC_BROKERABLE_ATTACHMENT_H_ | |
7 | |
8 #include <stddef.h> | |
9 #include <stdint.h> | |
10 | |
11 #include <algorithm> | |
12 | |
13 #include "base/macros.h" | |
14 #include "build/build_config.h" | |
15 #include "ipc/ipc_export.h" | |
16 #include "ipc/ipc_message_attachment.h" | |
17 | |
18 namespace IPC { | |
19 | |
20 // This subclass of MessageAttachment requires an AttachmentBroker to be | |
21 // attached to a Chrome IPC message. | |
22 class IPC_EXPORT BrokerableAttachment : public MessageAttachment { | |
23 public: | |
24 enum BrokerableType { | |
25 PLACEHOLDER, | |
26 WIN_HANDLE, | |
27 MACH_PORT, | |
28 }; | |
29 | |
30 // Whether the attachment still needs information from the broker before it | |
31 // can be used. | |
32 bool NeedsBrokering() const; | |
33 | |
34 // Returns TYPE_BROKERABLE_ATTACHMENT | |
35 Type GetType() const override; | |
36 | |
37 virtual BrokerableType GetBrokerableType() const = 0; | |
38 | |
39 // MessageAttachment override. | |
40 #if defined(OS_POSIX) | |
41 base::PlatformFile TakePlatformFile() override; | |
42 #endif // OS_POSIX | |
43 | |
44 protected: | |
45 BrokerableAttachment(); | |
46 ~BrokerableAttachment() override; | |
47 | |
48 private: | |
49 DISALLOW_COPY_AND_ASSIGN(BrokerableAttachment); | |
50 }; | |
51 | |
52 } // namespace IPC | |
53 | |
54 #endif // IPC_BROKERABLE_ATTACHMENT_H_ | |
OLD | NEW |