Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ | 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 kEnumBoundary, | 68 kEnumBoundary, |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // Creates the corresponding permission message for a list of hosts. This is | 71 // Creates the corresponding permission message for a list of hosts. This is |
| 72 // simply a convenience method around the constructor, since the messages | 72 // simply a convenience method around the constructor, since the messages |
| 73 // change depending on what hosts are present. | 73 // change depending on what hosts are present. |
| 74 static PermissionMessage CreateFromHostList( | 74 static PermissionMessage CreateFromHostList( |
| 75 const std::set<std::string>& hosts); | 75 const std::set<std::string>& hosts); |
| 76 | 76 |
| 77 // Creates the corresponding permission message. | 77 // Creates the corresponding permission message. |
| 78 PermissionMessage(ID id, const string16& message); | 78 PermissionMessage(ID id, const string16& message, const string16& details); |
|
Yoyo Zhou
2013/07/11 17:39:48
nit: you could add a form of the constructor with
| |
| 79 ~PermissionMessage(); | 79 ~PermissionMessage(); |
| 80 | 80 |
| 81 // Gets the id of the permission message, which can be used in UMA | 81 // Gets the id of the permission message, which can be used in UMA |
| 82 // histograms. | 82 // histograms. |
| 83 ID id() const { return id_; } | 83 ID id() const { return id_; } |
| 84 | 84 |
| 85 // Gets a localized message describing this permission. Please note that | 85 // Gets a localized message describing this permission. Please note that |
| 86 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN. | 86 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN. |
| 87 const string16& message() const { return message_; } | 87 const string16& message() const { return message_; } |
| 88 | 88 |
| 89 // Gets a localized message describing the details for this permission. Please | |
| 90 // note that the message will be empty for message types TYPE_NONE and | |
| 91 // TYPE_UNKNOWN. | |
| 92 const string16& details() const { return details_; } | |
| 93 | |
| 89 // Comparator to work with std::set. | 94 // Comparator to work with std::set. |
| 90 bool operator<(const PermissionMessage& that) const { | 95 bool operator<(const PermissionMessage& that) const { |
| 91 return id_ < that.id_; | 96 return id_ < that.id_; |
| 92 } | 97 } |
| 93 | 98 |
| 94 private: | 99 private: |
| 95 ID id_; | 100 ID id_; |
| 96 string16 message_; | 101 string16 message_; |
| 102 string16 details_; | |
| 97 }; | 103 }; |
| 98 | 104 |
| 99 typedef std::vector<PermissionMessage> PermissionMessages; | 105 typedef std::vector<PermissionMessage> PermissionMessages; |
| 100 | 106 |
| 101 } // namespace extensions | 107 } // namespace extensions |
| 102 | 108 |
| 103 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ | 109 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ |
| OLD | NEW |