| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // Gets the extension's active permission set. | 348 // Gets the extension's active permission set. |
| 349 scoped_refptr<const PermissionSet> GetActivePermissions() const; | 349 scoped_refptr<const PermissionSet> GetActivePermissions() const; |
| 350 | 350 |
| 351 // Whether context menu should be shown for page and browser actions. | 351 // Whether context menu should be shown for page and browser actions. |
| 352 bool ShowConfigureContextMenus() const; | 352 bool ShowConfigureContextMenus() const; |
| 353 | 353 |
| 354 // Returns a list of paths (relative to the extension dir) for images that | 354 // Returns a list of paths (relative to the extension dir) for images that |
| 355 // the browser might load (like themes and page action icons). | 355 // the browser might load (like themes and page action icons). |
| 356 std::set<base::FilePath> GetBrowserImages() const; | 356 std::set<base::FilePath> GetBrowserImages() const; |
| 357 | 357 |
| 358 // Gets the fully resolved absolute launch URL. | |
| 359 GURL GetFullLaunchURL() const; | |
| 360 | |
| 361 // Returns true if this extension can execute script on a page. If a | 358 // Returns true if this extension can execute script on a page. If a |
| 362 // UserScript object is passed, permission to run that specific script is | 359 // UserScript object is passed, permission to run that specific script is |
| 363 // checked (using its matches list). Otherwise, permission to execute script | 360 // checked (using its matches list). Otherwise, permission to execute script |
| 364 // programmatically is checked (using the extension's host permission). | 361 // programmatically is checked (using the extension's host permission). |
| 365 // | 362 // |
| 366 // This method is also aware of certain special pages that extensions are | 363 // This method is also aware of certain special pages that extensions are |
| 367 // usually not allowed to run script on. | 364 // usually not allowed to run script on. |
| 368 bool CanExecuteScriptOnPage(const GURL& document_url, | 365 bool CanExecuteScriptOnPage(const GURL& document_url, |
| 369 const GURL& top_document_url, | 366 const GURL& top_document_url, |
| 370 int tab_id, | 367 int tab_id, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 495 } |
| 499 | 496 |
| 500 // App-related. | 497 // App-related. |
| 501 bool is_app() const; | 498 bool is_app() const; |
| 502 bool is_platform_app() const; | 499 bool is_platform_app() const; |
| 503 bool is_hosted_app() const; | 500 bool is_hosted_app() const; |
| 504 bool is_legacy_packaged_app() const; | 501 bool is_legacy_packaged_app() const; |
| 505 bool is_extension() const; | 502 bool is_extension() const; |
| 506 bool is_storage_isolated() const { return is_storage_isolated_; } | 503 bool is_storage_isolated() const { return is_storage_isolated_; } |
| 507 bool can_be_incognito_enabled() const; | 504 bool can_be_incognito_enabled() const; |
| 505 |
| 506 // TODO(mhx348@motorola.com): Move the below extent related functions to its |
| 507 // ManifestData. |
| 508 void AddWebExtentPattern(const URLPattern& pattern); | 508 void AddWebExtentPattern(const URLPattern& pattern); |
| 509 void ClearWebExtentPatterns(); |
| 509 const URLPatternSet& web_extent() const { return extent_; } | 510 const URLPatternSet& web_extent() const { return extent_; } |
| 510 const std::string& launch_local_path() const { return launch_local_path_; } | |
| 511 const std::string& launch_web_url() const { return launch_web_url_; } | |
| 512 extension_misc::LaunchContainer launch_container() const { | |
| 513 return launch_container_; | |
| 514 } | |
| 515 int launch_width() const { return launch_width_; } | |
| 516 int launch_height() const { return launch_height_; } | |
| 517 | 511 |
| 518 // Theme-related. | 512 // Theme-related. |
| 519 bool is_theme() const; | 513 bool is_theme() const; |
| 520 | 514 |
| 521 // Content pack related. | 515 // Content pack related. |
| 522 bool is_content_pack() const; | 516 bool is_content_pack() const; |
| 523 ExtensionResource GetContentPackSiteList() const; | 517 ExtensionResource GetContentPackSiteList() const; |
| 524 | 518 |
| 525 private: | 519 private: |
| 526 friend class base::RefCountedThreadSafe<Extension>; | 520 friend class base::RefCountedThreadSafe<Extension>; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 bool LoadRequiredFeatures(string16* error); | 580 bool LoadRequiredFeatures(string16* error); |
| 587 bool LoadName(string16* error); | 581 bool LoadName(string16* error); |
| 588 bool LoadVersion(string16* error); | 582 bool LoadVersion(string16* error); |
| 589 | 583 |
| 590 bool LoadAppFeatures(string16* error); | 584 bool LoadAppFeatures(string16* error); |
| 591 bool LoadExtent(const char* key, | 585 bool LoadExtent(const char* key, |
| 592 URLPatternSet* extent, | 586 URLPatternSet* extent, |
| 593 const char* list_error, | 587 const char* list_error, |
| 594 const char* value_error, | 588 const char* value_error, |
| 595 string16* error); | 589 string16* error); |
| 596 bool LoadLaunchContainer(string16* error); | |
| 597 bool LoadLaunchURL(string16* error); | |
| 598 | 590 |
| 599 bool LoadSharedFeatures(string16* error); | 591 bool LoadSharedFeatures(string16* error); |
| 600 bool LoadDescription(string16* error); | 592 bool LoadDescription(string16* error); |
| 601 bool LoadManifestVersion(string16* error); | 593 bool LoadManifestVersion(string16* error); |
| 602 bool LoadNaClModules(string16* error); | 594 bool LoadNaClModules(string16* error); |
| 603 bool LoadSandboxedPages(string16* error); | 595 bool LoadSandboxedPages(string16* error); |
| 604 // Must be called after the "plugins" key has been parsed. | 596 // Must be called after the "plugins" key has been parsed. |
| 605 bool LoadRequirements(string16* error); | 597 bool LoadRequirements(string16* error); |
| 606 bool LoadKioskEnabled(string16* error); | 598 bool LoadKioskEnabled(string16* error); |
| 607 bool LoadOfflineEnabled(string16* error); | 599 bool LoadOfflineEnabled(string16* error); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 632 int content_script_index, | 624 int content_script_index, |
| 633 const char* globs_property_name, | 625 const char* globs_property_name, |
| 634 string16* error, | 626 string16* error, |
| 635 void(UserScript::*add_method)(const std::string& glob), | 627 void(UserScript::*add_method)(const std::string& glob), |
| 636 UserScript* instance); | 628 UserScript* instance); |
| 637 | 629 |
| 638 // Returns true if the extension has more than one "UI surface". For example, | 630 // Returns true if the extension has more than one "UI surface". For example, |
| 639 // an extension that has a browser action and a page action. | 631 // an extension that has a browser action and a page action. |
| 640 bool HasMultipleUISurfaces() const; | 632 bool HasMultipleUISurfaces() const; |
| 641 | 633 |
| 642 // Updates the launch URL and extents for the extension using the given | |
| 643 // |override_url|. | |
| 644 void OverrideLaunchUrl(const GURL& override_url); | |
| 645 | |
| 646 // Custom checks for the experimental permission that can't be expressed in | 634 // Custom checks for the experimental permission that can't be expressed in |
| 647 // _permission_features.json. | 635 // _permission_features.json. |
| 648 bool CanSpecifyExperimentalPermission() const; | 636 bool CanSpecifyExperimentalPermission() const; |
| 649 | 637 |
| 650 // Checks whether the host |pattern| is allowed for this extension, given API | 638 // Checks whether the host |pattern| is allowed for this extension, given API |
| 651 // permissions |permissions|. | 639 // permissions |permissions|. |
| 652 bool CanSpecifyHostPermission(const URLPattern& pattern, | 640 bool CanSpecifyHostPermission(const URLPattern& pattern, |
| 653 const APIPermissionSet& permissions) const; | 641 const APIPermissionSet& permissions) const; |
| 654 | 642 |
| 655 bool CheckMinimumChromeVersion(string16* error) const; | 643 bool CheckMinimumChromeVersion(string16* error) const; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 bool finished_parsing_manifest_; | 749 bool finished_parsing_manifest_; |
| 762 | 750 |
| 763 // Ensures that any call to GetManifestData() prior to finishing | 751 // Ensures that any call to GetManifestData() prior to finishing |
| 764 // initialization happens from the same thread (this can happen when certain | 752 // initialization happens from the same thread (this can happen when certain |
| 765 // parts of the initialization process need information from previous parts). | 753 // parts of the initialization process need information from previous parts). |
| 766 base::ThreadChecker thread_checker_; | 754 base::ThreadChecker thread_checker_; |
| 767 | 755 |
| 768 // Whether this extension requests isolated storage. | 756 // Whether this extension requests isolated storage. |
| 769 bool is_storage_isolated_; | 757 bool is_storage_isolated_; |
| 770 | 758 |
| 771 // The local path inside the extension to use with the launcher. | |
| 772 std::string launch_local_path_; | |
| 773 | |
| 774 // A web url to use with the launcher. Note that this might be relative or | |
| 775 // absolute. If relative, it is relative to web_origin. | |
| 776 std::string launch_web_url_; | |
| 777 | |
| 778 // The window type that an app's manifest specifies to launch into. | |
| 779 // This is not always the window type an app will open into, because | |
| 780 // users can override the way each app launches. See | |
| 781 // ExtensionPrefs::GetLaunchContainer(), which looks at a per-app pref | |
| 782 // to decide what container an app will launch in. | |
| 783 extension_misc::LaunchContainer launch_container_; | |
| 784 | |
| 785 // The default size of the container when launching. Only respected for | |
| 786 // containers like panels and windows. | |
| 787 int launch_width_; | |
| 788 int launch_height_; | |
| 789 | |
| 790 // Should this app be shown in the app launcher. | 759 // Should this app be shown in the app launcher. |
| 791 bool display_in_launcher_; | 760 bool display_in_launcher_; |
| 792 | 761 |
| 793 // Should this app be shown in the browser New Tab Page. | 762 // Should this app be shown in the browser New Tab Page. |
| 794 bool display_in_new_tab_page_; | 763 bool display_in_new_tab_page_; |
| 795 | 764 |
| 796 // Whether the extension has host permissions or user script patterns that | 765 // Whether the extension has host permissions or user script patterns that |
| 797 // imply access to file:/// scheme URLs (the user may not have actually | 766 // imply access to file:/// scheme URLs (the user may not have actually |
| 798 // granted it that access). | 767 // granted it that access). |
| 799 bool wants_file_access_; | 768 bool wants_file_access_; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 | 827 |
| 859 UpdatedExtensionPermissionsInfo( | 828 UpdatedExtensionPermissionsInfo( |
| 860 const Extension* extension, | 829 const Extension* extension, |
| 861 const PermissionSet* permissions, | 830 const PermissionSet* permissions, |
| 862 Reason reason); | 831 Reason reason); |
| 863 }; | 832 }; |
| 864 | 833 |
| 865 } // namespace extensions | 834 } // namespace extensions |
| 866 | 835 |
| 867 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 836 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |