| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROME_PERMISSION_MESSAGE_RULES_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_RULES_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_RULES_H_ | 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_RULES_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // any |optional| permissions are present, they are also 'absorbed' by the rule | 47 // any |optional| permissions are present, they are also 'absorbed' by the rule |
| 48 // to generate the final coalesced message. | 48 // to generate the final coalesced message. |
| 49 // An optional |formatter| can be provided, which decides how the final | 49 // An optional |formatter| can be provided, which decides how the final |
| 50 // PermissionMessage appears. The default formatter simply displays the message | 50 // PermissionMessage appears. The default formatter simply displays the message |
| 51 // with the ID |message_id|. | 51 // with the ID |message_id|. |
| 52 // Once a permission is used in a rule, it cannot apply to any future rules. | 52 // Once a permission is used in a rule, it cannot apply to any future rules. |
| 53 // TODO(sashab): Move all ChromePermissionMessageFormatters to their own | 53 // TODO(sashab): Move all ChromePermissionMessageFormatters to their own |
| 54 // provider class and remove ownership from ChromePermissionMessageRule. | 54 // provider class and remove ownership from ChromePermissionMessageRule. |
| 55 class ChromePermissionMessageRule { | 55 class ChromePermissionMessageRule { |
| 56 public: | 56 public: |
| 57 ChromePermissionMessageRule(const ChromePermissionMessageRule& other); |
| 57 virtual ~ChromePermissionMessageRule(); | 58 virtual ~ChromePermissionMessageRule(); |
| 58 | 59 |
| 59 // Returns all the rules used to generate permission messages for Chrome apps | 60 // Returns all the rules used to generate permission messages for Chrome apps |
| 60 // and extensions. | 61 // and extensions. |
| 61 static std::vector<ChromePermissionMessageRule> GetAllRules(); | 62 static std::vector<ChromePermissionMessageRule> GetAllRules(); |
| 62 | 63 |
| 63 std::set<APIPermission::ID> required_permissions() const; | 64 std::set<APIPermission::ID> required_permissions() const; |
| 64 std::set<APIPermission::ID> optional_permissions() const; | 65 std::set<APIPermission::ID> optional_permissions() const; |
| 65 std::set<APIPermission::ID> all_permissions() const; | 66 std::set<APIPermission::ID> all_permissions() const; |
| 66 | 67 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 84 std::set<APIPermission::ID> optional_permissions_; | 85 std::set<APIPermission::ID> optional_permissions_; |
| 85 | 86 |
| 86 // Owned by this class. linked_ptr is needed because this object is copyable | 87 // Owned by this class. linked_ptr is needed because this object is copyable |
| 87 // and stored in a returned vector. | 88 // and stored in a returned vector. |
| 88 linked_ptr<ChromePermissionMessageFormatter> formatter_; | 89 linked_ptr<ChromePermissionMessageFormatter> formatter_; |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 } // namespace extensions | 92 } // namespace extensions |
| 92 | 93 |
| 93 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_RULES_
H_ | 94 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_RULES_
H_ |
| OLD | NEW |