| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // Returns true if the extension should be displayed in the app launcher. | 379 // Returns true if the extension should be displayed in the app launcher. |
| 380 bool ShouldDisplayInAppLauncher() const; | 380 bool ShouldDisplayInAppLauncher() const; |
| 381 | 381 |
| 382 // Returns true if the extension should be displayed in the browser NTP. | 382 // Returns true if the extension should be displayed in the browser NTP. |
| 383 bool ShouldDisplayInNewTabPage() const; | 383 bool ShouldDisplayInNewTabPage() const; |
| 384 | 384 |
| 385 // Returns true if the extension should be displayed in the extension | 385 // Returns true if the extension should be displayed in the extension |
| 386 // settings page (i.e. chrome://extensions). | 386 // settings page (i.e. chrome://extensions). |
| 387 bool ShouldDisplayInExtensionSettings() const; | 387 bool ShouldDisplayInExtensionSettings() const; |
| 388 | 388 |
| 389 // Returns true if the extension has a content script declared at |url|. | |
| 390 bool HasContentScriptAtURL(const GURL& url) const; | |
| 391 | |
| 392 // Gets the tab-specific host permissions of |tab_id|, or NULL if there | 389 // Gets the tab-specific host permissions of |tab_id|, or NULL if there |
| 393 // aren't any. | 390 // aren't any. |
| 394 scoped_refptr<const PermissionSet> GetTabSpecificPermissions(int tab_id) | 391 scoped_refptr<const PermissionSet> GetTabSpecificPermissions(int tab_id) |
| 395 const; | 392 const; |
| 396 | 393 |
| 397 // Updates the tab-specific permissions of |tab_id| to include those from | 394 // Updates the tab-specific permissions of |tab_id| to include those from |
| 398 // |permissions|. | 395 // |permissions|. |
| 399 void UpdateTabSpecificPermissions( | 396 void UpdateTabSpecificPermissions( |
| 400 int tab_id, | 397 int tab_id, |
| 401 scoped_refptr<const PermissionSet> permissions) const; | 398 scoped_refptr<const PermissionSet> permissions) const; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 425 const std::string& non_localized_name() const { return non_localized_name_; } | 422 const std::string& non_localized_name() const { return non_localized_name_; } |
| 426 // Base64-encoded version of the key used to sign this extension. | 423 // Base64-encoded version of the key used to sign this extension. |
| 427 // In pseudocode, returns | 424 // In pseudocode, returns |
| 428 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). | 425 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). |
| 429 const std::string& public_key() const { return public_key_; } | 426 const std::string& public_key() const { return public_key_; } |
| 430 const std::string& description() const { return description_; } | 427 const std::string& description() const { return description_; } |
| 431 int manifest_version() const { return manifest_version_; } | 428 int manifest_version() const { return manifest_version_; } |
| 432 bool converted_from_user_script() const { | 429 bool converted_from_user_script() const { |
| 433 return converted_from_user_script_; | 430 return converted_from_user_script_; |
| 434 } | 431 } |
| 435 const UserScriptList& content_scripts() const { return content_scripts_; } | |
| 436 const ActionInfo* system_indicator_info() const { | 432 const ActionInfo* system_indicator_info() const { |
| 437 return system_indicator_info_.get(); | 433 return system_indicator_info_.get(); |
| 438 } | 434 } |
| 439 const std::vector<NaClModuleInfo>& nacl_modules() const { | 435 const std::vector<NaClModuleInfo>& nacl_modules() const { |
| 440 return nacl_modules_; | 436 return nacl_modules_; |
| 441 } | 437 } |
| 442 const PermissionSet* optional_permission_set() const { | 438 const PermissionSet* optional_permission_set() const { |
| 443 return optional_permission_set_.get(); | 439 return optional_permission_set_.get(); |
| 444 } | 440 } |
| 445 const PermissionSet* required_permission_set() const { | 441 const PermissionSet* required_permission_set() const { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 459 const std::vector<InstallWarning>& install_warnings() const { | 455 const std::vector<InstallWarning>& install_warnings() const { |
| 460 return install_warnings_; | 456 return install_warnings_; |
| 461 } | 457 } |
| 462 const extensions::Manifest* manifest() const { | 458 const extensions::Manifest* manifest() const { |
| 463 return manifest_.get(); | 459 return manifest_.get(); |
| 464 } | 460 } |
| 465 bool incognito_split_mode() const { return incognito_split_mode_; } | 461 bool incognito_split_mode() const { return incognito_split_mode_; } |
| 466 bool kiosk_enabled() const { return kiosk_enabled_; } | 462 bool kiosk_enabled() const { return kiosk_enabled_; } |
| 467 bool offline_enabled() const { return offline_enabled_; } | 463 bool offline_enabled() const { return offline_enabled_; } |
| 468 bool wants_file_access() const { return wants_file_access_; } | 464 bool wants_file_access() const { return wants_file_access_; } |
| 465 // TODO(rdevlin.cronin): This is needed for ContentScriptsHandler, and should |
| 466 // be moved out as part of crbug.com/159265. This should not be used anywhere |
| 467 // else. |
| 468 void set_wants_file_access(bool wants_file_access) { |
| 469 wants_file_access_ = wants_file_access; |
| 470 } |
| 469 int creation_flags() const { return creation_flags_; } | 471 int creation_flags() const { return creation_flags_; } |
| 470 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } | 472 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } |
| 471 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } | 473 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } |
| 472 bool was_installed_by_default() const { | 474 bool was_installed_by_default() const { |
| 473 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; | 475 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; |
| 474 } | 476 } |
| 475 | 477 |
| 476 // App-related. | 478 // App-related. |
| 477 bool is_app() const; | 479 bool is_app() const; |
| 478 bool is_platform_app() const; | 480 bool is_platform_app() const; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 bool LoadSharedFeatures(string16* error); | 573 bool LoadSharedFeatures(string16* error); |
| 572 bool LoadDescription(string16* error); | 574 bool LoadDescription(string16* error); |
| 573 bool LoadManifestVersion(string16* error); | 575 bool LoadManifestVersion(string16* error); |
| 574 bool LoadNaClModules(string16* error); | 576 bool LoadNaClModules(string16* error); |
| 575 bool LoadSandboxedPages(string16* error); | 577 bool LoadSandboxedPages(string16* error); |
| 576 // Must be called after the "plugins" key has been parsed. | 578 // Must be called after the "plugins" key has been parsed. |
| 577 bool LoadRequirements(string16* error); | 579 bool LoadRequirements(string16* error); |
| 578 bool LoadKioskEnabled(string16* error); | 580 bool LoadKioskEnabled(string16* error); |
| 579 bool LoadOfflineEnabled(string16* error); | 581 bool LoadOfflineEnabled(string16* error); |
| 580 bool LoadExtensionFeatures(string16* error); | 582 bool LoadExtensionFeatures(string16* error); |
| 581 bool LoadContentScripts(string16* error); | |
| 582 bool LoadBrowserAction(string16* error); | 583 bool LoadBrowserAction(string16* error); |
| 583 bool LoadSystemIndicator(string16* error); | 584 bool LoadSystemIndicator(string16* error); |
| 584 bool LoadTextToSpeechVoices(string16* error); | 585 bool LoadTextToSpeechVoices(string16* error); |
| 585 bool LoadIncognitoMode(string16* error); | 586 bool LoadIncognitoMode(string16* error); |
| 586 bool LoadManagedModeFeatures(string16* error); | 587 bool LoadManagedModeFeatures(string16* error); |
| 587 bool LoadManagedModeSites( | 588 bool LoadManagedModeSites( |
| 588 const base::DictionaryValue* content_pack_value, | 589 const base::DictionaryValue* content_pack_value, |
| 589 string16* error); | 590 string16* error); |
| 590 bool LoadManagedModeConfigurations( | 591 bool LoadManagedModeConfigurations( |
| 591 const base::DictionaryValue* content_pack_value, | 592 const base::DictionaryValue* content_pack_value, |
| 592 string16* error); | 593 string16* error); |
| 593 | 594 |
| 594 // Helper method that loads a UserScript object from a | |
| 595 // dictionary in the content_script list of the manifest. | |
| 596 bool LoadUserScriptHelper(const base::DictionaryValue* content_script, | |
| 597 int definition_index, | |
| 598 string16* error, | |
| 599 UserScript* result); | |
| 600 | |
| 601 // Helper method that loads either the include_globs or exclude_globs list | |
| 602 // from an entry in the content_script lists of the manifest. | |
| 603 bool LoadGlobsHelper(const base::DictionaryValue* content_script, | |
| 604 int content_script_index, | |
| 605 const char* globs_property_name, | |
| 606 string16* error, | |
| 607 void(UserScript::*add_method)(const std::string& glob), | |
| 608 UserScript* instance); | |
| 609 | |
| 610 // Returns true if the extension has more than one "UI surface". For example, | 595 // Returns true if the extension has more than one "UI surface". For example, |
| 611 // an extension that has a browser action and a page action. | 596 // an extension that has a browser action and a page action. |
| 612 bool HasMultipleUISurfaces() const; | 597 bool HasMultipleUISurfaces() const; |
| 613 | 598 |
| 614 // Updates the launch URL and extents for the extension using the given | 599 // Updates the launch URL and extents for the extension using the given |
| 615 // |override_url|. | 600 // |override_url|. |
| 616 void OverrideLaunchUrl(const GURL& override_url); | 601 void OverrideLaunchUrl(const GURL& override_url); |
| 617 | 602 |
| 618 // Custom checks for the experimental permission that can't be expressed in | 603 // Custom checks for the experimental permission that can't be expressed in |
| 619 // _permission_features.json. | 604 // _permission_features.json. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 // The extension's version. | 677 // The extension's version. |
| 693 scoped_ptr<Version> version_; | 678 scoped_ptr<Version> version_; |
| 694 | 679 |
| 695 // An optional longer description of the extension. | 680 // An optional longer description of the extension. |
| 696 std::string description_; | 681 std::string description_; |
| 697 | 682 |
| 698 // True if the extension was generated from a user script. (We show slightly | 683 // True if the extension was generated from a user script. (We show slightly |
| 699 // different UI if so). | 684 // different UI if so). |
| 700 bool converted_from_user_script_; | 685 bool converted_from_user_script_; |
| 701 | 686 |
| 702 // Paths to the content scripts the extension contains. | |
| 703 UserScriptList content_scripts_; | |
| 704 | |
| 705 // The extension's system indicator, if any. | 687 // The extension's system indicator, if any. |
| 706 scoped_ptr<ActionInfo> system_indicator_info_; | 688 scoped_ptr<ActionInfo> system_indicator_info_; |
| 707 | 689 |
| 708 // Optional list of NaCl modules and associated properties. | 690 // Optional list of NaCl modules and associated properties. |
| 709 std::vector<NaClModuleInfo> nacl_modules_; | 691 std::vector<NaClModuleInfo> nacl_modules_; |
| 710 | 692 |
| 711 // Optional list of extension pages that are sandboxed (served from a unique | 693 // Optional list of extension pages that are sandboxed (served from a unique |
| 712 // origin with a different Content Security Policy). | 694 // origin with a different Content Security Policy). |
| 713 URLPatternSet sandboxed_pages_; | 695 URLPatternSet sandboxed_pages_; |
| 714 | 696 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 | 812 |
| 831 UpdatedExtensionPermissionsInfo( | 813 UpdatedExtensionPermissionsInfo( |
| 832 const Extension* extension, | 814 const Extension* extension, |
| 833 const PermissionSet* permissions, | 815 const PermissionSet* permissions, |
| 834 Reason reason); | 816 Reason reason); |
| 835 }; | 817 }; |
| 836 | 818 |
| 837 } // namespace extensions | 819 } // namespace extensions |
| 838 | 820 |
| 839 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 821 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |