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 EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_
10 #include "extensions/common/manifest.h"
11 #include "extensions/common/permissions/permission_message.h"
13 namespace extensions
{
17 // The PermissionMessageProvider interprets permissions, translating them
18 // into warning messages to show to the user. It also determines whether
19 // a new set of permissions entails showing new warning messages.
20 class PermissionMessageProvider
{
22 PermissionMessageProvider() {}
23 virtual ~PermissionMessageProvider() {}
25 // Return the global permission message provider.
26 static const PermissionMessageProvider
* Get();
28 // Gets the localized permission messages that represent this set.
29 // The set of permission messages shown varies by extension type.
30 virtual PermissionMessages
GetPermissionMessages(
31 const PermissionSet
* permissions
,
32 Manifest::Type extension_type
) const = 0;
34 // Gets the localized permission messages that represent this set (represented
35 // as strings). The set of permission messages shown varies by extension type.
36 virtual std::vector
<base::string16
> GetWarningMessages(
37 const PermissionSet
* permissions
,
38 Manifest::Type extension_type
) const = 0;
40 // Gets the localized permission details for messages that represent this set
41 // (represented as strings). The set of permission messages shown varies by
43 virtual std::vector
<base::string16
> GetWarningMessagesDetails(
44 const PermissionSet
* permissions
,
45 Manifest::Type extension_type
) const = 0;
47 // Returns true if |new_permissions| has a greater privilege level than
49 // Whether certain permissions are considered varies by extension type.
50 virtual bool IsPrivilegeIncrease(
51 const PermissionSet
* old_permissions
,
52 const PermissionSet
* new_permissions
,
53 Manifest::Type extension_type
) const = 0;
56 } // namespace extensions
58 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_