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

Side by Side Diff: chrome/common/extensions/extension.h

Issue 4687005: Track permissions granted to extensions in prefs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed updating a method call Created 10 years 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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_EXTENSION_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 static const Permission kPermissions[]; 157 static const Permission kPermissions[];
158 static const size_t kNumPermissions; 158 static const size_t kNumPermissions;
159 static const char* const kHostedAppPermissionNames[]; 159 static const char* const kHostedAppPermissionNames[];
160 static const size_t kNumHostedAppPermissions; 160 static const size_t kNumHostedAppPermissions;
161 161
162 // The old name for the unlimited storage permission, which is deprecated but 162 // The old name for the unlimited storage permission, which is deprecated but
163 // still accepted as meaning the same thing as kUnlimitedStoragePermission. 163 // still accepted as meaning the same thing as kUnlimitedStoragePermission.
164 static const char kOldUnlimitedStoragePermission[]; 164 static const char kOldUnlimitedStoragePermission[];
165 165
166 // Valid schemes for web extent URLPatterns.
167 static const int kValidWebExtentSchemes;
168
166 // Returns true if the string is one of the known hosted app permissions (see 169 // Returns true if the string is one of the known hosted app permissions (see
167 // kHostedAppPermissionNames). 170 // kHostedAppPermissionNames).
168 static bool IsHostedAppPermission(const std::string& permission); 171 static bool IsHostedAppPermission(const std::string& permission);
169 172
170 // The name of the manifest inside an extension. 173 // The name of the manifest inside an extension.
171 static const FilePath::CharType kManifestFilename[]; 174 static const FilePath::CharType kManifestFilename[];
172 175
173 // The name of locale folder inside an extension. 176 // The name of locale folder inside an extension.
174 static const FilePath::CharType kLocaleFolder[]; 177 static const FilePath::CharType kLocaleFolder[];
175 178
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // Generates an extension ID from arbitrary input. The same input string will 246 // Generates an extension ID from arbitrary input. The same input string will
244 // always generate the same output ID. 247 // always generate the same output ID.
245 static bool GenerateId(const std::string& input, std::string* output); 248 static bool GenerateId(const std::string& input, std::string* output);
246 249
247 // Expects base64 encoded |input| and formats into |output| including 250 // Expects base64 encoded |input| and formats into |output| including
248 // the appropriate header & footer. 251 // the appropriate header & footer.
249 static bool FormatPEMForFileOutput(const std::string input, 252 static bool FormatPEMForFileOutput(const std::string input,
250 std::string* output, bool is_public); 253 std::string* output, bool is_public);
251 254
252 // Determine whether |new_extension| has increased privileges compared to 255 // Determine whether |new_extension| has increased privileges compared to
253 // |old_extension|. 256 // its previously granted permissions, specified by |granted_apis|,
254 static bool IsPrivilegeIncrease(const Extension* old_extension, 257 // |granted_extent| and |granted_full_access|.
258 static bool IsPrivilegeIncrease(const bool granted_full_access,
259 const std::set<std::string>& granted_apis,
260 const ExtensionExtent& granted_extent,
255 const Extension* new_extension); 261 const Extension* new_extension);
256 262
257 // Given an extension and icon size, read it if present and decode it into 263 // Given an extension and icon size, read it if present and decode it into
258 // result. In the browser process, this will DCHECK if not called on the 264 // result. In the browser process, this will DCHECK if not called on the
259 // file thread. To easily load extension images on the UI thread, see 265 // file thread. To easily load extension images on the UI thread, see
260 // ImageLoadingTracker. 266 // ImageLoadingTracker.
261 static void DecodeIcon(const Extension* extension, 267 static void DecodeIcon(const Extension* extension,
262 Icons icon_size, 268 Icons icon_size,
263 scoped_ptr<SkBitmap>* result); 269 scoped_ptr<SkBitmap>* result);
264 270
(...skipping 29 matching lines...) Expand all
294 UserScript* script, 300 UserScript* script,
295 std::string* error); 301 std::string* error);
296 302
297 // Adds an extension to the scripting whitelist. Used for testing only. 303 // Adds an extension to the scripting whitelist. Used for testing only.
298 static void SetScriptingWhitelist(const ScriptingWhitelist& whitelist); 304 static void SetScriptingWhitelist(const ScriptingWhitelist& whitelist);
299 305
300 // Returns true if the extension has the specified API permission. 306 // Returns true if the extension has the specified API permission.
301 static bool HasApiPermission(const std::set<std::string>& api_permissions, 307 static bool HasApiPermission(const std::set<std::string>& api_permissions,
302 const std::string& function_name); 308 const std::string& function_name);
303 309
310 // Whether the |effective_host_permissions| and |api_permissions| include
311 // effective access to all hosts. See the non-static version of the method
312 // for more details.
313 static bool HasEffectiveAccessToAllHosts(
314 const ExtensionExtent& effective_host_permissions,
315 const std::set<std::string>& api_permissions);
316
304 bool HasApiPermission(const std::string& function_name) const { 317 bool HasApiPermission(const std::string& function_name) const {
305 return HasApiPermission(this->api_permissions(), function_name); 318 return HasApiPermission(this->api_permissions(), function_name);
306 } 319 }
307 320
308 const ExtensionExtent& GetEffectiveHostPermissions() const { 321 const ExtensionExtent& GetEffectiveHostPermissions() const {
309 return effective_host_permissions_; 322 return effective_host_permissions_;
310 } 323 }
311 324
312 // Whether or not the extension is allowed permission for a URL pattern from 325 // Whether or not the extension is allowed permission for a URL pattern from
313 // the manifest. http, https, and chrome://favicon/ is allowed for all 326 // the manifest. http, https, and chrome://favicon/ is allowed for all
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 std::set<std::string> extension_api_permissions; 696 std::set<std::string> extension_api_permissions;
684 // TODO(akalin): Once we have a unified ExtensionType, replace the 697 // TODO(akalin): Once we have a unified ExtensionType, replace the
685 // below member variables with a member of that type. 698 // below member variables with a member of that type.
686 bool is_theme; 699 bool is_theme;
687 bool is_app; 700 bool is_app;
688 bool converted_from_user_script; 701 bool converted_from_user_script;
689 GURL update_url; 702 GURL update_url;
690 }; 703 };
691 704
692 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 705 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698