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
|
// Copyright (c) 2012 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 CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_
#define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_
#include <set>
#include <string>
#include <vector>
#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.
enum ID {
kUnknown,
kNone,
kBookmarks,
kGeolocation,
kBrowsingHistory,
kTabs,
kManagement,
kDebugger,
kHosts1,
kHosts2,
kHosts3,
kHosts4OrMore,
kHostsAll,
kFullAccess,
kClipboard,
kTtsEngine,
kContentSettings,
kPrivacy,
kManagedMode,
kInput,
kAudioCapture,
kVideoCapture,
kDownloads,
kFileSystemWrite,
kMediaGalleriesAllGalleriesRead,
kSerial,
kSocketAnyHost,
kSocketDomainHosts,
kSocketSpecificHosts,
kBluetooth,
kUsb,
kSystemIndicator,
kBluetoothDevice,
kUsbDevice,
kMediaGalleriesAllGalleriesWrite,
kSystemInfoDisplay,
kNativeMessaging,
kSyncFileSystem,
kAudio,
kFavicon,
kMusicManagerPrivate,
kWebConnectable,
kEnumBoundary,
};
// Creates the corresponding permission message for a list of hosts. This is
// simply a convenience method around the constructor, since the messages
// change depending on what hosts are present.
static PermissionMessage CreateFromHostList(
const std::set<std::string>& hosts);
// Creates the corresponding permission message.
PermissionMessage(ID id, const string16& message);
~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 string16& message() const { return message_; }
// Comparator to work with std::set.
bool operator<(const PermissionMessage& that) const {
return id_ < that.id_;
}
private:
ID id_;
string16 message_;
};
typedef std::vector<PermissionMessage> PermissionMessages;
} // namespace extensions
#endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_
|