OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
sail
2013/01/23 20:23:15
is this intentional?
SanjoyPal
2013/01/23 20:35:41
Done. It was not intentional.
| |
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> |
11 #include <set> | 11 #include <set> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 class ImageSkia; | 48 class ImageSkia; |
49 } | 49 } |
50 | 50 |
51 FORWARD_DECLARE_TEST(TabStripModelTest, Apps); | 51 FORWARD_DECLARE_TEST(TabStripModelTest, Apps); |
52 | 52 |
53 namespace extensions { | 53 namespace extensions { |
54 | 54 |
55 class Manifest; | 55 class Manifest; |
56 class PermissionSet; | 56 class PermissionSet; |
57 | 57 |
58 typedef std::set<std::string> OAuth2Scopes; | |
59 | |
60 // Represents a Chrome extension. | 58 // Represents a Chrome extension. |
61 class Extension : public base::RefCountedThreadSafe<Extension> { | 59 class Extension : public base::RefCountedThreadSafe<Extension> { |
62 public: | 60 public: |
63 struct InstallWarning; | 61 struct InstallWarning; |
64 struct ManifestData; | 62 struct ManifestData; |
65 | 63 |
66 typedef std::vector<std::string> ScriptingWhitelist; | 64 typedef std::vector<std::string> ScriptingWhitelist; |
67 typedef std::vector<InstallWarning> InstallWarningVector; | 65 typedef std::vector<InstallWarning> InstallWarningVector; |
68 typedef std::map<const std::string, linked_ptr<ManifestData> > | 66 typedef std::map<const std::string, linked_ptr<ManifestData> > |
69 ManifestDataMap; | 67 ManifestDataMap; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 FilePath path; // Path to the plugin. | 162 FilePath path; // Path to the plugin. |
165 bool is_public; // False if only this extension can load this plugin. | 163 bool is_public; // False if only this extension can load this plugin. |
166 }; | 164 }; |
167 | 165 |
168 // An NaCl module included in the extension. | 166 // An NaCl module included in the extension. |
169 struct NaClModuleInfo { | 167 struct NaClModuleInfo { |
170 GURL url; | 168 GURL url; |
171 std::string mime_type; | 169 std::string mime_type; |
172 }; | 170 }; |
173 | 171 |
174 // OAuth2 info included in the extension. | |
175 struct OAuth2Info { | |
176 OAuth2Info(); | |
177 ~OAuth2Info(); | |
178 | |
179 OAuth2Scopes GetScopesAsSet(); | |
180 | |
181 std::string client_id; | |
182 std::vector<std::string> scopes; | |
183 }; | |
184 | |
185 struct ActionInfo { | 172 struct ActionInfo { |
186 explicit ActionInfo(); | 173 explicit ActionInfo(); |
187 ~ActionInfo(); | 174 ~ActionInfo(); |
188 | 175 |
189 // The types of extension actions. | 176 // The types of extension actions. |
190 enum Type { | 177 enum Type { |
191 TYPE_BROWSER, | 178 TYPE_BROWSER, |
192 TYPE_PAGE, | 179 TYPE_PAGE, |
193 TYPE_SCRIPT_BADGE, | 180 TYPE_SCRIPT_BADGE, |
194 TYPE_SYSTEM_INDICATOR, | 181 TYPE_SYSTEM_INDICATOR, |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
696 const InstallWarningVector& install_warnings() const { | 683 const InstallWarningVector& install_warnings() const { |
697 return install_warnings_; | 684 return install_warnings_; |
698 } | 685 } |
699 const ExtensionIconSet& icons() const { return icons_; } | 686 const ExtensionIconSet& icons() const { return icons_; } |
700 const extensions::Manifest* manifest() const { | 687 const extensions::Manifest* manifest() const { |
701 return manifest_.get(); | 688 return manifest_.get(); |
702 } | 689 } |
703 const std::string default_locale() const { return default_locale_; } | 690 const std::string default_locale() const { return default_locale_; } |
704 bool incognito_split_mode() const { return incognito_split_mode_; } | 691 bool incognito_split_mode() const { return incognito_split_mode_; } |
705 bool offline_enabled() const { return offline_enabled_; } | 692 bool offline_enabled() const { return offline_enabled_; } |
706 const OAuth2Info& oauth2_info() const { return oauth2_info_; } | |
707 bool wants_file_access() const { return wants_file_access_; } | 693 bool wants_file_access() const { return wants_file_access_; } |
708 int creation_flags() const { return creation_flags_; } | 694 int creation_flags() const { return creation_flags_; } |
709 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } | 695 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } |
710 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } | 696 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } |
711 bool was_installed_by_default() const { | 697 bool was_installed_by_default() const { |
712 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; | 698 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; |
713 } | 699 } |
714 | 700 |
715 // App-related. | 701 // App-related. |
716 bool is_app() const { | 702 bool is_app() const { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
910 void(UserScript::*add_method)(const std::string& glob), | 896 void(UserScript::*add_method)(const std::string& glob), |
911 UserScript* instance); | 897 UserScript* instance); |
912 | 898 |
913 // Helper method to load an ExtensionAction from the page_action or | 899 // Helper method to load an ExtensionAction from the page_action or |
914 // browser_action entries in the manifest. | 900 // browser_action entries in the manifest. |
915 scoped_ptr<ActionInfo> LoadExtensionActionInfoHelper( | 901 scoped_ptr<ActionInfo> LoadExtensionActionInfoHelper( |
916 const base::DictionaryValue* manifest_section, | 902 const base::DictionaryValue* manifest_section, |
917 ActionInfo::Type action_type, | 903 ActionInfo::Type action_type, |
918 string16* error); | 904 string16* error); |
919 | 905 |
920 // Helper method that loads the OAuth2 info from the 'oauth2' manifest key. | |
921 bool LoadOAuth2Info(string16* error); | |
922 | |
923 // Returns true if the extension has more than one "UI surface". For example, | 906 // Returns true if the extension has more than one "UI surface". For example, |
924 // an extension that has a browser action and a page action. | 907 // an extension that has a browser action and a page action. |
925 bool HasMultipleUISurfaces() const; | 908 bool HasMultipleUISurfaces() const; |
926 | 909 |
927 // Updates the launch URL and extents for the extension using the given | 910 // Updates the launch URL and extents for the extension using the given |
928 // |override_url|. | 911 // |override_url|. |
929 void OverrideLaunchUrl(const GURL& override_url); | 912 void OverrideLaunchUrl(const GURL& override_url); |
930 | 913 |
931 // Custom checks for the experimental permission that can't be expressed in | 914 // Custom checks for the experimental permission that can't be expressed in |
932 // _permission_features.json. | 915 // _permission_features.json. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1128 // containers like panels and windows. | 1111 // containers like panels and windows. |
1129 int launch_width_; | 1112 int launch_width_; |
1130 int launch_height_; | 1113 int launch_height_; |
1131 | 1114 |
1132 // Should this app be shown in the app launcher. | 1115 // Should this app be shown in the app launcher. |
1133 bool display_in_launcher_; | 1116 bool display_in_launcher_; |
1134 | 1117 |
1135 // Should this app be shown in the browser New Tab Page. | 1118 // Should this app be shown in the browser New Tab Page. |
1136 bool display_in_new_tab_page_; | 1119 bool display_in_new_tab_page_; |
1137 | 1120 |
1138 // The OAuth2 client id and scopes, if specified by the extension. | |
1139 OAuth2Info oauth2_info_; | |
1140 | |
1141 // Whether the extension has host permissions or user script patterns that | 1121 // Whether the extension has host permissions or user script patterns that |
1142 // imply access to file:/// scheme URLs (the user may not have actually | 1122 // imply access to file:/// scheme URLs (the user may not have actually |
1143 // granted it that access). | 1123 // granted it that access). |
1144 bool wants_file_access_; | 1124 bool wants_file_access_; |
1145 | 1125 |
1146 // The flags that were passed to InitFromValue. | 1126 // The flags that were passed to InitFromValue. |
1147 int creation_flags_; | 1127 int creation_flags_; |
1148 | 1128 |
1149 // The Content-Security-Policy for this extension. Extensions can use | 1129 // The Content-Security-Policy for this extension. Extensions can use |
1150 // Content-Security-Policies to mitigate cross-site scripting and other | 1130 // Content-Security-Policies to mitigate cross-site scripting and other |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1214 | 1194 |
1215 UpdatedExtensionPermissionsInfo( | 1195 UpdatedExtensionPermissionsInfo( |
1216 const Extension* extension, | 1196 const Extension* extension, |
1217 const PermissionSet* permissions, | 1197 const PermissionSet* permissions, |
1218 Reason reason); | 1198 Reason reason); |
1219 }; | 1199 }; |
1220 | 1200 |
1221 } // namespace extensions | 1201 } // namespace extensions |
1222 | 1202 |
1223 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1203 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
OLD | NEW |