| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 79 PermissionMessage(ID id, const string16& message, const string16& details); |
| 79 ~PermissionMessage(); | 80 ~PermissionMessage(); |
| 80 | 81 |
| 81 // Gets the id of the permission message, which can be used in UMA | 82 // Gets the id of the permission message, which can be used in UMA |
| 82 // histograms. | 83 // histograms. |
| 83 ID id() const { return id_; } | 84 ID id() const { return id_; } |
| 84 | 85 |
| 85 // Gets a localized message describing this permission. Please note that | 86 // Gets a localized message describing this permission. Please note that |
| 86 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN. | 87 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN. |
| 87 const string16& message() const { return message_; } | 88 const string16& message() const { return message_; } |
| 88 | 89 |
| 90 // Gets a localized message describing the details for this permission. Please |
| 91 // note that the message will be empty for message types TYPE_NONE and |
| 92 // TYPE_UNKNOWN. |
| 93 const string16& details() const { return details_; } |
| 94 |
| 89 // Comparator to work with std::set. | 95 // Comparator to work with std::set. |
| 90 bool operator<(const PermissionMessage& that) const { | 96 bool operator<(const PermissionMessage& that) const { |
| 91 return id_ < that.id_; | 97 return id_ < that.id_; |
| 92 } | 98 } |
| 93 | 99 |
| 94 private: | 100 private: |
| 95 ID id_; | 101 ID id_; |
| 96 string16 message_; | 102 string16 message_; |
| 103 string16 details_; |
| 97 }; | 104 }; |
| 98 | 105 |
| 99 typedef std::vector<PermissionMessage> PermissionMessages; | 106 typedef std::vector<PermissionMessage> PermissionMessages; |
| 100 | 107 |
| 101 } // namespace extensions | 108 } // namespace extensions |
| 102 | 109 |
| 103 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ | 110 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ |
| OLD | NEW |