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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
// Copyright 2013 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 EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_
#define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/strings/string16.h"
namespace extensions {
// When prompting the user to install or approve permissions, we display
// messages describing the effects of the permissions rather than listing the
// permissions themselves. Each PermissionMessage represents one of the
// messages shown to the user.
class PermissionMessage {
public:
// Do not reorder this enumeration. If you need to add a new enum, add it just
// prior to kEnumBoundary.
// TODO(sashab): Deprecate these IDs - use whatever APIPermission::ID becomes
// instead.
enum ID {
kUnknown,
kNone,
kBookmarks,
kGeolocation,
kBrowsingHistory,
kTabs,
kManagement,
kDebugger,
kDesktopCapture,
kHid,
kHosts1,
kHosts2,
kHosts3,
kHosts4OrMore,
kHostsAll,
kFullAccess,
kClipboard,
kTtsEngine,
kContentSettings,
kPrivacy,
kSupervisedUser,
kInput,
kAudioCapture,
kVideoCapture,
kDownloads,
kDeleted_FileSystemWrite,
kMediaGalleriesAllGalleriesRead,
kSerial,
kSocketAnyHost,
kSocketDomainHosts,
kSocketSpecificHosts,
kBluetooth,
kUsb,
kSystemIndicator,
kUsbDevice,
kMediaGalleriesAllGalleriesCopyTo,
kSystemInfoDisplay,
kNativeMessaging,
kSyncFileSystem,
kAudio,
kFavicon,
kMusicManagerPrivate,
kWebConnectable,
kActivityLogPrivate,
kBluetoothDevices,
kDownloadsOpen,
kNetworkingPrivate,
kDeclarativeWebRequest,
kFileSystemDirectory,
kFileSystemWriteDirectory,
kSignedInDevices,
kWallpaper,
kNetworkState,
kHomepage,
kSearchProvider,
kStartupPages,
kMediaGalleriesAllGalleriesDelete,
kScreenlockPrivate,
kOverrideBookmarksUI,
kAutomation,
kAccessibilityFeaturesModify,
kAccessibilityFeaturesRead,
kBluetoothPrivate,
kIdentityEmail,
kExperienceSamplingPrivate,
kCopresence,
kTopSites,
kU2fDevices,
kVpnProvider,
kDocumentScan,
kHosts1ReadOnly,
kHosts2ReadOnly,
kHosts3ReadOnly,
kHosts4OrMoreReadOnly,
kHostsAllReadOnly,
kInterceptAllKeys,
kNetworkingConfig,
kPlatformKeys,
// Last entry: Add new entries above and ensure to update the
// "ExtensionPermission2" enum in tools/metrics/histograms/histograms.xml.
kEnumBoundary,
};
static_assert(PermissionMessage::kNone > PermissionMessage::kUnknown,
"kNone should not greater than kUnknown");
// Creates the corresponding permission message.
PermissionMessage(ID id, const base::string16& message);
PermissionMessage(ID id,
const base::string16& message,
const base::string16& details);
~PermissionMessage();
// Gets the id of the permission message, which can be used in UMA
// histograms.
ID id() const { return id_; }
// Gets a localized message describing this permission. Please note that
// the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN.
const base::string16& message() const { return message_; }
// Gets a localized message describing the details for this permission. Please
// note that the message will be empty for message types TYPE_NONE and
// TYPE_UNKNOWN.
const base::string16& details() const { return details_; }
// Comparator to work with std::set.
bool operator<(const PermissionMessage& that) const {
return id_ < that.id_;
}
// Comparator to work with base::STLSetDifference.
bool operator>(const PermissionMessage& that) const {
return id_ > that.id_;
}
private:
ID id_;
base::string16 message_;
base::string16 details_;
};
typedef std::vector<PermissionMessage> PermissionMessages;
} // namespace extensions
#endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_
|