Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Side by Side Diff: extensions/common/permissions/permission_message.h

Issue 1213623006: Extensions: Remove PermissionMessage (permission_message.h/cc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kill_getmessages
Patch Set: fix app_shell build, rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/strings/string16.h"
13
14 namespace extensions {
15
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 // TODO(sashab): Deprecate these IDs - use whatever APIPermission::ID becomes
25 // instead.
26 enum ID {
27 kUnknown,
28 kNone,
29 kBookmarks,
30 kGeolocation,
31 kBrowsingHistory,
32 kTabs,
33 kManagement,
34 kDebugger,
35 kDesktopCapture,
36 kHid,
37 kHosts1,
38 kHosts2,
39 kHosts3,
40 kHosts4OrMore,
41 kHostsAll,
42 kFullAccess,
43 kClipboard,
44 kTtsEngine,
45 kContentSettings,
46 kPrivacy,
47 kSupervisedUser,
48 kInput,
49 kAudioCapture,
50 kVideoCapture,
51 kDownloads,
52 kDeleted_FileSystemWrite,
53 kMediaGalleriesAllGalleriesRead,
54 kSerial,
55 kSocketAnyHost,
56 kSocketDomainHosts,
57 kSocketSpecificHosts,
58 kBluetooth,
59 kUsb,
60 kSystemIndicator,
61 kUsbDevice,
62 kMediaGalleriesAllGalleriesCopyTo,
63 kSystemInfoDisplay,
64 kNativeMessaging,
65 kSyncFileSystem,
66 kAudio,
67 kFavicon,
68 kMusicManagerPrivate,
69 kWebConnectable,
70 kActivityLogPrivate,
71 kBluetoothDevices,
72 kDownloadsOpen,
73 kNetworkingPrivate,
74 kDeclarativeWebRequest,
75 kFileSystemDirectory,
76 kFileSystemWriteDirectory,
77 kSignedInDevices,
78 kWallpaper,
79 kNetworkState,
80 kHomepage,
81 kSearchProvider,
82 kStartupPages,
83 kMediaGalleriesAllGalleriesDelete,
84 kScreenlockPrivate,
85 kOverrideBookmarksUI,
86 kAutomation,
87 kAccessibilityFeaturesModify,
88 kAccessibilityFeaturesRead,
89 kBluetoothPrivate,
90 kIdentityEmail,
91 kExperienceSamplingPrivate,
92 kCopresence,
93 kTopSites,
94 kU2fDevices,
95 kDocumentScan,
96 kNetworkingConfig,
97 kPlatformKeys,
98 kMDns,
99 kVpnProvider,
100 kHosts1ReadOnly,
101 kHosts2ReadOnly,
102 kHosts3ReadOnly,
103 kHosts4OrMoreReadOnly,
104 kHostsAllReadOnly,
105 kInterceptAllKeys,
106 kSettingsPrivate,
107 kPrinterProvider,
108 kSearchEnginesPrivate,
109 kAutofillPrivate,
110 kPasswordsPrivate,
111 kUsersPrivate,
112 // Last entry: Add new entries above.
113 kEnumBoundary,
114 };
115 static_assert(PermissionMessage::kNone > PermissionMessage::kUnknown,
116 "kNone should not greater than kUnknown");
117
118 // Creates the corresponding permission message.
119 PermissionMessage(ID id, const base::string16& message);
120 PermissionMessage(ID id,
121 const base::string16& message,
122 const base::string16& details);
123 ~PermissionMessage();
124
125 // Gets the id of the permission message, which can be used in UMA
126 // histograms.
127 ID id() const { return id_; }
128
129 // Gets a localized message describing this permission. Please note that
130 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN.
131 const base::string16& message() const { return message_; }
132
133 // Gets a localized message describing the details for this permission. Please
134 // note that the message will be empty for message types TYPE_NONE and
135 // TYPE_UNKNOWN.
136 const base::string16& details() const { return details_; }
137
138 // Comparator to work with std::set.
139 bool operator<(const PermissionMessage& that) const {
140 return id_ < that.id_;
141 }
142 // Comparator to work with base::STLSetDifference.
143 bool operator>(const PermissionMessage& that) const {
144 return id_ > that.id_;
145 }
146
147 private:
148 ID id_;
149 base::string16 message_;
150 base::string16 details_;
151 };
152
153 typedef std::vector<PermissionMessage> PermissionMessages;
154
155 } // namespace extensions
156
157 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_
OLDNEW
« no previous file with comments | « extensions/common/permissions/media_galleries_permission.cc ('k') | extensions/common/permissions/permission_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698