| 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 #ifndef IPC_BROKERABLE_ATTACHMENT_H_ | 5 #ifndef IPC_BROKERABLE_ATTACHMENT_H_ |
| 6 #define IPC_BROKERABLE_ATTACHMENT_H_ | 6 #define IPC_BROKERABLE_ATTACHMENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ipc/ipc_export.h" | 11 #include "ipc/ipc_export.h" |
| 12 #include "ipc/ipc_message_attachment.h" | 12 #include "ipc/ipc_message_attachment.h" |
| 13 | 13 |
| 14 namespace IPC { | 14 namespace IPC { |
| 15 | 15 |
| 16 // This subclass of MessageAttachment requires an AttachmentBroker to be | 16 // This subclass of MessageAttachment requires an AttachmentBroker to be |
| 17 // attached to a Chrome IPC message. | 17 // attached to a Chrome IPC message. |
| 18 class IPC_EXPORT BrokerableAttachment : public MessageAttachment { | 18 class IPC_EXPORT BrokerableAttachment : public MessageAttachment { |
| 19 public: | 19 public: |
| 20 static const size_t kNonceSize = 16; |
| 20 // An id uniquely identifies an attachment sent via a broker. | 21 // An id uniquely identifies an attachment sent via a broker. |
| 21 struct IPC_EXPORT AttachmentId { | 22 struct IPC_EXPORT AttachmentId { |
| 22 uint32_t nonce[4]; | 23 uint8_t nonce[kNonceSize]; |
| 24 }; |
| 25 |
| 26 enum BrokerableType { |
| 27 WIN_HANDLE, |
| 23 }; | 28 }; |
| 24 | 29 |
| 25 // The identifier is unique across all Chrome processes. | 30 // The identifier is unique across all Chrome processes. |
| 26 AttachmentId GetIdentifier() const; | 31 AttachmentId GetIdentifier() const; |
| 27 | 32 |
| 33 // Returns TYPE_BROKERABLE_ATTACHMENT |
| 34 Type GetType() const override; |
| 35 |
| 36 virtual BrokerableType GetBrokerableType() const = 0; |
| 37 |
| 28 protected: | 38 protected: |
| 29 BrokerableAttachment(); | 39 BrokerableAttachment(); |
| 30 ~BrokerableAttachment() override; | 40 ~BrokerableAttachment() override; |
| 31 | 41 |
| 32 private: | 42 private: |
| 33 // This member uniquely identifies a BrokerableAttachment across all Chrome | 43 // This member uniquely identifies a BrokerableAttachment across all Chrome |
| 34 // processes. | 44 // processes. |
| 35 AttachmentId id_; | 45 const AttachmentId id_; |
| 36 DISALLOW_COPY_AND_ASSIGN(BrokerableAttachment); | 46 DISALLOW_COPY_AND_ASSIGN(BrokerableAttachment); |
| 37 }; | 47 }; |
| 38 | 48 |
| 39 } // namespace IPC | 49 } // namespace IPC |
| 40 | 50 |
| 41 #endif // IPC_BROKERABLE_ATTACHMENT_H_ | 51 #endif // IPC_BROKERABLE_ATTACHMENT_H_ |
| OLD | NEW |