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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 kFavicon, | 63 kFavicon, |
| 64 kMusicManagerPrivate, | 64 kMusicManagerPrivate, |
| 65 kWebConnectable, | 65 kWebConnectable, |
| 66 kActivityLogPrivate, | 66 kActivityLogPrivate, |
| 67 kBluetoothDevices, | 67 kBluetoothDevices, |
| 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. If |details_only| is true, |
| 74 // the returned messages include full details of sites the extension | |
| 75 // requested access to, otherwise an overview/aggregate of the sites. | |
| 74 static PermissionMessage CreateFromHostList( | 76 static PermissionMessage CreateFromHostList( |
| 75 const std::set<std::string>& hosts); | 77 const std::set<std::string>& hosts, bool details_only); |
| 76 | 78 |
| 77 // Creates the corresponding permission message. | 79 // Creates the corresponding permission message. |
| 78 PermissionMessage(ID id, const string16& message); | 80 PermissionMessage(ID id, const string16& message); |
| 79 ~PermissionMessage(); | 81 ~PermissionMessage(); |
| 80 | 82 |
| 81 // Gets the id of the permission message, which can be used in UMA | 83 // Gets the id of the permission message, which can be used in UMA |
| 82 // histograms. | 84 // histograms. |
| 83 ID id() const { return id_; } | 85 ID id() const { return id_; } |
| 84 | 86 |
| 85 // Gets a localized message describing this permission. Please note that | 87 // Gets a localized message describing this permission. Please note that |
| 86 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN. | 88 // the message will be empty for message types TYPE_NONE and TYPE_UNKNOWN. |
| 87 const string16& message() const { return message_; } | 89 const string16& message() const { return message_; } |
| 88 | 90 |
| 89 // Comparator to work with std::set. | 91 // Comparator to work with std::set. |
| 90 bool operator<(const PermissionMessage& that) const { | 92 bool operator<(const PermissionMessage& that) const { |
| 91 return id_ < that.id_; | 93 return id_ < that.id_; |
| 92 } | 94 } |
| 93 | 95 |
| 94 private: | 96 private: |
| 95 ID id_; | 97 ID id_; |
| 96 string16 message_; | 98 string16 message_; |
|
Yoyo Zhou
2013/07/10 23:18:58
An alternative might be to have another string16 h
| |
| 97 }; | 99 }; |
| 98 | 100 |
| 99 typedef std::vector<PermissionMessage> PermissionMessages; | 101 typedef std::vector<PermissionMessage> PermissionMessages; |
| 100 | 102 |
| 101 } // namespace extensions | 103 } // namespace extensions |
| 102 | 104 |
| 103 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ | 105 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_MESSAGE_H_ |
| OLD | NEW |