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

Side by Side Diff: extensions/common/permissions/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 EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_
7
8 #include <vector>
9
10 #include "extensions/common/manifest.h"
11 #include "extensions/common/permissions/permission_message.h"
12
13 namespace extensions {
14
15 class PermissionSet;
16
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 {
21 public:
22 PermissionMessageProvider() {}
23 virtual ~PermissionMessageProvider() {}
24
25 // Return the registered permission message provider for the extension type.
26 static PermissionMessageProvider* Get(Manifest::Type extension_type);
27
28 // Set the permissions providers for Get() to return. |default_provider|
29 // is returned for types, unless a custom provider is given with that type
30 // in |custom_providers|. Takes ownership of the given providers.
31 static void SetProviders(
Matt Perry 2013/10/16 20:07:04 This interface feels a bit clunky. How about split
Yoyo Zhou 2013/10/17 19:45:52 I moved the ownership to ChromeExtensionsClient.
32 PermissionMessageProvider* default_provider,
33 const std::vector<std::pair<Manifest::Type, PermissionMessageProvider*> >&
34 custom_providers);
35
36 // Gets the localized permission messages that represent this set.
37 // The set of permission messages shown varies by extension type.
38 virtual PermissionMessages GetPermissionMessages(
39 const PermissionSet* permissions) const = 0;
40
41 // Gets the localized permission messages that represent this set (represented
42 // as strings). The set of permission messages shown varies by extension type.
43 virtual std::vector<string16> GetWarningMessages(
44 const PermissionSet* permissions) const = 0;
45
46 // Gets the localized permission details for messages that represent this set
47 // (represented as strings). The set of permission messages shown varies by
48 // extension type.
49 virtual std::vector<string16> GetWarningMessagesDetails(
50 const PermissionSet* permissions) const = 0;
51
52 // Returns true if |new_permissions| has a greater privilege level than
53 // |old_permissions|.
54 // Whether certain permissions are considered varies by extension type.
55 virtual bool IsPrivilegeIncrease(
56 const PermissionSet* old_permissions,
57 const PermissionSet* new_permissions) const = 0;
58 };
59
60 } // namespace extensions
61
62 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698