Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: ipc/attachment_broker.h

Issue 1205713002: Make attachment broker a subclass of IPC::Listener. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attachment_broker3_listener_base
Patch Set: Update copyright date. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/BUILD.gn ('k') | ipc/attachment_broker_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ATTACHMENT_BROKER_H_ 5 #ifndef IPC_ATTACHMENT_BROKER_H_
6 #define IPC_ATTACHMENT_BROKER_H_ 6 #define IPC_ATTACHMENT_BROKER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/process/process_handle.h" 9 #include "base/process/process_handle.h"
10 #include "ipc/brokerable_attachment.h" 10 #include "ipc/brokerable_attachment.h"
11 #include "ipc/ipc_export.h" 11 #include "ipc/ipc_export.h"
12 #include "ipc/ipc_listener.h"
12 13
13 namespace IPC { 14 namespace IPC {
14 15
15 class AttachmentBroker; 16 class AttachmentBroker;
16 // Classes that inherit from this abstract base class are capable of 17 // Classes that inherit from this abstract base class are capable of
17 // communicating with a broker to send and receive attachments to Chrome IPC 18 // communicating with a broker to send and receive attachments to Chrome IPC
18 // messages. 19 // messages.
19 class IPC_EXPORT SupportsAttachmentBrokering { 20 class IPC_EXPORT SupportsAttachmentBrokering {
20 public: 21 public:
21 // Returns an AttachmentBroker used to broker attachments of IPC messages to 22 // Returns an AttachmentBroker used to broker attachments of IPC messages to
22 // other processes. There must be exactly one AttachmentBroker per process. 23 // other processes. There must be exactly one AttachmentBroker per process.
23 virtual AttachmentBroker* GetAttachmentBroker() = 0; 24 virtual AttachmentBroker* GetAttachmentBroker() = 0;
24 }; 25 };
25 26
26 // Responsible for brokering attachments to Chrome IPC messages. On platforms 27 // Responsible for brokering attachments to Chrome IPC messages. On platforms
27 // that support attachment brokering, every IPC channel should have a reference 28 // that support attachment brokering, every IPC channel should have a reference
28 // to a AttachmentBroker. 29 // to a AttachmentBroker.
29 class IPC_EXPORT AttachmentBroker { 30 class IPC_EXPORT AttachmentBroker : public Listener {
30 public: 31 public:
31 AttachmentBroker() {} 32 AttachmentBroker() {}
32 virtual ~AttachmentBroker() {} 33 ~AttachmentBroker() override {}
33 34
34 // Sends |attachment| to |destination_process|. The implementation uses an 35 // Sends |attachment| to |destination_process|. The implementation uses an
35 // IPC::Channel to communicate with the broker process. This may be the same 36 // IPC::Channel to communicate with the broker process. This may be the same
36 // IPC::Channel that is requesting the brokering of an attachment. 37 // IPC::Channel that is requesting the brokering of an attachment.
37 // Returns true on success and false otherwise. 38 // Returns true on success and false otherwise.
38 virtual bool SendAttachmentToProcess(const BrokerableAttachment* attachment, 39 virtual bool SendAttachmentToProcess(const BrokerableAttachment* attachment,
39 base::ProcessId destination_process) = 0; 40 base::ProcessId destination_process) = 0;
40 41
41 // Returns whether the attachment was available. If the attachment was 42 // Returns whether the attachment was available. If the attachment was
42 // available, populates the output parameter |attachment|. The caller then 43 // available, populates the output parameter |attachment|. The caller then
43 // becomes the owner of |attachment|. 44 // becomes the owner of |attachment|.
44 virtual bool GetAttachmentWithId(BrokerableAttachment::AttachmentId id, 45 virtual bool GetAttachmentWithId(BrokerableAttachment::AttachmentId id,
45 BrokerableAttachment* attachment) = 0; 46 BrokerableAttachment* attachment) = 0;
46 47
47 private: 48 private:
48 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); 49 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker);
49 }; 50 };
50 51
51 } // namespace IPC 52 } // namespace IPC
52 53
53 #endif // IPC_ATTACHMENT_BROKER_H_ 54 #endif // IPC_ATTACHMENT_BROKER_H_
OLDNEW
« no previous file with comments | « ipc/BUILD.gn ('k') | ipc/attachment_broker_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698