| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 bool HasAPIPermission(ExtensionAPIPermission::ID permission) const; | 377 bool HasAPIPermission(ExtensionAPIPermission::ID permission) const; |
| 378 bool HasAPIPermission(const std::string& function_name) const; | 378 bool HasAPIPermission(const std::string& function_name) const; |
| 379 | 379 |
| 380 const URLPatternSet& GetEffectiveHostPermissions() const; | 380 const URLPatternSet& GetEffectiveHostPermissions() const; |
| 381 | 381 |
| 382 // Returns true if the extension can silently increase its permission level. | 382 // Returns true if the extension can silently increase its permission level. |
| 383 // Extensions that can silently increase permissions are installed through | 383 // Extensions that can silently increase permissions are installed through |
| 384 // mechanisms that are implicitly trusted. | 384 // mechanisms that are implicitly trusted. |
| 385 bool CanSilentlyIncreasePermissions() const; | 385 bool CanSilentlyIncreasePermissions() const; |
| 386 | 386 |
| 387 // Returns true if this extension can specify |api|. |
| 388 bool CanSpecifyAPIPermission(const ExtensionAPIPermission* api, |
| 389 std::string* error) const; |
| 390 bool CanSpecifyComponentOnlyPermission() const; |
| 391 bool CanSpecifyExperimentalPermission() const; |
| 392 bool CanSpecifyPermissionForHostedApp( |
| 393 const ExtensionAPIPermission* api) const; |
| 394 |
| 387 // Whether or not the extension is allowed permission for a URL pattern from | 395 // Whether or not the extension is allowed permission for a URL pattern from |
| 388 // the manifest. http, https, and chrome://favicon/ is allowed for all | 396 // the manifest. http, https, and chrome://favicon/ is allowed for all |
| 389 // extensions, while component extensions are allowed access to | 397 // extensions, while component extensions are allowed access to |
| 390 // chrome://resources. | 398 // chrome://resources. |
| 391 bool CanSpecifyHostPermission(const URLPattern& pattern) const; | 399 bool CanSpecifyHostPermission(const URLPattern& pattern) const; |
| 392 | 400 |
| 393 // Whether the extension has access to the given URL. | 401 // Whether the extension has access to the given URL. |
| 394 bool HasHostPermission(const GURL& url) const; | 402 bool HasHostPermission(const GURL& url) const; |
| 395 | 403 |
| 396 // Whether the extension has effective access to all hosts. This is true if | 404 // Whether the extension has effective access to all hosts. This is true if |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 const base::DictionaryValue* sidebar, std::string* error); | 680 const base::DictionaryValue* sidebar, std::string* error); |
| 673 | 681 |
| 674 // Returns true if the extension has more than one "UI surface". For example, | 682 // Returns true if the extension has more than one "UI surface". For example, |
| 675 // an extension that has a browser action and a page action. | 683 // an extension that has a browser action and a page action. |
| 676 bool HasMultipleUISurfaces() const; | 684 bool HasMultipleUISurfaces() const; |
| 677 | 685 |
| 678 // Figures out if a source contains keys not associated with themes - we | 686 // Figures out if a source contains keys not associated with themes - we |
| 679 // don't want to allow scripts and such to be bundled with themes. | 687 // don't want to allow scripts and such to be bundled with themes. |
| 680 bool ContainsNonThemeKeys(const base::DictionaryValue& source) const; | 688 bool ContainsNonThemeKeys(const base::DictionaryValue& source) const; |
| 681 | 689 |
| 682 // Only allow the experimental API permission if the command line | |
| 683 // flag is present. | |
| 684 bool IsDisallowedExperimentalPermission( | |
| 685 ExtensionAPIPermission::ID permission) const; | |
| 686 | |
| 687 // Returns true if this is a component, or we are not attempting to access a | |
| 688 // component-private permission. | |
| 689 bool IsComponentOnlyPermission(const ExtensionAPIPermission* api) const; | |
| 690 | |
| 691 // Updates the launch URL and extents for the extension using the given | 690 // Updates the launch URL and extents for the extension using the given |
| 692 // |override_url|. | 691 // |override_url|. |
| 693 void OverrideLaunchUrl(const GURL& override_url); | 692 void OverrideLaunchUrl(const GURL& override_url); |
| 694 | 693 |
| 695 // Cached images for this extension. This should only be touched on the UI | 694 // Cached images for this extension. This should only be touched on the UI |
| 696 // thread. | 695 // thread. |
| 697 mutable ImageCache image_cache_; | 696 mutable ImageCache image_cache_; |
| 698 | 697 |
| 699 // A persistent, globally unique ID. An extension's ID is used in things | 698 // A persistent, globally unique ID. An extension's ID is used in things |
| 700 // like directory structures and URLs, and is expected to not change across | 699 // like directory structures and URLs, and is expected to not change across |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 // only contain the removed permissions. | 927 // only contain the removed permissions. |
| 929 const ExtensionPermissionSet* permissions; | 928 const ExtensionPermissionSet* permissions; |
| 930 | 929 |
| 931 UpdatedExtensionPermissionsInfo( | 930 UpdatedExtensionPermissionsInfo( |
| 932 const Extension* extension, | 931 const Extension* extension, |
| 933 const ExtensionPermissionSet* permissions, | 932 const ExtensionPermissionSet* permissions, |
| 934 Reason reason); | 933 Reason reason); |
| 935 }; | 934 }; |
| 936 | 935 |
| 937 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 936 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |