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

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

Issue 10675007: Move each permission classes to its own files in extensions/permissions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase again Created 8 years, 5 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 (c) 2012 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 CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_
7 #pragma once
8
9 #include <set>
10 #include <string>
11 #include <vector>
12
13 #include "base/string16.h"
14
15 namespace extensions {
16
17 // When prompting the user to install or approve permissions, we display
18 // messages describing the effects of the permissions rather than listing the
19 // permissions themselves. Each PermissionMessage represents one of the
20 // messages shown to the user.
21 class PermissionMessage {
22 public:
23 // Do not reorder this enumeration. If you need to add a new enum, add it just
24 // prior to kEnumBoundary.
25 enum ID {
26 kUnknown,
27 kNone,
28 kBookmarks,
29 kGeolocation,
30 kBrowsingHistory,
31 kTabs,
32 kManagement,
33 kDebugger,
34 kHosts1,
35 kHosts2,
36 kHosts3,
37 kHosts4OrMore,
38 kHostsAll,
39 kFullAccess,
40 kClipboard,
41 kTtsEngine,
42 kContentSettings,
43 kAllPageContent,
44 kPrivacy,
45 kManagedMode,
46 kInput,
47 kAudioCapture,
48 kVideoCapture,
49 kDownloads,
50 kEnumBoundary
51 };
52
53 // Creates the corresponding permission message for a list of hosts. This is
54 // simply a convenience method around the constructor, since the messages
55 // change depending on what hosts are present.
56 static PermissionMessage CreateFromHostList(
57 const std::set<std::string>& hosts);
58
59 // Creates the corresponding permission message.
60 PermissionMessage(ID id, const string16& message);
61 ~PermissionMessage();
62
63 // Gets the id of the permission message, which can be used in UMA
64 // histograms.
65 ID id() const { return id_; }
66
67 // Gets a localized message describing this permission. Please note that
68 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN.
69 const string16& message() const { return message_; }
70
71 // Comparator to work with std::set.
72 bool operator<(const PermissionMessage& that) const {
73 return id_ < that.id_;
74 }
75
76 private:
77 ID id_;
78 string16 message_;
79 };
80
81 typedef std::vector<PermissionMessage> PermissionMessages;
82
83 } // namespace extensions
84
85 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/api_permission.cc ('k') | chrome/common/extensions/permissions/permission_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698