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

Side by Side Diff: extensions/common/permissions/permission_message_provider.h

Issue 1004123003: Extensions: Switch to new permission message system, part III (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permissions_tests
Patch Set: Mac Created 5 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_ 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_ 6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "extensions/common/manifest.h" 10 #include "extensions/common/manifest.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Calculates and returns the full list of permission messages for the given 72 // Calculates and returns the full list of permission messages for the given
73 // |permissions|. This involves converting the given PermissionIDs into 73 // |permissions|. This involves converting the given PermissionIDs into
74 // localized messages, as well as coalescing and parameterizing any messages 74 // localized messages, as well as coalescing and parameterizing any messages
75 // that require the permission ID's argument in their message. 75 // that require the permission ID's argument in their message.
76 // TODO(sashab): Rename this to GetPermissionMessages() once the current one 76 // TODO(sashab): Rename this to GetPermissionMessages() once the current one
77 // is deprecated. 77 // is deprecated.
78 virtual CoalescedPermissionMessages GetCoalescedPermissionMessages( 78 virtual CoalescedPermissionMessages GetCoalescedPermissionMessages(
79 const PermissionIDSet& permissions) const = 0; 79 const PermissionIDSet& permissions) const = 0;
80 80
81 // Gets the localized permission messages that represent this set (represented
82 // as strings). The set of permission messages shown varies by extension type.
83 // Any permissions added by API, host or manifest permissions need to be added
84 // to |permissions| before this function is called.
85 // Deprecated; use GetPermissionMessageStrings instead.
86 // TODO(treib): Remove this once we've switched to the new system.
87 virtual std::vector<base::string16> GetLegacyWarningMessages(
88 const PermissionSet* permissions,
89 Manifest::Type extension_type) const = 0;
90
91 // Gets the localized permission details for messages that represent this set
92 // (represented as strings). The set of permission messages shown varies by
93 // extension type.
94 // Deprecated; use GetPermissionMessageStrings instead.
95 // TODO(treib): Remove this once we've switched to the new system.
96 virtual std::vector<base::string16> GetLegacyWarningMessagesDetails(
97 const PermissionSet* permissions,
98 Manifest::Type extension_type) const = 0;
99
100 // Returns true if |new_permissions| has a greater privilege level than 81 // Returns true if |new_permissions| has a greater privilege level than
101 // |old_permissions|. 82 // |old_permissions|.
102 // Whether certain permissions are considered varies by extension type. 83 // Whether certain permissions are considered varies by extension type.
103 // TODO(sashab): Add an implementation of this method that uses 84 // TODO(sashab): Add an implementation of this method that uses
104 // PermissionIDSet instead, then deprecate this one. 85 // PermissionIDSet instead, then deprecate this one.
105 virtual bool IsPrivilegeIncrease( 86 virtual bool IsPrivilegeIncrease(
106 const PermissionSet* old_permissions, 87 const PermissionSet* old_permissions,
107 const PermissionSet* new_permissions, 88 const PermissionSet* new_permissions,
108 Manifest::Type extension_type) const = 0; 89 Manifest::Type extension_type) const = 0;
109 90
110 // Given the permissions for an extension, finds the IDs of all the 91 // Given the permissions for an extension, finds the IDs of all the
111 // permissions for that extension (including API, manifest and host 92 // permissions for that extension (including API, manifest and host
112 // permissions). 93 // permissions).
113 // TODO(sashab): This uses the legacy PermissionSet type. Deprecate or rename 94 // TODO(sashab): This uses the legacy PermissionSet type. Deprecate or rename
114 // this type, and make this take as little as is needed to work out the 95 // this type, and make this take as little as is needed to work out the
115 // PermissionIDSet. 96 // PermissionIDSet.
116 virtual PermissionIDSet GetAllPermissionIDs( 97 virtual PermissionIDSet GetAllPermissionIDs(
117 const PermissionSet* permissions, 98 const PermissionSet* permissions,
118 Manifest::Type extension_type) const = 0; 99 Manifest::Type extension_type) const = 0;
100
101 private:
Yoyo Zhou 2015/03/30 20:29:27 Cool!
102 // Gets the localized permission messages that represent this set (represented
103 // as strings). The set of permission messages shown varies by extension type.
104 // Any permissions added by API, host or manifest permissions need to be added
105 // to |permissions| before this function is called.
106 // Deprecated; use GetPermissionMessageStrings instead.
107 // TODO(treib): Remove this once we've switched to the new system.
108 virtual std::vector<base::string16> GetLegacyWarningMessages(
109 const PermissionSet* permissions,
110 Manifest::Type extension_type) const = 0;
111
112 // Gets the localized permission details for messages that represent this set
113 // (represented as strings). The set of permission messages shown varies by
114 // extension type.
115 // Deprecated; use GetPermissionMessageStrings instead.
116 // TODO(treib): Remove this once we've switched to the new system.
117 virtual std::vector<base::string16> GetLegacyWarningMessagesDetails(
118 const PermissionSet* permissions,
119 Manifest::Type extension_type) const = 0;
119 }; 120 };
120 121
121 } // namespace extensions 122 } // namespace extensions
122 123
123 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_ 124 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_PROVIDER_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/management/management_api.cc ('k') | extensions/common/permissions/permissions_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698