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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 return converted_from_user_script_; | 463 return converted_from_user_script_; |
464 } | 464 } |
465 const UserScriptList& content_scripts() const { return content_scripts_; } | 465 const UserScriptList& content_scripts() const { return content_scripts_; } |
466 const ActionInfo* system_indicator_info() const { | 466 const ActionInfo* system_indicator_info() const { |
467 return system_indicator_info_.get(); | 467 return system_indicator_info_.get(); |
468 } | 468 } |
469 const std::vector<PluginInfo>& plugins() const { return plugins_; } | 469 const std::vector<PluginInfo>& plugins() const { return plugins_; } |
470 const std::vector<NaClModuleInfo>& nacl_modules() const { | 470 const std::vector<NaClModuleInfo>& nacl_modules() const { |
471 return nacl_modules_; | 471 return nacl_modules_; |
472 } | 472 } |
473 bool has_background_page() const { | |
474 return background_url_.is_valid() || !background_scripts_.empty(); | |
475 } | |
476 bool allow_background_js_access() const { | |
477 return allow_background_js_access_; | |
478 } | |
479 const std::vector<std::string>& background_scripts() const { | |
480 return background_scripts_; | |
481 } | |
482 bool has_persistent_background_page() const { | |
483 return has_background_page() && background_page_is_persistent_; | |
484 } | |
485 bool has_lazy_background_page() const { | |
486 return has_background_page() && !background_page_is_persistent_; | |
487 } | |
488 const PermissionSet* optional_permission_set() const { | 473 const PermissionSet* optional_permission_set() const { |
489 return optional_permission_set_.get(); | 474 return optional_permission_set_.get(); |
490 } | 475 } |
491 const PermissionSet* required_permission_set() const { | 476 const PermissionSet* required_permission_set() const { |
492 return required_permission_set_.get(); | 477 return required_permission_set_.get(); |
493 } | 478 } |
494 // Returns the temporary APIPermissionSet used in initialization. | 479 // Returns the temporary APIPermissionSet used in initialization. |
495 // (NULL after initialization is completed.) | 480 // (NULL after initialization is completed.) |
496 APIPermissionSet* initial_api_permissions() { | 481 APIPermissionSet* initial_api_permissions() { |
497 return initial_api_permissions_.get(); | 482 return initial_api_permissions_.get(); |
498 } | 483 } |
| 484 const APIPermissionSet* initial_api_permissions() const { |
| 485 return initial_api_permissions_.get(); |
| 486 } |
499 // Appends |new_warning[s]| to install_warnings_. | 487 // Appends |new_warning[s]| to install_warnings_. |
500 void AddInstallWarning(const InstallWarning& new_warning); | 488 void AddInstallWarning(const InstallWarning& new_warning); |
501 void AddInstallWarnings(const std::vector<InstallWarning>& new_warnings); | 489 void AddInstallWarnings(const std::vector<InstallWarning>& new_warnings); |
502 const std::vector<InstallWarning>& install_warnings() const { | 490 const std::vector<InstallWarning>& install_warnings() const { |
503 return install_warnings_; | 491 return install_warnings_; |
504 } | 492 } |
505 const extensions::Manifest* manifest() const { | 493 const extensions::Manifest* manifest() const { |
506 return manifest_.get(); | 494 return manifest_.get(); |
507 } | 495 } |
508 bool incognito_split_mode() const { return incognito_split_mode_; } | 496 bool incognito_split_mode() const { return incognito_split_mode_; } |
(...skipping 26 matching lines...) Expand all Loading... |
535 int launch_width() const { return launch_width_; } | 523 int launch_width() const { return launch_width_; } |
536 int launch_height() const { return launch_height_; } | 524 int launch_height() const { return launch_height_; } |
537 | 525 |
538 // Theme-related. | 526 // Theme-related. |
539 bool is_theme() const; | 527 bool is_theme() const; |
540 | 528 |
541 // Content pack related. | 529 // Content pack related. |
542 bool is_content_pack() const; | 530 bool is_content_pack() const; |
543 ExtensionResource GetContentPackSiteList() const; | 531 ExtensionResource GetContentPackSiteList() const; |
544 | 532 |
545 GURL GetBackgroundURL() const; | |
546 | |
547 private: | 533 private: |
548 friend class base::RefCountedThreadSafe<Extension>; | 534 friend class base::RefCountedThreadSafe<Extension>; |
549 | 535 |
550 class RuntimeData { | 536 class RuntimeData { |
551 public: | 537 public: |
552 RuntimeData(); | 538 RuntimeData(); |
553 explicit RuntimeData(const PermissionSet* active); | 539 explicit RuntimeData(const PermissionSet* active); |
554 ~RuntimeData(); | 540 ~RuntimeData(); |
555 | 541 |
556 void SetActivePermissions(const PermissionSet* active); | 542 void SetActivePermissions(const PermissionSet* active); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 606 |
621 bool LoadSharedFeatures(string16* error); | 607 bool LoadSharedFeatures(string16* error); |
622 bool LoadDescription(string16* error); | 608 bool LoadDescription(string16* error); |
623 bool LoadManifestVersion(string16* error); | 609 bool LoadManifestVersion(string16* error); |
624 bool LoadPlugins(string16* error); | 610 bool LoadPlugins(string16* error); |
625 bool LoadNaClModules(string16* error); | 611 bool LoadNaClModules(string16* error); |
626 bool LoadSandboxedPages(string16* error); | 612 bool LoadSandboxedPages(string16* error); |
627 // Must be called after LoadPlugins(). | 613 // Must be called after LoadPlugins(). |
628 bool LoadRequirements(string16* error); | 614 bool LoadRequirements(string16* error); |
629 bool LoadOfflineEnabled(string16* error); | 615 bool LoadOfflineEnabled(string16* error); |
630 bool LoadBackgroundScripts(string16* error); | |
631 bool LoadBackgroundScripts(const std::string& key, string16* error); | |
632 bool LoadBackgroundPage(string16* error); | |
633 bool LoadBackgroundPage(const std::string& key, | |
634 string16* error); | |
635 bool LoadBackgroundPersistent(string16* error); | |
636 bool LoadBackgroundAllowJSAccess(string16* error); | |
637 bool LoadExtensionFeatures(string16* error); | 616 bool LoadExtensionFeatures(string16* error); |
638 bool LoadContentScripts(string16* error); | 617 bool LoadContentScripts(string16* error); |
639 bool LoadBrowserAction(string16* error); | 618 bool LoadBrowserAction(string16* error); |
640 bool LoadSystemIndicator(string16* error); | 619 bool LoadSystemIndicator(string16* error); |
641 bool LoadTextToSpeechVoices(string16* error); | 620 bool LoadTextToSpeechVoices(string16* error); |
642 bool LoadIncognitoMode(string16* error); | 621 bool LoadIncognitoMode(string16* error); |
643 bool LoadManagedModeFeatures(string16* error); | 622 bool LoadManagedModeFeatures(string16* error); |
644 bool LoadManagedModeSites( | 623 bool LoadManagedModeSites( |
645 const base::DictionaryValue* content_pack_value, | 624 const base::DictionaryValue* content_pack_value, |
646 string16* error); | 625 string16* error); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 | 746 |
768 // Optional list of extension pages that are sandboxed (served from a unique | 747 // Optional list of extension pages that are sandboxed (served from a unique |
769 // origin with a different Content Security Policy). | 748 // origin with a different Content Security Policy). |
770 URLPatternSet sandboxed_pages_; | 749 URLPatternSet sandboxed_pages_; |
771 | 750 |
772 // Content Security Policy that should be used to enforce the sandbox used | 751 // Content Security Policy that should be used to enforce the sandbox used |
773 // by sandboxed pages (guaranteed to have the "sandbox" directive without the | 752 // by sandboxed pages (guaranteed to have the "sandbox" directive without the |
774 // "allow-same-origin" token). | 753 // "allow-same-origin" token). |
775 std::string sandboxed_pages_content_security_policy_; | 754 std::string sandboxed_pages_content_security_policy_; |
776 | 755 |
777 // Optional URL to a master page of which a single instance should be always | |
778 // loaded in the background. | |
779 GURL background_url_; | |
780 | |
781 // Optional list of scripts to use to generate a background page. If this is | |
782 // present, background_url_ will be empty and generated by GetBackgroundURL(). | |
783 std::vector<std::string> background_scripts_; | |
784 | |
785 // True if the background page should stay loaded forever; false if it should | |
786 // load on-demand (when it needs to handle an event). Defaults to true. | |
787 bool background_page_is_persistent_; | |
788 | |
789 // True if the background page can be scripted by pages of the app or | |
790 // extension, in which case all such pages must run in the same process. | |
791 // False if such pages are not permitted to script the background page, | |
792 // allowing them to run in different processes. | |
793 bool allow_background_js_access_; | |
794 | |
795 // The public key used to sign the contents of the crx package. | 756 // The public key used to sign the contents of the crx package. |
796 std::string public_key_; | 757 std::string public_key_; |
797 | 758 |
798 // A file containing a list of sites for Managed Mode. | 759 // A file containing a list of sites for Managed Mode. |
799 base::FilePath content_pack_site_list_; | 760 base::FilePath content_pack_site_list_; |
800 | 761 |
801 // The manifest from which this extension was created. | 762 // The manifest from which this extension was created. |
802 scoped_ptr<Manifest> manifest_; | 763 scoped_ptr<Manifest> manifest_; |
803 | 764 |
804 // Stored parsed manifest data. | 765 // Stored parsed manifest data. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 866 |
906 UpdatedExtensionPermissionsInfo( | 867 UpdatedExtensionPermissionsInfo( |
907 const Extension* extension, | 868 const Extension* extension, |
908 const PermissionSet* permissions, | 869 const PermissionSet* permissions, |
909 Reason reason); | 870 Reason reason); |
910 }; | 871 }; |
911 | 872 |
912 } // namespace extensions | 873 } // namespace extensions |
913 | 874 |
914 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 875 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
OLD | NEW |