| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 // Returns true if the extension should be displayed in the launcher. | 543 // Returns true if the extension should be displayed in the launcher. |
| 544 bool ShouldDisplayInLauncher() const; | 544 bool ShouldDisplayInLauncher() const; |
| 545 | 545 |
| 546 // Returns true if the extension should be displayed in the extension | 546 // Returns true if the extension should be displayed in the extension |
| 547 // settings page (i.e. chrome://extensions). | 547 // settings page (i.e. chrome://extensions). |
| 548 bool ShouldDisplayInExtensionSettings() const; | 548 bool ShouldDisplayInExtensionSettings() const; |
| 549 | 549 |
| 550 // Returns true if the extension has a content script declared at |url|. | 550 // Returns true if the extension has a content script declared at |url|. |
| 551 bool HasContentScriptAtURL(const GURL& url) const; | 551 bool HasContentScriptAtURL(const GURL& url) const; |
| 552 | 552 |
| 553 // Returns an ExtensionAction representing the script badge that should be | |
| 554 // shown for this extension in the location bar. | |
| 555 ExtensionAction* GetScriptBadge() const; | |
| 556 | |
| 557 // Gets the tab-specific host permissions of |tab_id|, or NULL if there | 553 // Gets the tab-specific host permissions of |tab_id|, or NULL if there |
| 558 // aren't any. | 554 // aren't any. |
| 559 // | 555 // |
| 560 // This is a weak pointer. Callers should create a copy before mutating any | 556 // This is a weak pointer. Callers should create a copy before mutating any |
| 561 // tab specific permissions. | 557 // tab specific permissions. |
| 562 const URLPatternSet* GetTabSpecificHostPermissions(int tab_id) const; | 558 const URLPatternSet* GetTabSpecificHostPermissions(int tab_id) const; |
| 563 | 559 |
| 564 // Sets the tab-specific host permissions of |tab_id| to |permissions|. | 560 // Sets the tab-specific host permissions of |tab_id| to |permissions|. |
| 565 void SetTabSpecificHostPermissions(int tab_id, | 561 void SetTabSpecificHostPermissions(int tab_id, |
| 566 const URLPatternSet& permissions) const; | 562 const URLPatternSet& permissions) const; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 581 // Base64-encoded version of the key used to sign this extension. | 577 // Base64-encoded version of the key used to sign this extension. |
| 582 // In pseudocode, returns | 578 // In pseudocode, returns |
| 583 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). | 579 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). |
| 584 const std::string& public_key() const { return public_key_; } | 580 const std::string& public_key() const { return public_key_; } |
| 585 const std::string& description() const { return description_; } | 581 const std::string& description() const { return description_; } |
| 586 int manifest_version() const { return manifest_version_; } | 582 int manifest_version() const { return manifest_version_; } |
| 587 bool converted_from_user_script() const { | 583 bool converted_from_user_script() const { |
| 588 return converted_from_user_script_; | 584 return converted_from_user_script_; |
| 589 } | 585 } |
| 590 const UserScriptList& content_scripts() const { return content_scripts_; } | 586 const UserScriptList& content_scripts() const { return content_scripts_; } |
| 587 ExtensionAction* script_badge() const { return script_badge_.get(); } |
| 591 ExtensionAction* page_action() const { return page_action_.get(); } | 588 ExtensionAction* page_action() const { return page_action_.get(); } |
| 592 ExtensionAction* browser_action() const { return browser_action_.get(); } | 589 ExtensionAction* browser_action() const { return browser_action_.get(); } |
| 593 ExtensionAction::Type declared_action_type() const { | 590 ExtensionAction::Type declared_action_type() const { |
| 594 return declared_action_type_; | 591 return declared_action_type_; |
| 595 } | 592 } |
| 596 const FileBrowserHandlerList* file_browser_handlers() const { | 593 const FileBrowserHandlerList* file_browser_handlers() const { |
| 597 return file_browser_handlers_.get(); | 594 return file_browser_handlers_.get(); |
| 598 } | 595 } |
| 599 const std::vector<PluginInfo>& plugins() const { return plugins_; } | 596 const std::vector<PluginInfo>& plugins() const { return plugins_; } |
| 600 const std::vector<NaClModuleInfo>& nacl_modules() const { | 597 const std::vector<NaClModuleInfo>& nacl_modules() const { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 string16* error); | 812 string16* error); |
| 816 bool LoadWebIntentServices(string16* error); | 813 bool LoadWebIntentServices(string16* error); |
| 817 bool LoadExtensionFeatures(const ExtensionAPIPermissionSet& api_permissions, | 814 bool LoadExtensionFeatures(const ExtensionAPIPermissionSet& api_permissions, |
| 818 string16* error); | 815 string16* error); |
| 819 bool LoadDevToolsPage(string16* error); | 816 bool LoadDevToolsPage(string16* error); |
| 820 bool LoadInputComponents(const ExtensionAPIPermissionSet& api_permissions, | 817 bool LoadInputComponents(const ExtensionAPIPermissionSet& api_permissions, |
| 821 string16* error); | 818 string16* error); |
| 822 bool LoadContentScripts(string16* error); | 819 bool LoadContentScripts(string16* error); |
| 823 bool LoadPageAction(string16* error); | 820 bool LoadPageAction(string16* error); |
| 824 bool LoadBrowserAction(string16* error); | 821 bool LoadBrowserAction(string16* error); |
| 822 bool LoadScriptBadge(string16* error); |
| 825 bool LoadFileBrowserHandlers(string16* error); | 823 bool LoadFileBrowserHandlers(string16* error); |
| 826 // Helper method to load a FileBrowserHandlerList from the manifest. | 824 // Helper method to load a FileBrowserHandlerList from the manifest. |
| 827 FileBrowserHandlerList* LoadFileBrowserHandlersHelper( | 825 FileBrowserHandlerList* LoadFileBrowserHandlersHelper( |
| 828 const base::ListValue* extension_actions, string16* error); | 826 const base::ListValue* extension_actions, string16* error); |
| 829 // Helper method to load an FileBrowserHandler from manifest. | 827 // Helper method to load an FileBrowserHandler from manifest. |
| 830 FileBrowserHandler* LoadFileBrowserHandler( | 828 FileBrowserHandler* LoadFileBrowserHandler( |
| 831 const base::DictionaryValue* file_browser_handlers, string16* error); | 829 const base::DictionaryValue* file_browser_handlers, string16* error); |
| 832 bool LoadChromeURLOverrides(string16* error); | 830 bool LoadChromeURLOverrides(string16* error); |
| 833 bool LoadOmnibox(string16* error); | 831 bool LoadOmnibox(string16* error); |
| 834 bool LoadTextToSpeechVoices(string16* error); | 832 bool LoadTextToSpeechVoices(string16* error); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 863 bool LoadGlobsHelper(const base::DictionaryValue* content_script, | 861 bool LoadGlobsHelper(const base::DictionaryValue* content_script, |
| 864 int content_script_index, | 862 int content_script_index, |
| 865 const char* globs_property_name, | 863 const char* globs_property_name, |
| 866 string16* error, | 864 string16* error, |
| 867 void(UserScript::*add_method)(const std::string& glob), | 865 void(UserScript::*add_method)(const std::string& glob), |
| 868 UserScript *instance); | 866 UserScript *instance); |
| 869 | 867 |
| 870 // Helper method to load an ExtensionAction from the page_action or | 868 // Helper method to load an ExtensionAction from the page_action or |
| 871 // browser_action entries in the manifest. | 869 // browser_action entries in the manifest. |
| 872 scoped_ptr<ExtensionAction> LoadExtensionActionHelper( | 870 scoped_ptr<ExtensionAction> LoadExtensionActionHelper( |
| 873 const base::DictionaryValue* extension_action, string16* error); | 871 const base::DictionaryValue* extension_action, |
| 872 ExtensionAction::Type action_type, |
| 873 string16* error); |
| 874 | 874 |
| 875 // Helper method that loads the OAuth2 info from the 'oauth2' manifest key. | 875 // Helper method that loads the OAuth2 info from the 'oauth2' manifest key. |
| 876 bool LoadOAuth2Info(string16* error); | 876 bool LoadOAuth2Info(string16* error); |
| 877 | 877 |
| 878 // Returns true if the extension has more than one "UI surface". For example, | 878 // Returns true if the extension has more than one "UI surface". For example, |
| 879 // an extension that has a browser action and a page action. | 879 // an extension that has a browser action and a page action. |
| 880 bool HasMultipleUISurfaces() const; | 880 bool HasMultipleUISurfaces() const; |
| 881 | 881 |
| 882 // Updates the launch URL and extents for the extension using the given | 882 // Updates the launch URL and extents for the extension using the given |
| 883 // |override_url|. | 883 // |override_url|. |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 | 1180 |
| 1181 UpdatedExtensionPermissionsInfo( | 1181 UpdatedExtensionPermissionsInfo( |
| 1182 const Extension* extension, | 1182 const Extension* extension, |
| 1183 const ExtensionPermissionSet* permissions, | 1183 const ExtensionPermissionSet* permissions, |
| 1184 Reason reason); | 1184 Reason reason); |
| 1185 }; | 1185 }; |
| 1186 | 1186 |
| 1187 } // namespace extensions | 1187 } // namespace extensions |
| 1188 | 1188 |
| 1189 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1189 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |