| OLD | NEW |
| 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 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 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // Returns true if the extension should be displayed in the app launcher. | 400 // Returns true if the extension should be displayed in the app launcher. |
| 401 bool ShouldDisplayInAppLauncher() const; | 401 bool ShouldDisplayInAppLauncher() const; |
| 402 | 402 |
| 403 // Returns true if the extension should be displayed in the browser NTP. | 403 // Returns true if the extension should be displayed in the browser NTP. |
| 404 bool ShouldDisplayInNewTabPage() const; | 404 bool ShouldDisplayInNewTabPage() const; |
| 405 | 405 |
| 406 // Returns true if the extension should be displayed in the extension | 406 // Returns true if the extension should be displayed in the extension |
| 407 // settings page (i.e. chrome://extensions). | 407 // settings page (i.e. chrome://extensions). |
| 408 bool ShouldDisplayInExtensionSettings() const; | 408 bool ShouldDisplayInExtensionSettings() const; |
| 409 | 409 |
| 410 // Returns true if the extension has a content script declared at |url|. | |
| 411 bool HasContentScriptAtURL(const GURL& url) const; | |
| 412 | |
| 413 // Gets the tab-specific host permissions of |tab_id|, or NULL if there | 410 // Gets the tab-specific host permissions of |tab_id|, or NULL if there |
| 414 // aren't any. | 411 // aren't any. |
| 415 scoped_refptr<const PermissionSet> GetTabSpecificPermissions(int tab_id) | 412 scoped_refptr<const PermissionSet> GetTabSpecificPermissions(int tab_id) |
| 416 const; | 413 const; |
| 417 | 414 |
| 418 // Updates the tab-specific permissions of |tab_id| to include those from | 415 // Updates the tab-specific permissions of |tab_id| to include those from |
| 419 // |permissions|. | 416 // |permissions|. |
| 420 void UpdateTabSpecificPermissions( | 417 void UpdateTabSpecificPermissions( |
| 421 int tab_id, | 418 int tab_id, |
| 422 scoped_refptr<const PermissionSet> permissions) const; | 419 scoped_refptr<const PermissionSet> permissions) const; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 446 const std::string& non_localized_name() const { return non_localized_name_; } | 443 const std::string& non_localized_name() const { return non_localized_name_; } |
| 447 // Base64-encoded version of the key used to sign this extension. | 444 // Base64-encoded version of the key used to sign this extension. |
| 448 // In pseudocode, returns | 445 // In pseudocode, returns |
| 449 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). | 446 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). |
| 450 const std::string& public_key() const { return public_key_; } | 447 const std::string& public_key() const { return public_key_; } |
| 451 const std::string& description() const { return description_; } | 448 const std::string& description() const { return description_; } |
| 452 int manifest_version() const { return manifest_version_; } | 449 int manifest_version() const { return manifest_version_; } |
| 453 bool converted_from_user_script() const { | 450 bool converted_from_user_script() const { |
| 454 return converted_from_user_script_; | 451 return converted_from_user_script_; |
| 455 } | 452 } |
| 456 const UserScriptList& content_scripts() const { return content_scripts_; } | |
| 457 const ActionInfo* system_indicator_info() const { | 453 const ActionInfo* system_indicator_info() const { |
| 458 return system_indicator_info_.get(); | 454 return system_indicator_info_.get(); |
| 459 } | 455 } |
| 460 const std::vector<NaClModuleInfo>& nacl_modules() const { | 456 const std::vector<NaClModuleInfo>& nacl_modules() const { |
| 461 return nacl_modules_; | 457 return nacl_modules_; |
| 462 } | 458 } |
| 463 const PermissionSet* optional_permission_set() const { | 459 const PermissionSet* optional_permission_set() const { |
| 464 return optional_permission_set_.get(); | 460 return optional_permission_set_.get(); |
| 465 } | 461 } |
| 466 const PermissionSet* required_permission_set() const { | 462 const PermissionSet* required_permission_set() const { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 479 void AddInstallWarnings(const std::vector<InstallWarning>& new_warnings); | 475 void AddInstallWarnings(const std::vector<InstallWarning>& new_warnings); |
| 480 const std::vector<InstallWarning>& install_warnings() const { | 476 const std::vector<InstallWarning>& install_warnings() const { |
| 481 return install_warnings_; | 477 return install_warnings_; |
| 482 } | 478 } |
| 483 const extensions::Manifest* manifest() const { | 479 const extensions::Manifest* manifest() const { |
| 484 return manifest_.get(); | 480 return manifest_.get(); |
| 485 } | 481 } |
| 486 bool incognito_split_mode() const { return incognito_split_mode_; } | 482 bool incognito_split_mode() const { return incognito_split_mode_; } |
| 487 bool offline_enabled() const { return offline_enabled_; } | 483 bool offline_enabled() const { return offline_enabled_; } |
| 488 bool wants_file_access() const { return wants_file_access_; } | 484 bool wants_file_access() const { return wants_file_access_; } |
| 485 // TODO(rdevlin.cronin): This is needed for ContentScriptsHandler, and should |
| 486 // be moved out as part of crbug.com/159265. This should not be used anywhere |
| 487 // else. |
| 488 void set_wants_file_access(bool wants_file_access) { |
| 489 wants_file_access_ = wants_file_access; |
| 490 } |
| 489 int creation_flags() const { return creation_flags_; } | 491 int creation_flags() const { return creation_flags_; } |
| 490 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } | 492 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } |
| 491 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } | 493 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } |
| 492 bool was_installed_by_default() const { | 494 bool was_installed_by_default() const { |
| 493 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; | 495 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; |
| 494 } | 496 } |
| 495 | 497 |
| 496 // App-related. | 498 // App-related. |
| 497 bool is_app() const; | 499 bool is_app() const; |
| 498 bool is_platform_app() const; | 500 bool is_platform_app() const; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 596 |
| 595 bool LoadSharedFeatures(string16* error); | 597 bool LoadSharedFeatures(string16* error); |
| 596 bool LoadDescription(string16* error); | 598 bool LoadDescription(string16* error); |
| 597 bool LoadManifestVersion(string16* error); | 599 bool LoadManifestVersion(string16* error); |
| 598 bool LoadNaClModules(string16* error); | 600 bool LoadNaClModules(string16* error); |
| 599 bool LoadSandboxedPages(string16* error); | 601 bool LoadSandboxedPages(string16* error); |
| 600 // Must be called after the "plugins" key has been parsed. | 602 // Must be called after the "plugins" key has been parsed. |
| 601 bool LoadRequirements(string16* error); | 603 bool LoadRequirements(string16* error); |
| 602 bool LoadOfflineEnabled(string16* error); | 604 bool LoadOfflineEnabled(string16* error); |
| 603 bool LoadExtensionFeatures(string16* error); | 605 bool LoadExtensionFeatures(string16* error); |
| 604 bool LoadContentScripts(string16* error); | |
| 605 bool LoadBrowserAction(string16* error); | 606 bool LoadBrowserAction(string16* error); |
| 606 bool LoadSystemIndicator(string16* error); | 607 bool LoadSystemIndicator(string16* error); |
| 607 bool LoadTextToSpeechVoices(string16* error); | 608 bool LoadTextToSpeechVoices(string16* error); |
| 608 bool LoadIncognitoMode(string16* error); | 609 bool LoadIncognitoMode(string16* error); |
| 609 bool LoadManagedModeFeatures(string16* error); | 610 bool LoadManagedModeFeatures(string16* error); |
| 610 bool LoadManagedModeSites( | 611 bool LoadManagedModeSites( |
| 611 const base::DictionaryValue* content_pack_value, | 612 const base::DictionaryValue* content_pack_value, |
| 612 string16* error); | 613 string16* error); |
| 613 bool LoadManagedModeConfigurations( | 614 bool LoadManagedModeConfigurations( |
| 614 const base::DictionaryValue* content_pack_value, | 615 const base::DictionaryValue* content_pack_value, |
| 615 string16* error); | 616 string16* error); |
| 616 | 617 |
| 617 // Helper method that loads a UserScript object from a | |
| 618 // dictionary in the content_script list of the manifest. | |
| 619 bool LoadUserScriptHelper(const base::DictionaryValue* content_script, | |
| 620 int definition_index, | |
| 621 string16* error, | |
| 622 UserScript* result); | |
| 623 | |
| 624 // Helper method that loads either the include_globs or exclude_globs list | |
| 625 // from an entry in the content_script lists of the manifest. | |
| 626 bool LoadGlobsHelper(const base::DictionaryValue* content_script, | |
| 627 int content_script_index, | |
| 628 const char* globs_property_name, | |
| 629 string16* error, | |
| 630 void(UserScript::*add_method)(const std::string& glob), | |
| 631 UserScript* instance); | |
| 632 | |
| 633 // Returns true if the extension has more than one "UI surface". For example, | 618 // Returns true if the extension has more than one "UI surface". For example, |
| 634 // an extension that has a browser action and a page action. | 619 // an extension that has a browser action and a page action. |
| 635 bool HasMultipleUISurfaces() const; | 620 bool HasMultipleUISurfaces() const; |
| 636 | 621 |
| 637 // Updates the launch URL and extents for the extension using the given | 622 // Updates the launch URL and extents for the extension using the given |
| 638 // |override_url|. | 623 // |override_url|. |
| 639 void OverrideLaunchUrl(const GURL& override_url); | 624 void OverrideLaunchUrl(const GURL& override_url); |
| 640 | 625 |
| 641 // Custom checks for the experimental permission that can't be expressed in | 626 // Custom checks for the experimental permission that can't be expressed in |
| 642 // _permission_features.json. | 627 // _permission_features.json. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 // The extension's version. | 697 // The extension's version. |
| 713 scoped_ptr<Version> version_; | 698 scoped_ptr<Version> version_; |
| 714 | 699 |
| 715 // An optional longer description of the extension. | 700 // An optional longer description of the extension. |
| 716 std::string description_; | 701 std::string description_; |
| 717 | 702 |
| 718 // True if the extension was generated from a user script. (We show slightly | 703 // True if the extension was generated from a user script. (We show slightly |
| 719 // different UI if so). | 704 // different UI if so). |
| 720 bool converted_from_user_script_; | 705 bool converted_from_user_script_; |
| 721 | 706 |
| 722 // Paths to the content scripts the extension contains. | |
| 723 UserScriptList content_scripts_; | |
| 724 | |
| 725 // The extension's system indicator, if any. | 707 // The extension's system indicator, if any. |
| 726 scoped_ptr<ActionInfo> system_indicator_info_; | 708 scoped_ptr<ActionInfo> system_indicator_info_; |
| 727 | 709 |
| 728 // Optional list of NaCl modules and associated properties. | 710 // Optional list of NaCl modules and associated properties. |
| 729 std::vector<NaClModuleInfo> nacl_modules_; | 711 std::vector<NaClModuleInfo> nacl_modules_; |
| 730 | 712 |
| 731 // Optional list of extension pages that are sandboxed (served from a unique | 713 // Optional list of extension pages that are sandboxed (served from a unique |
| 732 // origin with a different Content Security Policy). | 714 // origin with a different Content Security Policy). |
| 733 URLPatternSet sandboxed_pages_; | 715 URLPatternSet sandboxed_pages_; |
| 734 | 716 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 | 832 |
| 851 UpdatedExtensionPermissionsInfo( | 833 UpdatedExtensionPermissionsInfo( |
| 852 const Extension* extension, | 834 const Extension* extension, |
| 853 const PermissionSet* permissions, | 835 const PermissionSet* permissions, |
| 854 Reason reason); | 836 Reason reason); |
| 855 }; | 837 }; |
| 856 | 838 |
| 857 } // namespace extensions | 839 } // namespace extensions |
| 858 | 840 |
| 859 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 841 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |