Connect PPAPI IPC channels for non-SFI mode.
[chromium-blink-merge.git] / extensions / common / permissions / permission_message.h
blob9c3fe7ec1ca193a9301ceab046ceacf7e0df8850
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/strings/string16.h"
14 namespace extensions {
16 // When prompting the user to install or approve permissions, we display
17 // messages describing the effects of the permissions rather than listing the
18 // permissions themselves. Each PermissionMessage represents one of the
19 // messages shown to the user.
20 class PermissionMessage {
21 public:
22 // Do not reorder this enumeration. If you need to add a new enum, add it just
23 // prior to kEnumBoundary.
24 enum ID {
25 kUnknown,
26 kNone,
27 kBookmarks,
28 kGeolocation,
29 kBrowsingHistory,
30 kTabs,
31 kManagement,
32 kDebugger,
33 kDesktopCapture,
34 kHid,
35 kHosts1,
36 kHosts2,
37 kHosts3,
38 kHosts4OrMore,
39 kHostsAll,
40 kFullAccess,
41 kClipboard,
42 kTtsEngine,
43 kContentSettings,
44 kPrivacy,
45 kManagedMode,
46 kInput,
47 kAudioCapture,
48 kVideoCapture,
49 kDownloads,
50 kFileSystemWrite,
51 kMediaGalleriesAllGalleriesRead,
52 kSerial,
53 kSocketAnyHost,
54 kSocketDomainHosts,
55 kSocketSpecificHosts,
56 kBluetooth,
57 kUsb,
58 kSystemIndicator,
59 kUsbDevice,
60 kMediaGalleriesAllGalleriesCopyTo,
61 kSystemInfoDisplay,
62 kNativeMessaging,
63 kSyncFileSystem,
64 kAudio,
65 kFavicon,
66 kMusicManagerPrivate,
67 kWebConnectable,
68 kActivityLogPrivate,
69 kBluetoothDevices,
70 kDownloadsOpen,
71 kNetworkingPrivate,
72 kDeclarativeWebRequest,
73 kFileSystemDirectory,
74 kFileSystemWriteDirectory,
75 kSignedInDevices,
76 kWallpaper,
77 kNetworkState,
78 kHomepage,
79 kSearchProvider,
80 kStartupPages,
81 kMediaGalleriesAllGalleriesDelete,
82 kScreenlockPrivate,
83 kOverrideBookmarksUI,
84 kEnumBoundary,
86 COMPILE_ASSERT(PermissionMessage::kNone > PermissionMessage::kUnknown,
87 kNone_not_greater_than_kUnknown);
89 // Creates the corresponding permission message.
90 PermissionMessage(ID id, const base::string16& message);
91 PermissionMessage(ID id,
92 const base::string16& message,
93 const base::string16& details);
94 ~PermissionMessage();
96 // Gets the id of the permission message, which can be used in UMA
97 // histograms.
98 ID id() const { return id_; }
100 // Gets a localized message describing this permission. Please note that
101 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN.
102 const base::string16& message() const { return message_; }
104 // Gets a localized message describing the details for this permission. Please
105 // note that the message will be empty for message types TYPE_NONE and
106 // TYPE_UNKNOWN.
107 const base::string16& details() const { return details_; }
109 // Comparator to work with std::set.
110 bool operator<(const PermissionMessage& that) const {
111 return id_ < that.id_;
113 // Comparator to work with base::STLSetDifference.
114 bool operator>(const PermissionMessage& that) const {
115 return id_ > that.id_;
118 private:
119 ID id_;
120 base::string16 message_;
121 base::string16 details_;
124 typedef std::vector<PermissionMessage> PermissionMessages;
126 } // namespace extensions
128 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_