Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: chrome/common/extensions/extension.h

Issue 11724002: Move ContentScripts out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <iosfwd> 9 #include <iosfwd>
10 #include <map> 10 #include <map>
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // Returns true if the extension should be displayed in the app launcher. 614 // Returns true if the extension should be displayed in the app launcher.
615 bool ShouldDisplayInAppLauncher() const; 615 bool ShouldDisplayInAppLauncher() const;
616 616
617 // Returns true if the extension should be displayed in the browser NTP. 617 // Returns true if the extension should be displayed in the browser NTP.
618 bool ShouldDisplayInNewTabPage() const; 618 bool ShouldDisplayInNewTabPage() const;
619 619
620 // Returns true if the extension should be displayed in the extension 620 // Returns true if the extension should be displayed in the extension
621 // settings page (i.e. chrome://extensions). 621 // settings page (i.e. chrome://extensions).
622 bool ShouldDisplayInExtensionSettings() const; 622 bool ShouldDisplayInExtensionSettings() const;
623 623
624 // Returns true if the extension has a content script declared at |url|.
625 bool HasContentScriptAtURL(const GURL& url) const;
626
627 // Gets the tab-specific host permissions of |tab_id|, or NULL if there 624 // Gets the tab-specific host permissions of |tab_id|, or NULL if there
628 // aren't any. 625 // aren't any.
629 scoped_refptr<const PermissionSet> GetTabSpecificPermissions(int tab_id) 626 scoped_refptr<const PermissionSet> GetTabSpecificPermissions(int tab_id)
630 const; 627 const;
631 628
632 // Updates the tab-specific permissions of |tab_id| to include those from 629 // Updates the tab-specific permissions of |tab_id| to include those from
633 // |permissions|. 630 // |permissions|.
634 void UpdateTabSpecificPermissions( 631 void UpdateTabSpecificPermissions(
635 int tab_id, 632 int tab_id,
636 scoped_refptr<const PermissionSet> permissions) const; 633 scoped_refptr<const PermissionSet> permissions) const;
(...skipping 23 matching lines...) Expand all
660 const std::string& non_localized_name() const { return non_localized_name_; } 657 const std::string& non_localized_name() const { return non_localized_name_; }
661 // Base64-encoded version of the key used to sign this extension. 658 // Base64-encoded version of the key used to sign this extension.
662 // In pseudocode, returns 659 // In pseudocode, returns
663 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). 660 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()).
664 const std::string& public_key() const { return public_key_; } 661 const std::string& public_key() const { return public_key_; }
665 const std::string& description() const { return description_; } 662 const std::string& description() const { return description_; }
666 int manifest_version() const { return manifest_version_; } 663 int manifest_version() const { return manifest_version_; }
667 bool converted_from_user_script() const { 664 bool converted_from_user_script() const {
668 return converted_from_user_script_; 665 return converted_from_user_script_;
669 } 666 }
670 const UserScriptList& content_scripts() const { return content_scripts_; }
671 const ActionInfo* page_action_info() const { return page_action_info_.get(); } 667 const ActionInfo* page_action_info() const { return page_action_info_.get(); }
672 const ActionInfo* system_indicator_info() const { 668 const ActionInfo* system_indicator_info() const {
673 return system_indicator_info_.get(); 669 return system_indicator_info_.get();
674 } 670 }
675 const std::vector<PluginInfo>& plugins() const { return plugins_; } 671 const std::vector<PluginInfo>& plugins() const { return plugins_; }
676 const std::vector<NaClModuleInfo>& nacl_modules() const { 672 const std::vector<NaClModuleInfo>& nacl_modules() const {
677 return nacl_modules_; 673 return nacl_modules_;
678 } 674 }
679 const std::vector<InputComponentInfo>& input_components() const { 675 const std::vector<InputComponentInfo>& input_components() const {
680 return input_components_; 676 return input_components_;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 bool incognito_split_mode() const { return incognito_split_mode_; } 741 bool incognito_split_mode() const { return incognito_split_mode_; }
746 bool offline_enabled() const { return offline_enabled_; } 742 bool offline_enabled() const { return offline_enabled_; }
747 const std::vector<TtsVoice>& tts_voices() const { return tts_voices_; } 743 const std::vector<TtsVoice>& tts_voices() const { return tts_voices_; }
748 const OAuth2Info& oauth2_info() const { return oauth2_info_; } 744 const OAuth2Info& oauth2_info() const { return oauth2_info_; }
749 const std::vector<webkit_glue::WebIntentServiceData>& 745 const std::vector<webkit_glue::WebIntentServiceData>&
750 intents_services() const { 746 intents_services() const {
751 return intents_services_; 747 return intents_services_;
752 } 748 }
753 749
754 bool wants_file_access() const { return wants_file_access_; } 750 bool wants_file_access() const { return wants_file_access_; }
751 void set_wants_file_access(bool wants_file_access) {
752 wants_file_access_ = wants_file_access;
753 }
755 int creation_flags() const { return creation_flags_; } 754 int creation_flags() const { return creation_flags_; }
756 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } 755 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; }
757 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } 756 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; }
758 bool was_installed_by_default() const { 757 bool was_installed_by_default() const {
759 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; 758 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0;
760 } 759 }
761 760
762 // App-related. 761 // App-related.
763 bool is_app() const { 762 bool is_app() const {
764 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app(); 763 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 bool LoadFileHandler(const std::string& handler_id, 915 bool LoadFileHandler(const std::string& handler_id,
917 const base::DictionaryValue& handler_info, 916 const base::DictionaryValue& handler_info,
918 string16* error); 917 string16* error);
919 bool LoadFileHandlers(string16* error); 918 bool LoadFileHandlers(string16* error);
920 bool LoadExtensionFeatures(APIPermissionSet* api_permissions, 919 bool LoadExtensionFeatures(APIPermissionSet* api_permissions,
921 string16* error); 920 string16* error);
922 bool LoadManifestHandlerFeatures(string16* error); 921 bool LoadManifestHandlerFeatures(string16* error);
923 bool LoadDevToolsPage(string16* error); 922 bool LoadDevToolsPage(string16* error);
924 bool LoadInputComponents(const APIPermissionSet& api_permissions, 923 bool LoadInputComponents(const APIPermissionSet& api_permissions,
925 string16* error); 924 string16* error);
926 bool LoadContentScripts(string16* error);
927 bool LoadPageAction(string16* error); 925 bool LoadPageAction(string16* error);
928 bool LoadBrowserAction(string16* error); 926 bool LoadBrowserAction(string16* error);
929 bool LoadSystemIndicator(APIPermissionSet* api_permissions, string16* error); 927 bool LoadSystemIndicator(APIPermissionSet* api_permissions, string16* error);
930 bool LoadChromeURLOverrides(string16* error); 928 bool LoadChromeURLOverrides(string16* error);
931 bool LoadTextToSpeechVoices(string16* error); 929 bool LoadTextToSpeechVoices(string16* error);
932 bool LoadIncognitoMode(string16* error); 930 bool LoadIncognitoMode(string16* error);
933 bool LoadContentSecurityPolicy(string16* error); 931 bool LoadContentSecurityPolicy(string16* error);
934 932
935 bool LoadThemeFeatures(string16* error); 933 bool LoadThemeFeatures(string16* error);
936 bool LoadThemeImages(const base::DictionaryValue* theme_value, 934 bool LoadThemeImages(const base::DictionaryValue* theme_value,
937 string16* error); 935 string16* error);
938 bool LoadThemeColors(const base::DictionaryValue* theme_value, 936 bool LoadThemeColors(const base::DictionaryValue* theme_value,
939 string16* error); 937 string16* error);
940 bool LoadThemeTints(const base::DictionaryValue* theme_value, 938 bool LoadThemeTints(const base::DictionaryValue* theme_value,
941 string16* error); 939 string16* error);
942 bool LoadThemeDisplayProperties(const base::DictionaryValue* theme_value, 940 bool LoadThemeDisplayProperties(const base::DictionaryValue* theme_value,
943 string16* error); 941 string16* error);
944 942
945 // Helper function for implementing HasCachedImage/GetCachedImage. A return 943 // Helper function for implementing HasCachedImage/GetCachedImage. A return
946 // value of NULL means there is no matching image cached (we allow caching an 944 // value of NULL means there is no matching image cached (we allow caching an
947 // empty SkBitmap). 945 // empty SkBitmap).
948 SkBitmap* GetCachedImageImpl(const ExtensionResource& source, 946 SkBitmap* GetCachedImageImpl(const ExtensionResource& source,
949 const gfx::Size& max_size) const; 947 const gfx::Size& max_size) const;
950 948
951 // Helper method that loads a UserScript object from a
952 // dictionary in the content_script list of the manifest.
953 bool LoadUserScriptHelper(const base::DictionaryValue* content_script,
954 int definition_index,
955 string16* error,
956 UserScript* result);
957
958 // Helper method that loads either the include_globs or exclude_globs list
959 // from an entry in the content_script lists of the manifest.
960 bool LoadGlobsHelper(const base::DictionaryValue* content_script,
961 int content_script_index,
962 const char* globs_property_name,
963 string16* error,
964 void(UserScript::*add_method)(const std::string& glob),
965 UserScript* instance);
966
967 // Helper method that loads the OAuth2 info from the 'oauth2' manifest key. 949 // Helper method that loads the OAuth2 info from the 'oauth2' manifest key.
968 bool LoadOAuth2Info(string16* error); 950 bool LoadOAuth2Info(string16* error);
969 951
970 // Returns true if the extension has more than one "UI surface". For example, 952 // Returns true if the extension has more than one "UI surface". For example,
971 // an extension that has a browser action and a page action. 953 // an extension that has a browser action and a page action.
972 bool HasMultipleUISurfaces() const; 954 bool HasMultipleUISurfaces() const;
973 955
974 // Updates the launch URL and extents for the extension using the given 956 // Updates the launch URL and extents for the extension using the given
975 // |override_url|. 957 // |override_url|.
976 void OverrideLaunchUrl(const GURL& override_url); 958 void OverrideLaunchUrl(const GURL& override_url);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 // The extension's version. 1037 // The extension's version.
1056 scoped_ptr<Version> version_; 1038 scoped_ptr<Version> version_;
1057 1039
1058 // An optional longer description of the extension. 1040 // An optional longer description of the extension.
1059 std::string description_; 1041 std::string description_;
1060 1042
1061 // True if the extension was generated from a user script. (We show slightly 1043 // True if the extension was generated from a user script. (We show slightly
1062 // different UI if so). 1044 // different UI if so).
1063 bool converted_from_user_script_; 1045 bool converted_from_user_script_;
1064 1046
1065 // Paths to the content scripts the extension contains.
1066 UserScriptList content_scripts_;
1067
1068 // The extension's page action, if any. 1047 // The extension's page action, if any.
1069 scoped_ptr<ActionInfo> page_action_info_; 1048 scoped_ptr<ActionInfo> page_action_info_;
1070 1049
1071 // The extension's system indicator, if any. 1050 // The extension's system indicator, if any.
1072 scoped_ptr<ActionInfo> system_indicator_info_; 1051 scoped_ptr<ActionInfo> system_indicator_info_;
1073 1052
1074 // Optional list of NPAPI plugins and associated properties. 1053 // Optional list of NPAPI plugins and associated properties.
1075 std::vector<PluginInfo> plugins_; 1054 std::vector<PluginInfo> plugins_;
1076 1055
1077 // Optional list of NaCl modules and associated properties. 1056 // Optional list of NaCl modules and associated properties.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 1260
1282 UpdatedExtensionPermissionsInfo( 1261 UpdatedExtensionPermissionsInfo(
1283 const Extension* extension, 1262 const Extension* extension,
1284 const PermissionSet* permissions, 1263 const PermissionSet* permissions,
1285 Reason reason); 1264 Reason reason);
1286 }; 1265 };
1287 1266
1288 } // namespace extensions 1267 } // namespace extensions
1289 1268
1290 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 1269 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698