OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_ |
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 kStartupPages, | 79 kStartupPages, |
80 kMediaGalleriesAllGalleriesDelete, | 80 kMediaGalleriesAllGalleriesDelete, |
81 kScreenlockPrivate, | 81 kScreenlockPrivate, |
82 kHideBookmarkButton, | 82 kHideBookmarkButton, |
83 kEnumBoundary, | 83 kEnumBoundary, |
84 }; | 84 }; |
85 COMPILE_ASSERT(PermissionMessage::kNone > PermissionMessage::kUnknown, | 85 COMPILE_ASSERT(PermissionMessage::kNone > PermissionMessage::kUnknown, |
86 kNone_not_greater_than_kUnknown); | 86 kNone_not_greater_than_kUnknown); |
87 | 87 |
88 // Creates the corresponding permission message. | 88 // Creates the corresponding permission message. |
89 PermissionMessage(ID id, const string16& message); | 89 PermissionMessage(ID id, const base::string16& message); |
90 PermissionMessage(ID id, const string16& message, const string16& details); | 90 PermissionMessage(ID id, |
| 91 const base::string16& message, |
| 92 const base::string16& details); |
91 ~PermissionMessage(); | 93 ~PermissionMessage(); |
92 | 94 |
93 // Gets the id of the permission message, which can be used in UMA | 95 // Gets the id of the permission message, which can be used in UMA |
94 // histograms. | 96 // histograms. |
95 ID id() const { return id_; } | 97 ID id() const { return id_; } |
96 | 98 |
97 // Gets a localized message describing this permission. Please note that | 99 // Gets a localized message describing this permission. Please note that |
98 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN. | 100 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN. |
99 const string16& message() const { return message_; } | 101 const base::string16& message() const { return message_; } |
100 | 102 |
101 // Gets a localized message describing the details for this permission. Please | 103 // Gets a localized message describing the details for this permission. Please |
102 // note that the message will be empty for message types TYPE_NONE and | 104 // note that the message will be empty for message types TYPE_NONE and |
103 // TYPE_UNKNOWN. | 105 // TYPE_UNKNOWN. |
104 const string16& details() const { return details_; } | 106 const base::string16& details() const { return details_; } |
105 | 107 |
106 // Comparator to work with std::set. | 108 // Comparator to work with std::set. |
107 bool operator<(const PermissionMessage& that) const { | 109 bool operator<(const PermissionMessage& that) const { |
108 return id_ < that.id_; | 110 return id_ < that.id_; |
109 } | 111 } |
110 // Comparator to work with base::STLSetDifference. | 112 // Comparator to work with base::STLSetDifference. |
111 bool operator>(const PermissionMessage& that) const { | 113 bool operator>(const PermissionMessage& that) const { |
112 return id_ > that.id_; | 114 return id_ > that.id_; |
113 } | 115 } |
114 | 116 |
115 private: | 117 private: |
116 ID id_; | 118 ID id_; |
117 string16 message_; | 119 base::string16 message_; |
118 string16 details_; | 120 base::string16 details_; |
119 }; | 121 }; |
120 | 122 |
121 typedef std::vector<PermissionMessage> PermissionMessages; | 123 typedef std::vector<PermissionMessage> PermissionMessages; |
122 | 124 |
123 } // namespace extensions | 125 } // namespace extensions |
124 | 126 |
125 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_ | 127 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_ |
OLD | NEW |