summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions
diff options
context:
space:
mode:
authorrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 15:15:09 +0000
committerrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 15:15:09 +0000
commita65882cfd89af9fc51fc34781fd9ebfc4978ea4c (patch)
tree1bc1a7484c4d286a1ce26af1076c13cd40682e20 /chrome/common/extensions
parent96fdf3dd2d66d4c5b556df3574b324f36cafcd81 (diff)
downloadchromium_src-a65882cfd89af9fc51fc34781fd9ebfc4978ea4c.zip
chromium_src-a65882cfd89af9fc51fc34781fd9ebfc4978ea4c.tar.gz
chromium_src-a65882cfd89af9fc51fc34781fd9ebfc4978ea4c.tar.bz2
Allow an extension to dynamically set extra data in its update URL, in order
to communicate dynamic information to its update server if needed. BUG=none TEST=Make sure that existing extensions that do no set any extra data are not adversely affected. Review URL: http://codereview.chromium.org/4725002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65946 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r--chrome/common/extensions/api/extension_api.json8
-rw-r--r--chrome/common/extensions/docs/extension.html123
-rw-r--r--chrome/common/extensions/extension.cc8
-rw-r--r--chrome/common/extensions/extension.h4
4 files changed, 141 insertions, 2 deletions
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 68c9af0..ebc43a0f 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -188,6 +188,14 @@
"description": "Array of global window objects",
"items": { "type": "object", "isInstanceOf": "DOMWindow", "properties": {}, "additionalProperties": { "type": "any" } }
}
+ },
+ {
+ "name": "setUpdateUrlData",
+ "type": "function",
+ "description": "Sets the value of the ap CGI parameter used in the extension's update URL. This value is ignored for extensions that are hosted in the Chrome Extension Gallery.",
+ "parameters": [
+ {"type": "string", "name": "data", "maxLength": 1024}
+ ]
}
],
"events": [
diff --git a/chrome/common/extensions/docs/extension.html b/chrome/common/extensions/docs/extension.html
index 3f7dac6..7d301ac 100644
--- a/chrome/common/extensions/docs/extension.html
+++ b/chrome/common/extensions/docs/extension.html
@@ -284,6 +284,8 @@
<a href="#method-getViews">getViews</a>
</li><li>
<a href="#method-sendRequest">sendRequest</a>
+ </li><li>
+ <a href="#method-setUpdateUrlData">setUpdateUrlData</a>
</li>
</ol>
</li>
@@ -2008,6 +2010,127 @@ For details, see
</p>
</div> <!-- /description -->
+ </div><div class="apiItem">
+ <a name="method-setUpdateUrlData"></a> <!-- method-anchor -->
+ <h4>setUpdateUrlData</h4>
+
+ <div class="summary"><span style="display: none; ">void</span>
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.extension.setUpdateUrlData</span>(<span class="null"><span style="display: none; ">, </span><span>string</span>
+ <var><span>data</span></var></span>)</div>
+
+ <div class="description">
+ <p class="todo" style="display: none; ">Undocumented.</p>
+ <p>Sets the value of the ap CGI parameter used in the extension's update URL. This value is ignored for extensions that are hosted in the Chrome Extension Gallery.</p>
+
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>data</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>string</span>
+ <span style="display: none; "></span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <dd style="display: none; ">
+ Description of this parameter from the json schema.
+ </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>
+
+ <!-- FUNCTION PARAMETERS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ </div>
+ </div>
+ </dl>
+
+ <!-- RETURNS -->
+ <h4 style="display: none; ">Returns</h4>
+ <dl>
+ <div style="display: none; ">
+ <div>
+ </div>
+ </div>
+ </dl>
+
+ <!-- CALLBACK -->
+ <div style="display: none; ">
+ <div>
+ <h4>Callback function</h4>
+ <p>
+ The callback <em>parameter</em> should specify a function
+ that looks like this:
+ </p>
+ <p>
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span>;</pre>
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </div>
+ </div>
+
+ <!-- MIN_VERSION -->
+ <p style="display: none; ">
+ This function was added in version <b><span></span></b>.
+ If you require this function, 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.
+ </p>
+ </div> <!-- /description -->
+
</div> <!-- /apiItem -->
</div> <!-- /apiGroup -->
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 8b9c39f..41c260e 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1854,8 +1854,7 @@ GURL Extension::GetHomepageURL() const {
if (homepage_url_.is_valid())
return homepage_url_;
- if (update_url()!= GURL(extension_urls::kGalleryUpdateHttpsUrl) &&
- update_url()!= GURL(extension_urls::kGalleryUpdateHttpUrl))
+ if (!UpdatesFromGallery())
return GURL();
// TODO(erikkay): This may not be entirely correct with the webstore.
@@ -2193,6 +2192,11 @@ bool Extension::CanExecuteScriptEverywhere() const {
return false;
}
+bool Extension::UpdatesFromGallery() const {
+ return update_url() == GURL(extension_urls::kGalleryUpdateHttpsUrl) ||
+ update_url() == GURL(extension_urls::kGalleryUpdateHttpUrl);
+}
+
ExtensionInfo::ExtensionInfo(const DictionaryValue* manifest,
const std::string& id,
const FilePath& path,
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index ce7e628..6c545e73 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -356,6 +356,10 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// on the whitelist of extensions that can script all pages.
bool CanExecuteScriptEverywhere() const;
+ // Returns true if this extension updates itself using the extension
+ // gallery.
+ bool UpdatesFromGallery() const;
+
// Accessors:
const FilePath& path() const { return path_; }