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

Side by Side Diff: ipc/attachment_broker_privileged_win.h

Issue 1256993003: ipc: Create AttachmentBrokerPrivileged and AttachmentBrokerUnprivileged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_ipc_message_feature
Patch Set: Rebase. Created 5 years, 4 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
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_PRIVILEGED_WIN_H_ 5 #ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_
6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_ 6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_
7 7
8 #include <vector> 8 #include "ipc/attachment_broker_privileged.h"
9
10 #include "ipc/attachment_broker.h"
11 #include "ipc/handle_attachment_win.h" 9 #include "ipc/handle_attachment_win.h"
12 #include "ipc/ipc_export.h" 10 #include "ipc/ipc_export.h"
13 11
14 namespace IPC { 12 namespace IPC {
15 13
16 class Channel; 14 // This class is a concrete subclass of AttachmentBrokerPrivileged for the
17 15 // Windows platform.
18 // This class is an implementation of AttachmentBroker for a privileged process 16 class IPC_EXPORT AttachmentBrokerPrivilegedWin
19 // on the Windows platform. When unprivileged processes want to send 17 : public AttachmentBrokerPrivileged {
20 // attachments, the attachments get routed through the privileged process, and
21 // more specifically, an instance of this class.
22 class IPC_EXPORT AttachmentBrokerPrivilegedWin : public AttachmentBroker {
23 public: 18 public:
24 AttachmentBrokerPrivilegedWin(); 19 AttachmentBrokerPrivilegedWin();
25 ~AttachmentBrokerPrivilegedWin() override; 20 ~AttachmentBrokerPrivilegedWin() override;
26 21
27 // IPC::AttachmentBroker overrides. 22 // IPC::AttachmentBroker overrides.
28 bool SendAttachmentToProcess(const BrokerableAttachment* attachment, 23 bool SendAttachmentToProcess(const BrokerableAttachment* attachment,
29 base::ProcessId destination_process) override; 24 base::ProcessId destination_process) override;
30 25
31 // IPC::Listener overrides. 26 // IPC::Listener overrides.
32 bool OnMessageReceived(const Message& message) override; 27 bool OnMessageReceived(const Message& message) override;
33 28
34 // Each unprivileged process should have one IPC channel on which it
35 // communicates attachment information with this privileged process. These
36 // channels must be registered and deregistered with the Attachment Broker as
37 // they are created and destroyed.
38 void RegisterCommunicationChannel(Channel* channel);
39 void DeregisterCommunicationChannel(Channel* channel);
40
41 private: 29 private:
42 using HandleWireFormat = internal::HandleAttachmentWin::WireFormat; 30 using HandleWireFormat = internal::HandleAttachmentWin::WireFormat;
43 // IPC message handlers. 31 // IPC message handlers.
44 void OnDuplicateWinHandle(const IPC::Message& message); 32 void OnDuplicateWinHandle(const IPC::Message& message);
45 33
46 // Duplicates |wire_Format| from |source_process| into its destination 34 // Duplicates |wire_Format| from |source_process| into its destination
47 // process. 35 // process.
48 HandleWireFormat DuplicateWinHandle(const HandleWireFormat& wire_format, 36 HandleWireFormat DuplicateWinHandle(const HandleWireFormat& wire_format,
49 base::ProcessId source_process); 37 base::ProcessId source_process);
50 38
51 // If the HANDLE's destination is this process, queue it and notify the 39 // If the HANDLE's destination is this process, queue it and notify the
52 // observers. Otherwise, send it in an IPC to its destination. 40 // observers. Otherwise, send it in an IPC to its destination.
53 void RouteDuplicatedHandle(const HandleWireFormat& wire_format); 41 void RouteDuplicatedHandle(const HandleWireFormat& wire_format);
54 42
55 std::vector<Channel*> channels_;
56 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivilegedWin); 43 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivilegedWin);
57 }; 44 };
58 45
59 } // namespace IPC 46 } // namespace IPC
60 47
61 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_ 48 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698