Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / extensions / common / permissions / permission_message_provider.h
blob0a6b7e05734d175c7ab18bc39111602896da0478
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_
8 #include <vector>
10 #include "extensions/common/manifest.h"
11 #include "extensions/common/permissions/coalesced_permission_message.h"
13 namespace extensions {
15 class PermissionIDSet;
16 class PermissionSet;
18 // The PermissionMessageProvider interprets permissions, translating them
19 // into warning messages to show to the user. It also determines whether
20 // a new set of permissions entails showing new warning messages.
21 class PermissionMessageProvider {
22 public:
23 PermissionMessageProvider() {}
24 virtual ~PermissionMessageProvider() {}
26 // Return the global permission message provider.
27 static const PermissionMessageProvider* Get();
29 // Calculates and returns the full list of permission messages for the given
30 // |permissions|. This involves converting the given PermissionIDs into
31 // localized messages, as well as coalescing and parameterizing any messages
32 // that require the permission ID's argument in their message.
33 virtual CoalescedPermissionMessages GetPermissionMessages(
34 const PermissionIDSet& permissions) const = 0;
36 // Returns true if |new_permissions| has a greater privilege level than
37 // |old_permissions|.
38 // Whether certain permissions are considered varies by extension type.
39 // TODO(sashab): Add an implementation of this method that uses
40 // PermissionIDSet instead, then deprecate this one.
41 virtual bool IsPrivilegeIncrease(
42 const PermissionSet* old_permissions,
43 const PermissionSet* new_permissions,
44 Manifest::Type extension_type) const = 0;
46 // Given the permissions for an extension, finds the IDs of all the
47 // permissions for that extension (including API, manifest and host
48 // permissions).
49 // TODO(sashab): This uses the legacy PermissionSet type. Deprecate or rename
50 // this type, and make this take as little as is needed to work out the
51 // PermissionIDSet.
52 virtual PermissionIDSet GetAllPermissionIDs(
53 const PermissionSet* permissions,
54 Manifest::Type extension_type) const = 0;
57 } // namespace extensions
59 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_