Chromium Code Reviews| 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" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "extensions/common/permissions/permission_message_provider.h" | 13 #include "extensions/common/permissions/permission_message_provider.h" |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 // Tested in two places: | 17 // Tested in two places: |
| 18 // 1. chrome_permission_message_provider_unittest.cc, which is a regular unit | 18 // 1. chrome_permission_message_provider_unittest.cc, which is a regular unit |
| 19 // test for this class | 19 // test for this class |
| 20 // 2. chrome/browser/extensions/permission_messages_unittest.cc, which is an | 20 // 2. chrome/browser/extensions/permission_messages_unittest.cc, which is an |
| 21 // integration test that ensures messages are correctly generated for | 21 // integration test that ensures messages are correctly generated for |
| 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 PermissionMessages GetPermissionMessages( | 29 // See comments in permission_message_provider.h. TL;DR: You want to use only |
| 30 // GetPermissionMessageStrings to get messages, not the *Legacy* or | |
| 31 // *Coalesced* methods. | |
|
sashab
2015/03/13 18:26:20
Maybe TODO: Make the legacy/coalesced ones private
Marc Treib
2015/03/16 09:11:04
Good idea! I'll do that once I've switched all cal
| |
| 32 PermissionMessageStrings GetPermissionMessageStrings( | |
| 33 const PermissionSet* permissions, | |
| 34 Manifest::Type extension_type) const override; | |
| 35 PermissionMessageIDs GetLegacyPermissionMessageIDs( | |
| 30 const PermissionSet* permissions, | 36 const PermissionSet* permissions, |
| 31 Manifest::Type extension_type) const override; | 37 Manifest::Type extension_type) const override; |
| 32 CoalescedPermissionMessages GetCoalescedPermissionMessages( | 38 CoalescedPermissionMessages GetCoalescedPermissionMessages( |
| 33 const PermissionIDSet& permissions) const override; | 39 const PermissionIDSet& permissions) const override; |
| 34 std::vector<base::string16> GetWarningMessages( | 40 std::vector<base::string16> GetLegacyWarningMessages( |
| 35 const PermissionSet* permissions, | 41 const PermissionSet* permissions, |
| 36 Manifest::Type extension_type) const override; | 42 Manifest::Type extension_type) const override; |
| 37 std::vector<base::string16> GetWarningMessagesDetails( | 43 std::vector<base::string16> GetLegacyWarningMessagesDetails( |
| 38 const PermissionSet* permissions, | 44 const PermissionSet* permissions, |
| 39 Manifest::Type extension_type) const override; | 45 Manifest::Type extension_type) const override; |
| 40 bool IsPrivilegeIncrease(const PermissionSet* old_permissions, | 46 bool IsPrivilegeIncrease(const PermissionSet* old_permissions, |
| 41 const PermissionSet* new_permissions, | 47 const PermissionSet* new_permissions, |
| 42 Manifest::Type extension_type) const override; | 48 Manifest::Type extension_type) const override; |
| 43 PermissionIDSet GetAllPermissionIDs( | 49 PermissionIDSet GetAllPermissionIDs( |
| 44 const PermissionSet* permissions, | 50 const PermissionSet* permissions, |
| 45 Manifest::Type extension_type) const override; | 51 Manifest::Type extension_type) const override; |
| 46 | 52 |
| 47 private: | 53 private: |
| 54 // TODO(treib): Remove this once we've switched to the new system. | |
| 55 PermissionMessages GetPermissionMessages(const PermissionSet* permissions, | |
| 56 Manifest::Type extension_type) const; | |
| 57 | |
| 48 // Gets the permission messages for the API permissions. Also adds any | 58 // Gets the permission messages for the API permissions. Also adds any |
| 49 // permission IDs from API Permissions to |permission_ids|. | 59 // permission IDs from API Permissions to |permission_ids|. |
| 50 // TODO(sashab): Deprecate the |permissions| argument, and rename this to | 60 // TODO(sashab): Deprecate the |permissions| argument, and rename this to |
| 51 // AddAPIPermissions(). | 61 // AddAPIPermissions(). |
| 52 std::set<PermissionMessage> GetAPIPermissionMessages( | 62 std::set<PermissionMessage> GetAPIPermissionMessages( |
| 53 const PermissionSet* permissions, | 63 const PermissionSet* permissions, |
| 54 PermissionIDSet* permission_ids) const; | 64 PermissionIDSet* permission_ids) const; |
| 55 | 65 |
| 56 // Gets the permission messages for the Manifest permissions. Also adds any | 66 // Gets the permission messages for the Manifest permissions. Also adds any |
| 57 // permission IDs from manifest Permissions to |permission_ids|. | 67 // permission IDs from manifest Permissions to |permission_ids|. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 const PermissionSet* old_permissions, | 108 const PermissionSet* old_permissions, |
| 99 const PermissionSet* new_permissions, | 109 const PermissionSet* new_permissions, |
| 100 Manifest::Type extension_type) const; | 110 Manifest::Type extension_type) const; |
| 101 | 111 |
| 102 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProvider); | 112 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProvider); |
| 103 }; | 113 }; |
| 104 | 114 |
| 105 } // namespace extensions | 115 } // namespace extensions |
| 106 | 116 |
| 107 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVID ER_H_ | 117 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVID ER_H_ |
| OLD | NEW |