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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 return converted_from_user_script_; | 501 return converted_from_user_script_; |
502 } | 502 } |
503 const UserScriptList& content_scripts() const { return content_scripts_; } | 503 const UserScriptList& content_scripts() const { return content_scripts_; } |
504 const ActionInfo* system_indicator_info() const { | 504 const ActionInfo* system_indicator_info() const { |
505 return system_indicator_info_.get(); | 505 return system_indicator_info_.get(); |
506 } | 506 } |
507 const std::vector<PluginInfo>& plugins() const { return plugins_; } | 507 const std::vector<PluginInfo>& plugins() const { return plugins_; } |
508 const std::vector<NaClModuleInfo>& nacl_modules() const { | 508 const std::vector<NaClModuleInfo>& nacl_modules() const { |
509 return nacl_modules_; | 509 return nacl_modules_; |
510 } | 510 } |
511 bool has_background_page() const { | |
512 return background_url_.is_valid() || !background_scripts_.empty(); | |
513 } | |
514 bool allow_background_js_access() const { | |
515 return allow_background_js_access_; | |
516 } | |
517 const std::vector<std::string>& background_scripts() const { | |
518 return background_scripts_; | |
519 } | |
520 bool has_persistent_background_page() const { | |
521 return has_background_page() && background_page_is_persistent_; | |
522 } | |
523 bool has_lazy_background_page() const { | |
524 return has_background_page() && !background_page_is_persistent_; | |
525 } | |
526 const PermissionSet* optional_permission_set() const { | 511 const PermissionSet* optional_permission_set() const { |
527 return optional_permission_set_.get(); | 512 return optional_permission_set_.get(); |
528 } | 513 } |
529 const PermissionSet* required_permission_set() const { | 514 const PermissionSet* required_permission_set() const { |
530 return required_permission_set_.get(); | 515 return required_permission_set_.get(); |
531 } | 516 } |
532 // Returns the temporary APIPermissionSet used in initialization. | 517 // Returns the temporary APIPermissionSet used in initialization. |
533 // (NULL after initialization is completed.) | 518 // (NULL after initialization is completed.) |
534 APIPermissionSet* initial_api_permissions() { | 519 APIPermissionSet* initial_api_permissions() { |
535 return initial_api_permissions_.get(); | 520 return initial_api_permissions_.get(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 564 |
580 // Content Security Policy! | 565 // Content Security Policy! |
581 const std::string& content_security_policy() const { | 566 const std::string& content_security_policy() const { |
582 return content_security_policy_; | 567 return content_security_policy_; |
583 } | 568 } |
584 | 569 |
585 // Content pack related. | 570 // Content pack related. |
586 bool is_content_pack() const; | 571 bool is_content_pack() const; |
587 ExtensionResource GetContentPackSiteList() const; | 572 ExtensionResource GetContentPackSiteList() const; |
588 | 573 |
589 GURL GetBackgroundURL() const; | |
590 | |
591 private: | 574 private: |
592 friend class base::RefCountedThreadSafe<Extension>; | 575 friend class base::RefCountedThreadSafe<Extension>; |
593 | 576 |
594 class RuntimeData { | 577 class RuntimeData { |
595 public: | 578 public: |
596 RuntimeData(); | 579 RuntimeData(); |
597 explicit RuntimeData(const PermissionSet* active); | 580 explicit RuntimeData(const PermissionSet* active); |
598 ~RuntimeData(); | 581 ~RuntimeData(); |
599 | 582 |
600 void SetActivePermissions(const PermissionSet* active); | 583 void SetActivePermissions(const PermissionSet* active); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 bool LoadSharedFeatures(string16* error); | 648 bool LoadSharedFeatures(string16* error); |
666 bool LoadDescription(string16* error); | 649 bool LoadDescription(string16* error); |
667 bool LoadManifestVersion(string16* error); | 650 bool LoadManifestVersion(string16* error); |
668 bool LoadIcons(string16* error); | 651 bool LoadIcons(string16* error); |
669 bool LoadPlugins(string16* error); | 652 bool LoadPlugins(string16* error); |
670 bool LoadNaClModules(string16* error); | 653 bool LoadNaClModules(string16* error); |
671 bool LoadSandboxedPages(string16* error); | 654 bool LoadSandboxedPages(string16* error); |
672 // Must be called after LoadPlugins(). | 655 // Must be called after LoadPlugins(). |
673 bool LoadRequirements(string16* error); | 656 bool LoadRequirements(string16* error); |
674 bool LoadOfflineEnabled(string16* error); | 657 bool LoadOfflineEnabled(string16* error); |
675 bool LoadBackgroundScripts(string16* error); | |
676 bool LoadBackgroundScripts(const std::string& key, string16* error); | |
677 bool LoadBackgroundPage(string16* error); | |
678 bool LoadBackgroundPage(const std::string& key, | |
679 string16* error); | |
680 bool LoadBackgroundPersistent(string16* error); | |
681 bool LoadBackgroundAllowJSAccess(string16* error); | |
682 bool LoadExtensionFeatures(string16* error); | 658 bool LoadExtensionFeatures(string16* error); |
683 bool LoadContentScripts(string16* error); | 659 bool LoadContentScripts(string16* error); |
684 bool LoadBrowserAction(string16* error); | 660 bool LoadBrowserAction(string16* error); |
685 bool LoadSystemIndicator(string16* error); | 661 bool LoadSystemIndicator(string16* error); |
686 bool LoadTextToSpeechVoices(string16* error); | 662 bool LoadTextToSpeechVoices(string16* error); |
687 bool LoadIncognitoMode(string16* error); | 663 bool LoadIncognitoMode(string16* error); |
688 bool LoadContentSecurityPolicy(string16* error); | 664 bool LoadContentSecurityPolicy(string16* error); |
689 bool LoadManagedModeFeatures(string16* error); | 665 bool LoadManagedModeFeatures(string16* error); |
690 bool LoadManagedModeSites( | 666 bool LoadManagedModeSites( |
691 const base::DictionaryValue* content_pack_value, | 667 const base::DictionaryValue* content_pack_value, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 792 |
817 // Optional list of extension pages that are sandboxed (served from a unique | 793 // Optional list of extension pages that are sandboxed (served from a unique |
818 // origin with a different Content Security Policy). | 794 // origin with a different Content Security Policy). |
819 URLPatternSet sandboxed_pages_; | 795 URLPatternSet sandboxed_pages_; |
820 | 796 |
821 // Content Security Policy that should be used to enforce the sandbox used | 797 // Content Security Policy that should be used to enforce the sandbox used |
822 // by sandboxed pages (guaranteed to have the "sandbox" directive without the | 798 // by sandboxed pages (guaranteed to have the "sandbox" directive without the |
823 // "allow-same-origin" token). | 799 // "allow-same-origin" token). |
824 std::string sandboxed_pages_content_security_policy_; | 800 std::string sandboxed_pages_content_security_policy_; |
825 | 801 |
826 // Optional URL to a master page of which a single instance should be always | |
827 // loaded in the background. | |
828 GURL background_url_; | |
829 | |
830 // Optional list of scripts to use to generate a background page. If this is | |
831 // present, background_url_ will be empty and generated by GetBackgroundURL(). | |
832 std::vector<std::string> background_scripts_; | |
833 | |
834 // True if the background page should stay loaded forever; false if it should | |
835 // load on-demand (when it needs to handle an event). Defaults to true. | |
836 bool background_page_is_persistent_; | |
837 | |
838 // True if the background page can be scripted by pages of the app or | |
839 // extension, in which case all such pages must run in the same process. | |
840 // False if such pages are not permitted to script the background page, | |
841 // allowing them to run in different processes. | |
842 bool allow_background_js_access_; | |
843 | |
844 // The public key used to sign the contents of the crx package. | 802 // The public key used to sign the contents of the crx package. |
845 std::string public_key_; | 803 std::string public_key_; |
846 | 804 |
847 // A file containing a list of sites for Managed Mode. | 805 // A file containing a list of sites for Managed Mode. |
848 base::FilePath content_pack_site_list_; | 806 base::FilePath content_pack_site_list_; |
849 | 807 |
850 // The manifest from which this extension was created. | 808 // The manifest from which this extension was created. |
851 scoped_ptr<Manifest> manifest_; | 809 scoped_ptr<Manifest> manifest_; |
852 | 810 |
853 // Stored parsed manifest data. | 811 // Stored parsed manifest data. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 | 919 |
962 UpdatedExtensionPermissionsInfo( | 920 UpdatedExtensionPermissionsInfo( |
963 const Extension* extension, | 921 const Extension* extension, |
964 const PermissionSet* permissions, | 922 const PermissionSet* permissions, |
965 Reason reason); | 923 Reason reason); |
966 }; | 924 }; |
967 | 925 |
968 } // namespace extensions | 926 } // namespace extensions |
969 | 927 |
970 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 928 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
OLD | NEW |