Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/common/extensions/permissions/extension_permission_message_provider.h

Issue 27446002: Move permission warning message handling from PermissionSet to PermissionMessageProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698