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.
5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_H_
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"
15 namespace extensions
{
17 class ChromePermissionMessageProvider
: public PermissionMessageProvider
{
19 ChromePermissionMessageProvider();
20 virtual ~ChromePermissionMessageProvider();
22 // PermissionMessageProvider implementation.
23 virtual PermissionMessages
GetPermissionMessages(
24 const PermissionSet
* permissions
,
25 Manifest::Type extension_type
) const OVERRIDE
;
26 virtual std::vector
<base::string16
> GetWarningMessages(
27 const PermissionSet
* permissions
,
28 Manifest::Type extension_type
) const OVERRIDE
;
29 virtual std::vector
<base::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
;
38 // Gets the permission messages for the API permissions.
39 std::set
<PermissionMessage
> GetAPIPermissionMessages(
40 const PermissionSet
* permissions
) const;
42 // Gets the permission messages for the Manifest permissions.
43 std::set
<PermissionMessage
> GetManifestPermissionMessages(
44 const PermissionSet
* permissions
) const;
46 // Gets the permission messages for the host permissions.
47 std::set
<PermissionMessage
> GetHostPermissionMessages(
48 const PermissionSet
* permissions
,
49 Manifest::Type extension_type
) const;
51 // Returns true if |new_permissions| has an elevated API privilege level
52 // compared to |old_permissions|.
53 bool IsAPIPrivilegeIncrease(
54 const PermissionSet
* old_permissions
,
55 const PermissionSet
* new_permissions
) const;
57 // Returns true if |new_permissions| has an elevated manifest permission
58 // privilege level compared to |old_permissions|.
59 bool IsManifestPermissionPrivilegeIncrease(
60 const PermissionSet
* old_permissions
,
61 const PermissionSet
* new_permissions
) const;
63 // Returns true if |new_permissions| has more host permissions compared to
65 bool IsHostPrivilegeIncrease(
66 const PermissionSet
* old_permissions
,
67 const PermissionSet
* new_permissions
,
68 Manifest::Type extension_type
) const;
70 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProvider
);
73 } // namespace extensions
75 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_H_