diff options
6 files changed, 84 insertions, 7 deletions
diff --git a/chrome/browser/extensions/extension_management_api.cc b/chrome/browser/extensions/extension_management_api.cc index d1d8a6d..67622cb 100644 --- a/chrome/browser/extensions/extension_management_api.cc +++ b/chrome/browser/extensions/extension_management_api.cc @@ -41,6 +41,7 @@ const char kIconsKey[] = "icons"; const char kIdKey[] = "id"; const char kIsAppKey[] = "isApp"; const char kNameKey[] = "name"; +const char kOfflineEnabledKey[] = "offlineEnabled"; const char kOptionsUrlKey[] = "optionsUrl"; const char kPermissionsKey[] = "permissions"; const char kMayDisableKey[] = "mayDisable"; @@ -69,12 +70,13 @@ static DictionaryValue* CreateExtensionInfo(const Extension& extension, info->SetBoolean(kEnabledKey, enabled); info->SetBoolean(kMayDisableKey, Extension::UserMayDisable(extension.location())); + info->SetBoolean(kOfflineEnabledKey, extension.offline_enabled()); info->SetString(kVersionKey, extension.VersionString()); info->SetString(kDescriptionKey, extension.description()); info->SetString(kOptionsUrlKey, - extension.options_url().possibly_invalid_spec()); + extension.options_url().possibly_invalid_spec()); info->SetString(kHomepageURLKey, - extension.GetHomepageURL().possibly_invalid_spec()); + extension.GetHomepageURL().possibly_invalid_spec()); if (extension.is_app()) info->SetString(kAppLaunchUrlKey, extension.GetFullLaunchURL().possibly_invalid_spec()); diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 607e9e4..04146e5 100644 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -6337,6 +6337,10 @@ "type": "string", "optional": true }, + "offlineEnabled": { + "description": "Whether the extension or app declares that it supports offline.", + "type": "boolean" + }, "optionsUrl": { "description": "The url for the item's options page, if it has one.", "type": "string" diff --git a/chrome/common/extensions/docs/management.html b/chrome/common/extensions/docs/management.html index 15c71bb..4a917e5 100644 --- a/chrome/common/extensions/docs/management.html +++ b/chrome/common/extensions/docs/management.html @@ -3424,6 +3424,74 @@ The one method that doesn't require the "manifest" permission is </div><div> <div> <dt> + <var>offlineEnabled</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>boolean</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>Whether the extension or app declares that it supports offline.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- OBJECT METHODS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- OBJECT EVENT FIELDS --> + <dd style="display: none; "> + <div></div> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>optionsUrl</var> <em> diff --git a/chrome/test/data/extensions/api_test/management/enabled_app/manifest.json b/chrome/test/data/extensions/api_test/management/enabled_app/manifest.json index 976b752..ca093cd 100644 --- a/chrome/test/data/extensions/api_test/management/enabled_app/manifest.json +++ b/chrome/test/data/extensions/api_test/management/enabled_app/manifest.json @@ -5,5 +5,6 @@ "launch": { "web_url": "http://www.google.com" } - } + }, + "offline_enabled": true } diff --git a/chrome/test/data/extensions/api_test/management/test/basics.js b/chrome/test/data/extensions/api_test/management/test/basics.js index a55e9d7..c0b74e4 100644 --- a/chrome/test/data/extensions/api_test/management/test/basics.js +++ b/chrome/test/data/extensions/api_test/management/test/basics.js @@ -51,12 +51,13 @@ var tests = [ checkItemInList(items, "description", true, false, { "description": "a short description" }); checkItemInList(items, "enabled_app", true, true, - {"appLaunchUrl": "http://www.google.com/"}); + { "appLaunchUrl": "http://www.google.com/", + "offlineEnabled": true }); checkItemInList(items, "disabled_app", false, true); checkItemInList(items, "enabled_extension", true, false, { "homepageUrl": "http://example.com/" }); checkItemInList(items, "disabled_extension", false, false, - {"optionsUrl": "chrome-extension://<ID>/pages/options.html"}); + { "optionsUrl": "chrome-extension://<ID>/pages/options.html" }); // Check that we got the icons correctly var extension = getItemNamed(items, "enabled_extension"); diff --git a/chrome/test/data/extensions/api_test/management/test/common.js b/chrome/test/data/extensions/api_test/management/test/common.js index 9cc34aa..820220f 100644 --- a/chrome/test/data/extensions/api_test/management/test/common.js +++ b/chrome/test/data/extensions/api_test/management/test/common.js @@ -25,14 +25,15 @@ function getItemNamed(list, name) { // |enabled|, and |isApp|, and checks against any additional name/value // properties from |additional_properties|. function checkItem(item, name, enabled, isApp, additional_properties) { - assertTrue(item != null); + assertTrue(item !== null); assertEq(name, item.name); assertEq(isApp, item.isApp); assertEq(enabled, item.enabled); for (var propname in additional_properties) { var value = additional_properties[propname]; - value = value.replace("<ID>", item.id); + if (typeof value === 'string') + value = value.replace("<ID>", item.id); assertTrue(propname in item); assertEq(value, item[propname]); } |