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

Side by Side Diff: chrome/common/extensions/permissions/base_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: more better 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_BASE_PERMISSION_MESSAGE_PROVIDER_H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_BASE_PERMISSION_MESSAGE_PROVIDER_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 BasePermissionMessageProvider : public PermissionMessageProvider {
Matt Perry 2013/10/17 21:47:30 Well, now it's not a base class anymore :) How ab
Yoyo Zhou 2013/10/18 19:08:00 Sure.
18 public:
19 BasePermissionMessageProvider();
20 virtual ~BasePermissionMessageProvider();
21
22 // PermissionMessageProvider implementation.
23 virtual PermissionMessages GetPermissionMessages(
24 const PermissionSet* permissions,
25 Manifest::Type extension_type) const OVERRIDE;
26 virtual std::vector<string16> GetWarningMessages(
27 const PermissionSet* permissions,
28 Manifest::Type extension_type) const OVERRIDE;
29 virtual std::vector<string16> GetWarningMessagesDetails(
30 const PermissionSet* permissions,
31 Manifest::Type extension_type) const OVERRIDE;
32 virtual bool IsPrivilegeIncrease(
33 const PermissionSet* old_permissions,
34 const PermissionSet* new_permissions,
35 Manifest::Type extension_type) const OVERRIDE;
36
37 private:
38 // Gets the permission messages for the API permissions.
39 std::set<PermissionMessage> GetAPIPermissionMessages(
40 const PermissionSet* permissions) const;
41
42 // Gets the permission messages for the host permissions.
43 std::set<PermissionMessage> GetHostPermissionMessages(
44 const PermissionSet* permissions,
45 Manifest::Type extension_type) const;
46
47 // Returns true if |new_permissions| has an elevated API privilege level
48 // compared to |old_permissions|.
49 bool IsAPIPrivilegeIncrease(
50 const PermissionSet* old_permissions,
51 const PermissionSet* new_permissions) const;
52
53 // Returns true if |new_permissions| has more host permissions compared to
54 // |old_permissions|.
55 bool IsHostPrivilegeIncrease(
56 const PermissionSet* old_permissions,
57 const PermissionSet* new_permissions,
58 Manifest::Type extension_type) const;
59
60 DISALLOW_COPY_AND_ASSIGN(BasePermissionMessageProvider);
61 };
62
63 } // namespace extensions
64
65 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_BASE_PERMISSION_MESSAGE_PROVIDER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698