| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 enum Icons { | 51 enum Icons { |
| 52 EXTENSION_ICON_LARGE = 128, | 52 EXTENSION_ICON_LARGE = 128, |
| 53 EXTENSION_ICON_MEDIUM = 48, | 53 EXTENSION_ICON_MEDIUM = 48, |
| 54 EXTENSION_ICON_SMALL = 32, | 54 EXTENSION_ICON_SMALL = 32, |
| 55 EXTENSION_ICON_BITTY = 16, | 55 EXTENSION_ICON_BITTY = 16, |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // Icon sizes used by the extension system. | 58 // Icon sizes used by the extension system. |
| 59 static const int kIconSizes[]; | 59 static const int kIconSizes[]; |
| 60 | 60 |
| 61 // Each permission is a module that the extension is permitted to use. |
| 62 static const char* kPermissionNames[]; |
| 63 static const size_t kNumPermissions; |
| 64 |
| 61 // An NPAPI plugin included in the extension. | 65 // An NPAPI plugin included in the extension. |
| 62 struct PluginInfo { | 66 struct PluginInfo { |
| 63 FilePath path; // Path to the plugin. | 67 FilePath path; // Path to the plugin. |
| 64 bool is_public; // False if only this extension can load this plugin. | 68 bool is_public; // False if only this extension can load this plugin. |
| 65 }; | 69 }; |
| 66 | 70 |
| 67 // A toolstrip and its associated mole. | 71 // A toolstrip and its associated mole. |
| 68 struct ToolstripInfo { | 72 struct ToolstripInfo { |
| 69 ToolstripInfo() : mole_height(0) {} | 73 ToolstripInfo() : mole_height(0) {} |
| 70 | 74 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // String representation of the version number. | 169 // String representation of the version number. |
| 166 const std::string VersionString() const; | 170 const std::string VersionString() const; |
| 167 const std::string& name() const { return name_; } | 171 const std::string& name() const { return name_; } |
| 168 const std::string& public_key() const { return public_key_; } | 172 const std::string& public_key() const { return public_key_; } |
| 169 const std::string& description() const { return description_; } | 173 const std::string& description() const { return description_; } |
| 170 const UserScriptList& content_scripts() const { return content_scripts_; } | 174 const UserScriptList& content_scripts() const { return content_scripts_; } |
| 171 const PageActionMap& page_actions() const { return page_actions_; } | 175 const PageActionMap& page_actions() const { return page_actions_; } |
| 172 const std::vector<PluginInfo>& plugins() const { return plugins_; } | 176 const std::vector<PluginInfo>& plugins() const { return plugins_; } |
| 173 const GURL& background_url() const { return background_url_; } | 177 const GURL& background_url() const { return background_url_; } |
| 174 const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; } | 178 const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; } |
| 175 const std::vector<URLPattern>& permissions() const { return permissions_; } | 179 const std::vector<URLPattern>& host_permissions() const { |
| 180 return host_permissions_; |
| 181 } |
| 182 const std::vector<std::string>& api_permissions() const { |
| 183 return api_permissions_; |
| 184 } |
| 176 const GURL& update_url() const { return update_url_; } | 185 const GURL& update_url() const { return update_url_; } |
| 177 const std::map<int, std::string>& icons() { return icons_; } | 186 const std::map<int, std::string>& icons() { return icons_; } |
| 178 | 187 |
| 179 // Retrieves a page action by |id|. | 188 // Retrieves a page action by |id|. |
| 180 const PageAction* GetPageAction(std::string id) const; | 189 const PageAction* GetPageAction(std::string id) const; |
| 181 | 190 |
| 182 // Returns the origin of this extension. This function takes a |registry_path| | 191 // Returns the origin of this extension. This function takes a |registry_path| |
| 183 // so that the registry location can be overwritten during testing. | 192 // so that the registry location can be overwritten during testing. |
| 184 Location ExternalExtensionInstallType(std::string registry_path); | 193 Location ExternalExtensionInstallType(std::string registry_path); |
| 185 | 194 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 295 |
| 287 // A map of color names to colors. | 296 // A map of color names to colors. |
| 288 scoped_ptr<DictionaryValue> theme_tints_; | 297 scoped_ptr<DictionaryValue> theme_tints_; |
| 289 | 298 |
| 290 // A map of display properties. | 299 // A map of display properties. |
| 291 scoped_ptr<DictionaryValue> theme_display_properties_; | 300 scoped_ptr<DictionaryValue> theme_display_properties_; |
| 292 | 301 |
| 293 // Whether the extension is a theme - if it is, certain things are disabled. | 302 // Whether the extension is a theme - if it is, certain things are disabled. |
| 294 bool is_theme_; | 303 bool is_theme_; |
| 295 | 304 |
| 305 // The set of module-level APIs this extension can use. |
| 306 std::vector<std::string> api_permissions_; |
| 307 |
| 296 // The sites this extension has permission to talk to (using XHR, etc). | 308 // The sites this extension has permission to talk to (using XHR, etc). |
| 297 std::vector<URLPattern> permissions_; | 309 std::vector<URLPattern> host_permissions_; |
| 298 | 310 |
| 299 // The paths to the icons the extension contains mapped by their width. | 311 // The paths to the icons the extension contains mapped by their width. |
| 300 std::map<int, std::string> icons_; | 312 std::map<int, std::string> icons_; |
| 301 | 313 |
| 302 // URL for fetching an update manifest | 314 // URL for fetching an update manifest |
| 303 GURL update_url_; | 315 GURL update_url_; |
| 304 | 316 |
| 305 | 317 |
| 306 // Runtime data: | 318 // Runtime data: |
| 307 | 319 |
| 308 // True if the background page is ready. | 320 // True if the background page is ready. |
| 309 bool background_page_ready_; | 321 bool background_page_ready_; |
| 310 | 322 |
| 311 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); | 323 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); |
| 312 | 324 |
| 313 DISALLOW_COPY_AND_ASSIGN(Extension); | 325 DISALLOW_COPY_AND_ASSIGN(Extension); |
| 314 }; | 326 }; |
| 315 | 327 |
| 316 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 328 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |