summaryrefslogtreecommitdiffstats
path: root/ipc/attachment_broker_privileged_win.h
blob: 67104b84fde4100c6a9504d97ed66ad9bc1ba836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_
#define IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_

#include "ipc/attachment_broker_privileged.h"
#include "ipc/handle_attachment_win.h"
#include "ipc/ipc_export.h"

namespace IPC {

// This class is a concrete subclass of AttachmentBrokerPrivileged for the
// Windows platform.
class IPC_EXPORT AttachmentBrokerPrivilegedWin
    : public AttachmentBrokerPrivileged {
 public:
  AttachmentBrokerPrivilegedWin();
  ~AttachmentBrokerPrivilegedWin() override;

  // IPC::AttachmentBroker overrides.
  bool SendAttachmentToProcess(const BrokerableAttachment* attachment,
                               base::ProcessId destination_process) override;

  // IPC::Listener overrides.
  bool OnMessageReceived(const Message& message) override;

 private:
  using HandleWireFormat = internal::HandleAttachmentWin::WireFormat;
  // IPC message handlers.
  void OnDuplicateWinHandle(const Message& message);

  // Duplicates |wire_Format| from |source_process| into its destination
  // process.
  HandleWireFormat DuplicateWinHandle(const HandleWireFormat& wire_format,
                                      base::ProcessId source_process);

  // If the HANDLE's destination is this process, queue it and notify the
  // observers. Otherwise, send it in an IPC to its destination.
  void RouteDuplicatedHandle(const HandleWireFormat& wire_format);

  DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivilegedWin);
};

}  // namespace IPC

#endif  // IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_