summaryrefslogtreecommitdiffstats
path: root/ipc/attachment_broker_unprivileged_mac.h
blob: aa058e3ae1910fb8642120c9507328fb45c28921 (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
// 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_UNPRIVILEGED_MAC_H_
#define IPC_ATTACHMENT_BROKER_UNPRIVILEGED_MAC_H_

#include "base/macros.h"
#include "ipc/attachment_broker_unprivileged.h"
#include "ipc/ipc_export.h"
#include "ipc/mach_port_attachment_mac.h"

namespace IPC {

class BrokerableAttachment;

// This class is an implementation of AttachmentBroker for the OSX platform
// for non-privileged processes.
class IPC_EXPORT AttachmentBrokerUnprivilegedMac
    : public IPC::AttachmentBrokerUnprivileged {
 public:
  AttachmentBrokerUnprivilegedMac();
  ~AttachmentBrokerUnprivilegedMac() override;

  // IPC::AttachmentBroker overrides.
  bool SendAttachmentToProcess(
      const scoped_refptr<IPC::BrokerableAttachment>& attachment,
      base::ProcessId destination_process) override;

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

 private:
  // IPC message handlers.
  void OnMachPortHasBeenDuplicated(
      const IPC::internal::MachPortAttachmentMac::WireFormat& wire_format);

  DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerUnprivilegedMac);
};

}  // namespace IPC

#endif  // IPC_ATTACHMENT_BROKER_UNPRIVILEGED_MAC_H_