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

Side by Side Diff: extensions/common/permissions/permissions_data.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: review (the easy parts) 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_PERMISSIONS_DATA_H_ 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ 6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 static bool CanExecuteScriptEverywhere(const Extension* extension); 64 static bool CanExecuteScriptEverywhere(const Extension* extension);
65 65
66 // Returns true if the --scripts-require-action flag would possibly affect 66 // Returns true if the --scripts-require-action flag would possibly affect
67 // the given |extension| and |permissions|. We pass in the |permissions| 67 // the given |extension| and |permissions|. We pass in the |permissions|
68 // explicitly, as we may need to check with permissions other than the ones 68 // explicitly, as we may need to check with permissions other than the ones
69 // that are currently on the extension's PermissionsData. 69 // that are currently on the extension's PermissionsData.
70 static bool ScriptsMayRequireActionForExtension( 70 static bool ScriptsMayRequireActionForExtension(
71 const Extension* extension, 71 const Extension* extension,
72 const PermissionSet* permissions); 72 const PermissionSet* permissions);
73 73
74 // Returns true if we should skip the permisisons warning for the extension 74 // Returns true if we should skip the permissions warning for the extension
75 // with the given |extension_id|. 75 // with the given |extension_id|.
76 static bool ShouldSkipPermissionWarnings(const std::string& extension_id); 76 static bool ShouldSkipPermissionWarnings(const std::string& extension_id);
77 77
78 // Returns true if the given |url| is restricted for the given |extension|, 78 // Returns true if the given |url| is restricted for the given |extension|,
79 // as is commonly the case for chrome:// urls. 79 // as is commonly the case for chrome:// urls.
80 // NOTE: You probably want to use CanAccessPage(). 80 // NOTE: You probably want to use CanAccessPage().
81 static bool IsRestrictedUrl(const GURL& document_url, 81 static bool IsRestrictedUrl(const GURL& document_url,
82 const GURL& top_frame_url, 82 const GURL& top_frame_url,
83 const Extension* extension, 83 const Extension* extension,
84 std::string* error); 84 std::string* error);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 // Whether the extension has effective access to all hosts. This is true if 127 // Whether the extension has effective access to all hosts. This is true if
128 // there is a content script that matches all hosts, if there is a host 128 // there is a content script that matches all hosts, if there is a host
129 // permission grants access to all hosts (like <all_urls>) or an api 129 // permission grants access to all hosts (like <all_urls>) or an api
130 // permission that effectively grants access to all hosts (e.g. proxy, 130 // permission that effectively grants access to all hosts (e.g. proxy,
131 // network, etc.) 131 // network, etc.)
132 bool HasEffectiveAccessToAllHosts() const; 132 bool HasEffectiveAccessToAllHosts() const;
133 133
134 // Returns the full list of permission messages that should display at 134 // Returns the full list of permission messages that should display at
135 // install time. 135 // install time.
136 // TODO(sashab): Deprecate this in favor of GetCoalescedPermissionMessages(). 136 // Deprecated; use GetCoalescedPermissionMessages() instead.
Yoyo Zhou 2015/03/17 00:02:05 Why was this removed? I think it helps to say what
Marc Treib 2015/03/17 10:00:27 Ah, the CL's confusing here, sorry about that. The
137 PermissionMessages GetPermissionMessages() const; 137 // TODO(treib): Remove this once we've fully switched to the new system.
138 PermissionMessages GetLegacyPermissionMessages() const;
138 139
139 // Returns the full list of permission messages that should display at install 140 // Returns the full list of permission messages that should display at install
140 // time as strings. 141 // time as strings.
141 // TODO(sashab): Deprecate this in favor of GetCoalescedPermissionMessages(). 142 // Deprecated; use GetCoalescedPermissionMessages() instead.
142 std::vector<base::string16> GetPermissionMessageStrings() const; 143 // TODO(treib): Remove this once we've fully switched to the new system.
144 std::vector<base::string16> GetLegacyPermissionMessageStrings() const;
143 145
144 // Returns the full list of permission details for messages that should 146 // Returns the full list of permission details for messages that should
145 // display at install time as strings. 147 // display at install time as strings.
146 // TODO(sashab): Deprecate this in favor of GetCoalescedPermissionMessages(). 148 // Deprecated; use GetCoalescedPermissionMessages() instead.
147 std::vector<base::string16> GetPermissionMessageDetailsStrings() const; 149 // TODO(treib): Remove this once we've fully switched to the new system.
150 std::vector<base::string16> GetLegacyPermissionMessageDetailsStrings() const;
148 151
149 // Returns the full list of permission details for messages that should 152 // Returns the full list of permission details for messages that should
150 // display at install time, in a nested format ready for display. 153 // display at install time, in a nested format ready for display.
151 CoalescedPermissionMessages GetCoalescedPermissionMessages() const; 154 CoalescedPermissionMessages GetCoalescedPermissionMessages() const;
152 155
153 // Returns true if the extension has requested all-hosts permissions (or 156 // Returns true if the extension has requested all-hosts permissions (or
154 // something close to it), but has had it withheld. 157 // something close to it), but has had it withheld.
155 bool HasWithheldImpliedAllHosts() const; 158 bool HasWithheldImpliedAllHosts() const;
156 159
157 // Returns true if the |extension| has permission to access and interact with 160 // Returns true if the |extension| has permission to access and interact with
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 mutable scoped_refptr<const PermissionSet> withheld_permissions_unsafe_; 280 mutable scoped_refptr<const PermissionSet> withheld_permissions_unsafe_;
278 281
279 mutable TabPermissionsMap tab_specific_permissions_; 282 mutable TabPermissionsMap tab_specific_permissions_;
280 283
281 DISALLOW_COPY_AND_ASSIGN(PermissionsData); 284 DISALLOW_COPY_AND_ASSIGN(PermissionsData);
282 }; 285 };
283 286
284 } // namespace extensions 287 } // namespace extensions
285 288
286 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ 289 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_
OLDNEW
« no previous file with comments | « extensions/common/permissions/permission_message_test_util.cc ('k') | extensions/common/permissions/permissions_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698