OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_EXTENSION_PERMISSION_MESSAGE_PROVID ER_H_ | |
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_EXTENSION_PERMISSION_MESSAGE_PROVID ER_H_ | |
7 | |
8 #include <set> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/gtest_prod_util.h" | |
12 #include "base/strings/string16.h" | |
13 #include "extensions/common/permissions/permission_message_provider.h" | |
14 | |
15 namespace extensions { | |
16 | |
17 class ExtensionPermissionMessageProvider : public PermissionMessageProvider { | |
Matt Perry
2013/10/16 20:07:04
Since this is used for apps as well, maybe BasePer
Yoyo Zhou
2013/10/17 19:45:52
Done.
| |
18 public: | |
19 ExtensionPermissionMessageProvider(); | |
20 virtual ~ExtensionPermissionMessageProvider(); | |
21 | |
22 // PermissionMessageProvider implementation. | |
23 virtual PermissionMessages GetPermissionMessages( | |
24 const PermissionSet* permissions) const OVERRIDE; | |
25 virtual std::vector<string16> GetWarningMessages( | |
26 const PermissionSet* permissions) const OVERRIDE; | |
27 virtual std::vector<string16> GetWarningMessagesDetails( | |
28 const PermissionSet* permissions) const OVERRIDE; | |
29 virtual bool IsPrivilegeIncrease( | |
30 const PermissionSet* old_permissions, | |
31 const PermissionSet* new_permissions) const OVERRIDE; | |
32 | |
33 private: | |
34 FRIEND_TEST_ALL_PREFIXES(PermissionsTest, IsHostPrivilegeIncrease); | |
35 | |
36 // Gets the permission messages for the API permissions. | |
37 virtual std::set<PermissionMessage> GetAPIPermissionMessages( | |
38 const PermissionSet* permissions) const; | |
39 | |
40 // Gets the permission messages for the host permissions. | |
41 virtual std::set<PermissionMessage> GetHostPermissionMessages( | |
42 const PermissionSet* permissions) const; | |
43 | |
44 // Returns true if |new_permissions| has an elevated API privilege level | |
45 // compared to |old_permissions|. | |
46 virtual bool IsAPIPrivilegeIncrease( | |
47 const PermissionSet* old_permissions, | |
48 const PermissionSet* new_permissions) const; | |
49 | |
50 // Returns true if |new_permissions| has more host permissions compared to | |
51 // |old_permissions|. | |
52 virtual bool IsHostPrivilegeIncrease( | |
53 const PermissionSet* old_permissions, | |
54 const PermissionSet* new_permissions) const; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(ExtensionPermissionMessageProvider); | |
57 }; | |
58 | |
59 } // namespace extensions | |
60 | |
61 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_EXTENSION_PERMISSION_MESSAGE_PRO VIDER_H_ | |
OLD | NEW |