| 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 <map> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 13 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "base/version.h" | 16 #include "base/version.h" |
| 16 #include "chrome/common/extensions/user_script.h" | 17 #include "chrome/common/extensions/user_script.h" |
| 17 #include "chrome/browser/extensions/user_script_master.h" | 18 #include "chrome/browser/extensions/user_script_master.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ToolstripInfo() : mole_height(0) {} | 83 ToolstripInfo() : mole_height(0) {} |
| 83 | 84 |
| 84 GURL toolstrip; | 85 GURL toolstrip; |
| 85 GURL mole; | 86 GURL mole; |
| 86 int mole_height; | 87 int mole_height; |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 // The name of the manifest inside an extension. | 90 // The name of the manifest inside an extension. |
| 90 static const char kManifestFilename[]; | 91 static const char kManifestFilename[]; |
| 91 | 92 |
| 93 // The name of locale folder inside an extension. |
| 94 static const char kLocaleFolder[]; |
| 95 |
| 96 // The name of the messages file inside an extension. |
| 97 static const char kMessagesFilename[]; |
| 98 |
| 92 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
| 93 static const char* kExtensionRegistryPath; | 100 static const char* kExtensionRegistryPath; |
| 94 #endif | 101 #endif |
| 95 | 102 |
| 96 // The number of bytes in a legal id. | 103 // The number of bytes in a legal id. |
| 97 static const size_t kIdSize; | 104 static const size_t kIdSize; |
| 98 | 105 |
| 99 // The mimetype used for extensions. | 106 // The mimetype used for extensions. |
| 100 static const char kMimeType[]; | 107 static const char kMimeType[]; |
| 101 | 108 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 return theme_display_properties_.get(); | 216 return theme_display_properties_.get(); |
| 210 } | 217 } |
| 211 bool IsTheme() { return is_theme_; } | 218 bool IsTheme() { return is_theme_; } |
| 212 | 219 |
| 213 // Returns a list of paths (relative to the extension dir) for images that | 220 // Returns a list of paths (relative to the extension dir) for images that |
| 214 // the browser might load (like themes and page action icons). | 221 // the browser might load (like themes and page action icons). |
| 215 std::set<FilePath> GetBrowserImages(); | 222 std::set<FilePath> GetBrowserImages(); |
| 216 | 223 |
| 217 PermissionClass GetPermissionClass(); | 224 PermissionClass GetPermissionClass(); |
| 218 | 225 |
| 226 // Returns a list of all locales supported by the extension. |
| 227 const std::set<std::string>& supported_locales() const { |
| 228 return supported_locales_; |
| 229 } |
| 230 // Add locale to the list of supported locales. |
| 231 void AddSupportedLocale(const std::string& supported_locale) { |
| 232 supported_locales_.insert(supported_locale); |
| 233 } |
| 234 |
| 235 // Getter/setter for a default_locale_. |
| 236 const std::string& default_locale() const { return default_locale_; } |
| 237 void set_default_locale(const std::string& default_locale) { |
| 238 default_locale_ = default_locale; |
| 239 } |
| 219 | 240 |
| 220 // Runtime data: | 241 // Runtime data: |
| 221 // Put dynamic data about the state of a running extension below. | 242 // Put dynamic data about the state of a running extension below. |
| 222 | 243 |
| 223 // Whether the background page, if any, is ready. We don't load other | 244 // Whether the background page, if any, is ready. We don't load other |
| 224 // components until then. If there is no background page, we consider it to | 245 // components until then. If there is no background page, we consider it to |
| 225 // be ready. | 246 // be ready. |
| 226 bool GetBackgroundPageReady(); | 247 bool GetBackgroundPageReady(); |
| 227 void SetBackgroundPageReady(); | 248 void SetBackgroundPageReady(); |
| 228 | 249 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 std::vector<std::string> api_permissions_; | 338 std::vector<std::string> api_permissions_; |
| 318 | 339 |
| 319 // The sites this extension has permission to talk to (using XHR, etc). | 340 // The sites this extension has permission to talk to (using XHR, etc). |
| 320 std::vector<URLPattern> host_permissions_; | 341 std::vector<URLPattern> host_permissions_; |
| 321 | 342 |
| 322 // The paths to the icons the extension contains mapped by their width. | 343 // The paths to the icons the extension contains mapped by their width. |
| 323 std::map<int, std::string> icons_; | 344 std::map<int, std::string> icons_; |
| 324 | 345 |
| 325 // URL for fetching an update manifest | 346 // URL for fetching an update manifest |
| 326 GURL update_url_; | 347 GURL update_url_; |
| 327 | 348 |
| 349 // List of all locales extension supports. |
| 350 std::set<std::string> supported_locales_; |
| 351 |
| 352 // Default locale, used for fallback. |
| 353 std::string default_locale_; |
| 328 | 354 |
| 329 // Runtime data: | 355 // Runtime data: |
| 330 | 356 |
| 331 // True if the background page is ready. | 357 // True if the background page is ready. |
| 332 bool background_page_ready_; | 358 bool background_page_ready_; |
| 333 | 359 |
| 334 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); | 360 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); |
| 335 | 361 |
| 336 DISALLOW_COPY_AND_ASSIGN(Extension); | 362 DISALLOW_COPY_AND_ASSIGN(Extension); |
| 337 }; | 363 }; |
| 338 | 364 |
| 339 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 365 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |