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

Side by Side Diff: chrome/common/extensions/permissions/chrome_permission_message_provider.h

Issue 980353003: Extensions: Switch to new permission message system, part I (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup;rebase 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 CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_ H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_ H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_ H_ 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_ H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const PermissionSet* permissions, 44 const PermissionSet* permissions,
45 Manifest::Type extension_type) const override; 45 Manifest::Type extension_type) const override;
46 46
47 private: 47 private:
48 // Gets the permission messages for the API permissions. Also adds any 48 // Gets the permission messages for the API permissions. Also adds any
49 // permission IDs from API Permissions to |permission_ids|. 49 // permission IDs from API Permissions to |permission_ids|.
50 // TODO(sashab): Deprecate the |permissions| argument, and rename this to 50 // TODO(sashab): Deprecate the |permissions| argument, and rename this to
51 // AddAPIPermissions(). 51 // AddAPIPermissions().
52 std::set<PermissionMessage> GetAPIPermissionMessages( 52 std::set<PermissionMessage> GetAPIPermissionMessages(
53 const PermissionSet* permissions, 53 const PermissionSet* permissions,
54 PermissionIDSet* permission_ids) const; 54 PermissionIDSet* permission_ids,
55 Manifest::Type extension_type) const;
55 56
56 // Gets the permission messages for the Manifest permissions. Also adds any 57 // Gets the permission messages for the Manifest permissions. Also adds any
57 // permission IDs from manifest Permissions to |permission_ids|. 58 // permission IDs from manifest Permissions to |permission_ids|.
58 // TODO(sashab): Deprecate the |permissions| argument, and rename this to 59 // TODO(sashab): Deprecate the |permissions| argument, and rename this to
59 // AddManifestPermissions(). 60 // AddManifestPermissions().
60 std::set<PermissionMessage> GetManifestPermissionMessages( 61 std::set<PermissionMessage> GetManifestPermissionMessages(
61 const PermissionSet* permissions, 62 const PermissionSet* permissions,
62 PermissionIDSet* permission_ids) const; 63 PermissionIDSet* permission_ids) const;
63 64
64 // Gets the permission messages for the host permissions. Also adds any 65 // Gets the permission messages for the host permissions. Also adds any
65 // permission IDs from host Permissions to |permission_ids|. 66 // permission IDs from host Permissions to |permission_ids|.
66 // TODO(sashab): Deprecate the |permissions| argument, and rename this to 67 // TODO(sashab): Deprecate the |permissions| argument, and rename this to
67 // AddHostPermissions(). 68 // AddHostPermissions().
68 std::set<PermissionMessage> GetHostPermissionMessages( 69 std::set<PermissionMessage> GetHostPermissionMessages(
69 const PermissionSet* permissions, 70 const PermissionSet* permissions,
70 PermissionIDSet* permission_ids, 71 PermissionIDSet* permission_ids,
71 Manifest::Type extension_type) const; 72 Manifest::Type extension_type) const;
72 73
74 // Applies coalescing rules and writes the resulting messages and their
75 // details into |message_strings| and |message_details_strings|.
76 // TODO(treib): Remove this method as soon as we've fully switched to the
77 // new system.
78 void CoalesceWarningMessages(
79 const PermissionSet* permissions,
80 Manifest::Type extension_type,
81 std::vector<base::string16>* message_strings,
82 std::vector<base::string16>* message_details_strings) const;
83
73 // Returns true if |new_permissions| has an elevated API privilege level 84 // Returns true if |new_permissions| has an elevated API privilege level
74 // compared to |old_permissions|. 85 // compared to |old_permissions|.
75 bool IsAPIPrivilegeIncrease( 86 bool IsAPIPrivilegeIncrease(
76 const PermissionSet* old_permissions, 87 const PermissionSet* old_permissions,
77 const PermissionSet* new_permissions) const; 88 const PermissionSet* new_permissions,
89 Manifest::Type extension_type) const;
78 90
79 // Returns true if |new_permissions| has an elevated manifest permission 91 // Returns true if |new_permissions| has an elevated manifest permission
80 // privilege level compared to |old_permissions|. 92 // privilege level compared to |old_permissions|.
81 bool IsManifestPermissionPrivilegeIncrease( 93 bool IsManifestPermissionPrivilegeIncrease(
82 const PermissionSet* old_permissions, 94 const PermissionSet* old_permissions,
83 const PermissionSet* new_permissions) const; 95 const PermissionSet* new_permissions) const;
84 96
85 // Returns true if |new_permissions| has more host permissions compared to 97 // Returns true if |new_permissions| has more host permissions compared to
86 // |old_permissions|. 98 // |old_permissions|.
87 bool IsHostPrivilegeIncrease( 99 bool IsHostPrivilegeIncrease(
88 const PermissionSet* old_permissions, 100 const PermissionSet* old_permissions,
89 const PermissionSet* new_permissions, 101 const PermissionSet* new_permissions,
90 Manifest::Type extension_type) const; 102 Manifest::Type extension_type) const;
91 103
92 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProvider); 104 DISALLOW_COPY_AND_ASSIGN(ChromePermissionMessageProvider);
93 }; 105 };
94 106
95 } // namespace extensions 107 } // namespace extensions
96 108
97 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVID ER_H_ 109 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVID ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698