| 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 CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_
H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_
H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_
H_ | 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_
H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // extensions created through the extension system. | 22 // extensions created through the extension system. |
| 23 class ChromePermissionMessageProvider : public PermissionMessageProvider { | 23 class ChromePermissionMessageProvider : public PermissionMessageProvider { |
| 24 public: | 24 public: |
| 25 ChromePermissionMessageProvider(); | 25 ChromePermissionMessageProvider(); |
| 26 ~ChromePermissionMessageProvider() override; | 26 ~ChromePermissionMessageProvider() override; |
| 27 | 27 |
| 28 // PermissionMessageProvider implementation. | 28 // PermissionMessageProvider implementation. |
| 29 // See comments in permission_message_provider.h. TL;DR: You want to use only | 29 // See comments in permission_message_provider.h. TL;DR: You want to use only |
| 30 // GetPermissionMessageStrings to get messages, not the *Legacy* or | 30 // GetPermissionMessageStrings to get messages, not the *Legacy* or |
| 31 // *Coalesced* methods. | 31 // *Coalesced* methods. |
| 32 PermissionMessageStrings GetPermissionMessageStrings( | |
| 33 const PermissionSet* permissions, | |
| 34 Manifest::Type extension_type) const override; | |
| 35 PermissionMessageIDs GetLegacyPermissionMessageIDs( | 32 PermissionMessageIDs GetLegacyPermissionMessageIDs( |
| 36 const PermissionSet* permissions, | 33 const PermissionSet* permissions, |
| 37 Manifest::Type extension_type) const override; | 34 Manifest::Type extension_type) const override; |
| 38 CoalescedPermissionMessages GetCoalescedPermissionMessages( | 35 CoalescedPermissionMessages GetCoalescedPermissionMessages( |
| 39 const PermissionIDSet& permissions) const override; | 36 const PermissionIDSet& permissions) const override; |
| 40 std::vector<base::string16> GetLegacyWarningMessages( | 37 std::vector<base::string16> GetLegacyWarningMessages( |
| 41 const PermissionSet* permissions, | 38 const PermissionSet* permissions, |
| 42 Manifest::Type extension_type) const override; | 39 Manifest::Type extension_type) const override; |
| 43 std::vector<base::string16> GetLegacyWarningMessagesDetails( | 40 std::vector<base::string16> GetLegacyWarningMessagesDetails( |
| 44 const PermissionSet* permissions, | 41 const PermissionSet* permissions, |
| 45 Manifest::Type extension_type) const override; | 42 Manifest::Type extension_type) const override; |
| 46 bool IsPrivilegeIncrease(const PermissionSet* old_permissions, | 43 bool IsPrivilegeIncrease(const PermissionSet* old_permissions, |
| 47 const PermissionSet* new_permissions, | 44 const PermissionSet* new_permissions, |
| 48 Manifest::Type extension_type) const override; | 45 Manifest::Type extension_type) const override; |
| 49 PermissionIDSet GetAllPermissionIDs( | 46 PermissionIDSet GetAllPermissionIDs( |
| 50 const PermissionSet* permissions, | 47 const PermissionSet* permissions, |
| 51 Manifest::Type extension_type) const override; | 48 Manifest::Type extension_type) const override; |
| 52 | 49 |
| 53 private: | 50 private: |
| 54 // TODO(treib): Remove this once we've switched to the new system. | 51 // TODO(treib): Remove this once we've switched to the new system. |
| 55 PermissionMessages GetPermissionMessages(const PermissionSet* permissions, | 52 PermissionMessages GetLegacyPermissionMessages( |
| 56 Manifest::Type extension_type) const; | 53 const PermissionSet* permissions, |
| 54 Manifest::Type extension_type) const; |
| 57 | 55 |
| 58 // Gets the permission messages for the API permissions. Also adds any | 56 // Gets the permission messages for the API permissions. Also adds any |
| 59 // permission IDs from API Permissions to |permission_ids|. | 57 // permission IDs from API Permissions to |permission_ids|. |
| 60 // TODO(sashab): Deprecate the |permissions| argument, and rename this to | 58 // TODO(sashab): Deprecate the |permissions| argument, and rename this to |
| 61 // AddAPIPermissions(). | 59 // AddAPIPermissions(). |
| 62 std::set<PermissionMessage> GetAPIPermissionMessages( | 60 std::set<PermissionMessage> GetAPIPermissionMessages( |
| 63 const PermissionSet* permissions, | 61 const PermissionSet* permissions, |
| 64 PermissionIDSet* permission_ids) const; | 62 PermissionIDSet* permission_ids, |
| 63 Manifest::Type extension_type) const; |
| 65 | 64 |
| 66 // Gets the permission messages for the Manifest permissions. Also adds any | 65 // Gets the permission messages for the Manifest permissions. Also adds any |
| 67 // permission IDs from manifest Permissions to |permission_ids|. | 66 // permission IDs from manifest Permissions to |permission_ids|. |
| 68 // TODO(sashab): Deprecate the |permissions| argument, and rename this to | 67 // TODO(sashab): Deprecate the |permissions| argument, and rename this to |
| 69 // AddManifestPermissions(). | 68 // AddManifestPermissions(). |
| 70 std::set<PermissionMessage> GetManifestPermissionMessages( | 69 std::set<PermissionMessage> GetManifestPermissionMessages( |
| 71 const PermissionSet* permissions, | 70 const PermissionSet* permissions, |
| 72 PermissionIDSet* permission_ids) const; | 71 PermissionIDSet* permission_ids) const; |
| 73 | 72 |
| 74 // Gets the permission messages for the host permissions. Also adds any | 73 // Gets the permission messages for the host permissions. Also adds any |
| (...skipping 10 matching lines...) Expand all Loading... |
| 85 // TODO(treib): Remove this method as soon as we've fully switched to the | 84 // TODO(treib): Remove this method as soon as we've fully switched to the |
| 86 // new system. | 85 // new system. |
| 87 void CoalesceWarningMessages( | 86 void CoalesceWarningMessages( |
| 88 const PermissionSet* permissions, | 87 const PermissionSet* permissions, |
| 89 Manifest::Type extension_type, | 88 Manifest::Type extension_type, |
| 90 std::vector<base::string16>* message_strings, | 89 std::vector<base::string16>* message_strings, |
| 91 std::vector<base::string16>* message_details_strings) const; | 90 std::vector<base::string16>* message_details_strings) const; |
| 92 | 91 |
| 93 // Returns true if |new_permissions| has an elevated API privilege level | 92 // Returns true if |new_permissions| has an elevated API privilege level |
| 94 // compared to |old_permissions|. | 93 // compared to |old_permissions|. |
| 95 bool IsAPIPrivilegeIncrease( | 94 bool IsAPIPrivilegeIncrease(const PermissionSet* old_permissions, |
| 96 const PermissionSet* old_permissions, | 95 const PermissionSet* new_permissions, |
| 97 const PermissionSet* new_permissions) const; | 96 Manifest::Type extension_type) const; |
| 98 | 97 |
| 99 // Returns true if |new_permissions| has an elevated manifest permission | 98 // Returns true if |new_permissions| has an elevated manifest permission |
| 100 // privilege level compared to |old_permissions|. | 99 // privilege level compared to |old_permissions|. |
| 101 bool IsManifestPermissionPrivilegeIncrease( | 100 bool IsManifestPermissionPrivilegeIncrease( |
| 102 const PermissionSet* old_permissions, | 101 const PermissionSet* old_permissions, |
| 103 const PermissionSet* new_permissions) const; | 102 const PermissionSet* new_permissions) const; |
| 104 | 103 |
| 105 // Returns true if |new_permissions| has more host permissions compared to | 104 // Returns true if |new_permissions| has more host permissions compared to |
| 106 // |old_permissions|. | 105 // |old_permissions|. |
| 107 bool IsHostPrivilegeIncrease( | 106 bool IsHostPrivilegeIncrease( |
| 108 const PermissionSet* old_permissions, | 107 const PermissionSet* old_permissions, |
| 109 const PermissionSet* new_permissions, | 108 const PermissionSet* new_permissions, |
| 110 Manifest::Type extension_type) const; | 109 Manifest::Type extension_type) const; |
| 111 | 110 |
| 112 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProvider); | 111 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProvider); |
| 113 }; | 112 }; |
| 114 | 113 |
| 115 } // namespace extensions | 114 } // namespace extensions |
| 116 | 115 |
| 117 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVID
ER_H_ | 116 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVID
ER_H_ |
| OLD | NEW |