forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
seatbelt_extension_token.h
64 lines (46 loc) · 1.73 KB
/
seatbelt_extension_token.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2017 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 SANDBOX_MAC_SEATBELT_EXTENSION_TOKEN_H_
#define SANDBOX_MAC_SEATBELT_EXTENSION_TOKEN_H_
#include "base/macros.h"
#include "sandbox/mac/seatbelt_export.h"
#include <memory>
#include <string>
namespace mojo {
template <typename, typename>
struct StructTraits;
}
namespace sandbox {
namespace mac {
namespace mojom {
class SeatbeltExtensionTokenDataView;
}
} // namespace mac
class SeatbeltExtension;
// A SeatbeltExtensionToken is used to pass a sandbox extension between
// processes using IPC. A token object can be constructed by issuing an
// extension in one process, sent across IPC, and then used to create a new
// extension object on the other side.
class SEATBELT_EXPORT SeatbeltExtensionToken {
public:
SeatbeltExtensionToken();
~SeatbeltExtensionToken();
// Token objects are move-only types.
SeatbeltExtensionToken(SeatbeltExtensionToken&& other);
SeatbeltExtensionToken& operator=(SeatbeltExtensionToken&&);
const std::string& token() const { return token_; }
// Creates a fake token for testing.
static SeatbeltExtensionToken CreateForTesting(const std::string& fake_token);
protected:
friend class SeatbeltExtension;
friend struct mojo::StructTraits<mac::mojom::SeatbeltExtensionTokenDataView,
SeatbeltExtensionToken>;
explicit SeatbeltExtensionToken(const std::string& token);
void set_token(const std::string& token) { token_ = token; }
private:
std::string token_;
DISALLOW_COPY_AND_ASSIGN(SeatbeltExtensionToken);
};
} // namespace sandbox
#endif // SANDBOX_MAC_SEATBELT_EXTENSION_TOKEN_H_