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

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

Issue 11660016: Move the parsing of "chrome_url_overrides" out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 class PermissionSet; 60 class PermissionSet;
61 61
62 typedef std::set<std::string> OAuth2Scopes; 62 typedef std::set<std::string> OAuth2Scopes;
63 63
64 // Represents a Chrome extension. 64 // Represents a Chrome extension.
65 class Extension : public base::RefCountedThreadSafe<Extension> { 65 class Extension : public base::RefCountedThreadSafe<Extension> {
66 public: 66 public:
67 struct InstallWarning; 67 struct InstallWarning;
68 struct ManifestData; 68 struct ManifestData;
69 69
70 typedef std::map<const std::string, GURL> URLOverrideMap;
71 typedef std::vector<std::string> ScriptingWhitelist; 70 typedef std::vector<std::string> ScriptingWhitelist;
72 typedef std::vector<linked_ptr<FileBrowserHandler> > FileBrowserHandlerList; 71 typedef std::vector<linked_ptr<FileBrowserHandler> > FileBrowserHandlerList;
73 typedef std::vector<InstallWarning> InstallWarningVector; 72 typedef std::vector<InstallWarning> InstallWarningVector;
74 typedef std::map<const std::string, linked_ptr<ManifestData> > 73 typedef std::map<const std::string, linked_ptr<ManifestData> >
75 ManifestDataMap; 74 ManifestDataMap;
76 75
77 // What an extension was loaded from. 76 // What an extension was loaded from.
78 // NOTE: These values are stored as integers in the preferences and used 77 // NOTE: These values are stored as integers in the preferences and used
79 // in histograms so don't remove or reorder existing items. Just append 78 // in histograms so don't remove or reorder existing items. Just append
80 // to the end. 79 // to the end.
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 void AddInstallWarnings(const InstallWarningVector& new_warnings); 760 void AddInstallWarnings(const InstallWarningVector& new_warnings);
762 const InstallWarningVector& install_warnings() const { 761 const InstallWarningVector& install_warnings() const {
763 return install_warnings_; 762 return install_warnings_;
764 } 763 }
765 const GURL& update_url() const { return update_url_; } 764 const GURL& update_url() const { return update_url_; }
766 const ExtensionIconSet& icons() const { return icons_; } 765 const ExtensionIconSet& icons() const { return icons_; }
767 const extensions::Manifest* manifest() const { 766 const extensions::Manifest* manifest() const {
768 return manifest_.get(); 767 return manifest_.get();
769 } 768 }
770 const std::string default_locale() const { return default_locale_; } 769 const std::string default_locale() const { return default_locale_; }
771 const URLOverrideMap& GetChromeURLOverrides() const {
772 return chrome_url_overrides_;
773 }
774 bool incognito_split_mode() const { return incognito_split_mode_; } 770 bool incognito_split_mode() const { return incognito_split_mode_; }
775 bool offline_enabled() const { return offline_enabled_; } 771 bool offline_enabled() const { return offline_enabled_; }
776 const std::vector<TtsVoice>& tts_voices() const { return tts_voices_; } 772 const std::vector<TtsVoice>& tts_voices() const { return tts_voices_; }
777 const OAuth2Info& oauth2_info() const { return oauth2_info_; } 773 const OAuth2Info& oauth2_info() const { return oauth2_info_; }
778 const std::vector<webkit_glue::WebIntentServiceData>& 774 const std::vector<webkit_glue::WebIntentServiceData>&
779 intents_services() const { 775 intents_services() const {
780 return intents_services_; 776 return intents_services_;
781 } 777 }
782 778
783 bool wants_file_access() const { return wants_file_access_; } 779 bool wants_file_access() const { return wants_file_access_; }
784 int creation_flags() const { return creation_flags_; } 780 int creation_flags() const { return creation_flags_; }
785 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } 781 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; }
786 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } 782 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; }
787 bool was_installed_by_default() const { 783 bool was_installed_by_default() const {
788 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; 784 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0;
789 } 785 }
790 786
791 // App-related. 787 // App-related.
792 bool is_app() const { 788 bool is_app() const {
793 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app(); 789 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app();
794 } 790 }
795 bool is_platform_app() const; 791 bool is_platform_app() const;
796 bool is_hosted_app() const; 792 bool is_hosted_app() const;
797 bool is_legacy_packaged_app() const; 793 bool is_legacy_packaged_app() const;
798 bool is_extension() const; 794 bool is_extension() const;
799 bool is_storage_isolated() const { return is_storage_isolated_; } 795 bool is_storage_isolated() const { return is_storage_isolated_; }
800 bool can_be_incognito_enabled() const; 796 bool can_be_incognito_enabled() const;
797 void AddWebExtentPattern(const URLPattern& pattern);
801 const URLPatternSet& web_extent() const { return extent_; } 798 const URLPatternSet& web_extent() const { return extent_; }
802 const std::string& launch_local_path() const { return launch_local_path_; } 799 const std::string& launch_local_path() const { return launch_local_path_; }
803 const std::string& launch_web_url() const { return launch_web_url_; } 800 const std::string& launch_web_url() const { return launch_web_url_; }
804 extension_misc::LaunchContainer launch_container() const { 801 extension_misc::LaunchContainer launch_container() const {
805 return launch_container_; 802 return launch_container_;
806 } 803 }
807 int launch_width() const { return launch_width_; } 804 int launch_width() const { return launch_width_; }
808 int launch_height() const { return launch_height_; } 805 int launch_height() const { return launch_height_; }
809 806
810 const std::vector<FileHandlerInfo>& file_handlers() const { 807 const std::vector<FileHandlerInfo>& file_handlers() const {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 bool LoadBrowserAction(string16* error); 954 bool LoadBrowserAction(string16* error);
958 bool LoadScriptBadge(string16* error); 955 bool LoadScriptBadge(string16* error);
959 bool LoadSystemIndicator(APIPermissionSet* api_permissions, string16* error); 956 bool LoadSystemIndicator(APIPermissionSet* api_permissions, string16* error);
960 bool LoadFileBrowserHandlers(string16* error); 957 bool LoadFileBrowserHandlers(string16* error);
961 // Helper method to load a FileBrowserHandlerList from the manifest. 958 // Helper method to load a FileBrowserHandlerList from the manifest.
962 FileBrowserHandlerList* LoadFileBrowserHandlersHelper( 959 FileBrowserHandlerList* LoadFileBrowserHandlersHelper(
963 const base::ListValue* extension_actions, string16* error); 960 const base::ListValue* extension_actions, string16* error);
964 // Helper method to load an FileBrowserHandler from manifest. 961 // Helper method to load an FileBrowserHandler from manifest.
965 FileBrowserHandler* LoadFileBrowserHandler( 962 FileBrowserHandler* LoadFileBrowserHandler(
966 const base::DictionaryValue* file_browser_handlers, string16* error); 963 const base::DictionaryValue* file_browser_handlers, string16* error);
967 bool LoadChromeURLOverrides(string16* error);
968 bool LoadTextToSpeechVoices(string16* error); 964 bool LoadTextToSpeechVoices(string16* error);
969 bool LoadIncognitoMode(string16* error); 965 bool LoadIncognitoMode(string16* error);
970 bool LoadContentSecurityPolicy(string16* error); 966 bool LoadContentSecurityPolicy(string16* error);
971 967
972 bool LoadThemeFeatures(string16* error); 968 bool LoadThemeFeatures(string16* error);
973 bool LoadThemeImages(const base::DictionaryValue* theme_value, 969 bool LoadThemeImages(const base::DictionaryValue* theme_value,
974 string16* error); 970 string16* error);
975 bool LoadThemeColors(const base::DictionaryValue* theme_value, 971 bool LoadThemeColors(const base::DictionaryValue* theme_value,
976 string16* error); 972 string16* error);
977 bool LoadThemeTints(const base::DictionaryValue* theme_value, 973 bool LoadThemeTints(const base::DictionaryValue* theme_value,
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 1198
1203 // The manifest from which this extension was created. 1199 // The manifest from which this extension was created.
1204 scoped_ptr<Manifest> manifest_; 1200 scoped_ptr<Manifest> manifest_;
1205 1201
1206 // Stored parsed manifest data. 1202 // Stored parsed manifest data.
1207 ManifestDataMap manifest_data_; 1203 ManifestDataMap manifest_data_;
1208 1204
1209 // Set to true at the end of InitValue when initialization is finished. 1205 // Set to true at the end of InitValue when initialization is finished.
1210 bool finished_parsing_manifest_; 1206 bool finished_parsing_manifest_;
1211 1207
1212 // A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs
1213 // which override the handling of those URLs. (see ExtensionOverrideUI).
1214 URLOverrideMap chrome_url_overrides_;
1215
1216 // Whether this extension requests isolated storage. 1208 // Whether this extension requests isolated storage.
1217 bool is_storage_isolated_; 1209 bool is_storage_isolated_;
1218 1210
1219 // The local path inside the extension to use with the launcher. 1211 // The local path inside the extension to use with the launcher.
1220 std::string launch_local_path_; 1212 std::string launch_local_path_;
1221 1213
1222 // A web url to use with the launcher. Note that this might be relative or 1214 // A web url to use with the launcher. Note that this might be relative or
1223 // absolute. If relative, it is relative to web_origin. 1215 // absolute. If relative, it is relative to web_origin.
1224 std::string launch_web_url_; 1216 std::string launch_web_url_;
1225 1217
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 1321
1330 UpdatedExtensionPermissionsInfo( 1322 UpdatedExtensionPermissionsInfo(
1331 const Extension* extension, 1323 const Extension* extension,
1332 const PermissionSet* permissions, 1324 const PermissionSet* permissions,
1333 Reason reason); 1325 Reason reason);
1334 }; 1326 };
1335 1327
1336 } // namespace extensions 1328 } // namespace extensions
1337 1329
1338 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 1330 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698