OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: |
| 2 1) The <head> information in this page is significant, should be uniform |
| 3 across api docs and should be edited only with knowledge of the |
| 4 templating mechanism. |
| 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a |
| 6 browser, it will be re-generated from the template, json schema and |
| 7 authored overview content. |
| 8 4) The <body>.innerHTML is also generated by an offline step so that this |
| 9 page may easily be indexed by search engines. |
| 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> |
| 11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> |
| 13 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla
te_compiled.js"> |
| 14 </script> |
| 15 <script type="text/javascript" src="js/api_page_generator.js"></script> |
| 16 <script type="text/javascript" src="js/bootstrap.js"></script> |
| 17 <title>AutoUpdate</title></head><body> <div id="container"> |
| 18 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> |
| 19 <!-- In particular, sub-templates that recurse, must be used by allowing |
| 20 jstemplate to make a copy of the template in this section which |
| 21 are not operated on by way of the jsskip="true" --> |
| 22 <div style="display:none"> |
| 23 |
| 24 <!-- VALUE --> |
| 25 <div id="valueTemplate"> |
| 26 <dt> |
| 27 <var>paramName</var> |
| 28 <em> |
| 29 |
| 30 <!-- TYPE --> |
| 31 <div style="display:inline"> |
| 32 ( |
| 33 <span class="optional">optional</span> |
| 34 <span id="typeTemplate"> |
| 35 <span> |
| 36 <a> Type</a> |
| 37 </span> |
| 38 <span> |
| 39 <span> |
| 40 array of <span><span></span></span> |
| 41 </span> |
| 42 <span>paramType</span> |
| 43 </span> |
| 44 </span> |
| 45 ) |
| 46 </div> |
| 47 |
| 48 </em> |
| 49 </dt> |
| 50 <dd class="todo"> |
| 51 Undocumented. |
| 52 </dd> |
| 53 <dd> |
| 54 Description of this parameter from the json schema. |
| 55 </dd> |
| 56 |
| 57 <!-- OBJECT PROPERTIES --> |
| 58 <dd> |
| 59 <dl> |
| 60 <div> |
| 61 <div> |
| 62 </div> |
| 63 </div> |
| 64 </dl> |
| 65 </dd> |
| 66 </div> <!-- /VALUE --> |
| 67 |
| 68 </div> <!-- /SUBTEMPLATES --> |
| 69 |
| 70 <a name="top"> </a> |
| 71 <!-- API HEADER --> |
| 72 <div id="pageHeader"> |
| 73 <div id="searchbox"> |
| 74 <form action="http://www.google.com/cse" id="cse-search-box"> |
| 75 <div> |
| 76 <input type="hidden" name="cx" value="002967670403910741006:61_cvzfq
tno"> |
| 77 <input type="hidden" name="ie" value="UTF-8"> |
| 78 <input type="text" name="q" size="31"> |
| 79 <input type="submit" name="sa" value="Search"> |
| 80 </div> |
| 81 </form> |
| 82 |
| 83 <script type="text/javascript" src="http://www.google.com/jsapi"></scrip
t> |
| 84 <script type="text/javascript">google.load("elements", "1", {packages: "
transliteration"});</script> |
| 85 <script type="text/javascript" src="http://www.google.com/coop/cse/t13n?
form=cse-search-box&t13n_langs=en"></script> |
| 86 <script type="text/javascript" src="http://www.google.com/coop/cse/brand
?form=cse-search-box&lang=en"></script> |
| 87 </div> |
| 88 <div id="pageTitle"> |
| 89 <h1>AutoUpdate</h1> |
| 90 </div> |
| 91 </div> <!-- /pageHeader --> |
| 92 |
| 93 <div id="pageContent"> |
| 94 <!-- SIDENAV --> |
| 95 <div id="leftNav"> |
| 96 <ul> |
| 97 <li> <a href="index.html">Home</a></li> |
| 98 <li> <a href="getstarted.html">Getting Started</a></li> |
| 99 <li> <a href="overview.html">Overview</a></li> |
| 100 <li> <a href="devguide.html"><div>Developer's Guide</div></a> |
| 101 <ul> |
| 102 <li><a href="toolstrip.html">Toolstrips</a></li> |
| 103 <li><a href="pageActions.html">Page Actions</a></li> |
| 104 <li><a href="background_pages.html">Background Pages</a></li> |
| 105 <li><a href="content_scripts.html">Content Scripts</a></li> |
| 106 <li><a href="events.html">Events</a></li> |
| 107 <li><a href="tabs.html">Tabs</a></li> |
| 108 <li><a href="windows.html">Windows</a></li> |
| 109 <li><a href="bookmarks.html">Bookmarks</a></li> |
| 110 <li><a href="themes.html">Themes</a></li> |
| 111 <li><a href="npapi.html">NPAPI Plugins</a></li> |
| 112 <li><a href="xhr.html">Cross-Origin XHR</a></li> |
| 113 <li><a href="packaging.html">Packaging</a></li> |
| 114 <li class="leftNavSelected">Autoupdate</li> |
| 115 </ul> |
| 116 </li> |
| 117 <li><a href="tutorials.html"><div>Tutorials</div></a> |
| 118 <ul> |
| 119 <li><a href="tut_debugging.html">Debugging</a></li> |
| 120 </ul> |
| 121 </li> |
| 122 <li>Reference |
| 123 <ul> |
| 124 <li> Formats |
| 125 <ul> |
| 126 <li><a href="manifest.html">Manifest Files</a></li> |
| 127 <li><a href="match_patterns.html">Match Patterns</a></li> |
| 128 <li>Packages (.crx)</li> |
| 129 </ul> |
| 130 </li> |
| 131 <li> <a href="api_index.html">chrome.* APIs</a> </li> |
| 132 <li> <a href="api_other.html">Other APIs</a> </li> |
| 133 </ul> |
| 134 </li> |
| 135 <li><a href="http://dev.chromium.org/developers/design-documents/extens
ions/samples">Samples</a></li> |
| 136 </ul> |
| 137 </div> |
| 138 |
| 139 <div id="mainColumn"> |
| 140 <!-- TABLE OF CONTENTS --> |
| 141 <div id="toc"> |
| 142 <p>Contents</p> |
| 143 <ol> |
| 144 <li jsinstance="0"> |
| 145 <a href="#H2-0">Introduction</a> |
| 146 <ol> |
| 147 <li jsinstance="*0" style="display: none; "> |
| 148 <a>h3Name</a> |
| 149 </li> |
| 150 </ol> |
| 151 </li><li jsinstance="*1"> |
| 152 <a href="#H2-1">Overview</a> |
| 153 <ol> |
| 154 <li jsinstance="0"> |
| 155 <a href="#H3-2">Update URL</a> |
| 156 </li><li jsinstance="1"> |
| 157 <a href="#H3-3">Update Manifest</a> |
| 158 </li><li jsinstance="2"> |
| 159 <a href="#H3-4">Testing</a> |
| 160 </li><li jsinstance="3"> |
| 161 <a href="#H3-5">Advanced Usage : Request Parameters</a> |
| 162 </li><li jsinstance="*4"> |
| 163 <a href="#H3-6">Advanced Usage : Minimum Browser Version</a> |
| 164 </li> |
| 165 </ol> |
| 166 </li> |
| 167 <div style="display: none; "> |
| 168 <li> |
| 169 <a href="#apiReference">API reference</a> |
| 170 <ol> |
| 171 <li> |
| 172 <a href="#properties">Properties</a> |
| 173 <ol> |
| 174 <li> |
| 175 <a href="#property-anchor">propertyName</a> |
| 176 </li> |
| 177 </ol> |
| 178 </li> |
| 179 <li> |
| 180 <a href="#methods">Methods</a> |
| 181 <ol> |
| 182 <li> |
| 183 <a href="#method-anchor">methodName</a> |
| 184 </li> |
| 185 </ol> |
| 186 </li> |
| 187 <li> |
| 188 <a href="#events">Events</a> |
| 189 <ol> |
| 190 <li> |
| 191 <a href="#event-anchor">eventName</a> |
| 192 </li> |
| 193 </ol> |
| 194 </li> |
| 195 <li> |
| 196 <a href="#types">Types</a> |
| 197 <ol> |
| 198 <li> |
| 199 <a href="#id-anchor">id</a> |
| 200 </li> |
| 201 </ol> |
| 202 </li> |
| 203 </ol> |
| 204 </li> |
| 205 </div> |
| 206 </ol> |
| 207 </div> |
| 208 <!-- /TABLE OF CONTENTS --> |
| 209 |
| 210 <!-- STATIC CONTENT PLACEHOLDER --> |
| 211 <div id="static"><div id="pageData-title" class="pageData">AutoUpdate</d
iv> |
| 212 <div id="pageData-showTOC" class="pageData">true</div> |
| 213 <a name="H2-0"></a><h2>Introduction</h2> |
| 214 <p>We want extensions to be autoupdated for some of the same reasons as chrome i
tself: to incorporate bug and security fixes, add new features or performance en
hancements, and improve user interfaces.</p> |
| 215 |
| 216 <p>For extensions packaged and distributed via the extensions gallery, developer
s will be able to use a web interface to release updated versions of their exten
sions and do not need to concern themselves with the rest of this document.</p> |
| 217 |
| 218 <p>Those who choose to host extensions themselves instead of using the gallery w
ill probably want to use autoupdate for their extensions as described below. You
might want to make sure you are familiar with <a href="packaging.html">Packagin
g</a> first.</p> |
| 219 |
| 220 |
| 221 <a name="H2-1"></a><h2>Overview</h2> |
| 222 <ul><li>An extension manifest may contain an "update_url" for doing update check
s.</li> |
| 223 <li>The content returned by an update check is an "update manifest" xml document
listing the latest version of an extension (or set of extensions, more on that
later).</li></ul> |
| 224 |
| 225 <p>Every few hours, the browser will check if any installed extensions have an a
utoupdate url. For each one, it will make a request to that url looking for an u
pdate manifest xml file. If the update manifest mentions a version of an extensi
on that is more recent than what's installed, it will download and install the n
ew version. Similar to manual updates, the new crx must be signed with the same
private key as the currently installed version.</p> |
| 226 |
| 227 |
| 228 <a name="H3-2"></a><h3>Update URL</h3> |
| 229 <p>For those who are hosting their own extensions, you need to add the "update_u
rl" key to your manifest.json file like this:</p> |
| 230 <pre>{ |
| 231 "name": "Test Extension", |
| 232 "version": "1.0", |
| 233 "description": "My test extension", |
| 234 <b>"update_url": "http://myhost.com/mytestextension/updates.xml"</b>, |
| 235 "toolstrips": ["mytoolstrip.html"] |
| 236 } |
| 237 </pre> |
| 238 |
| 239 <a name="H3-3"></a><h3>Update Manifest</h3> |
| 240 <p>The "update manifest" returned by the server should be an xml document t
hat looks like this (parts you'll want to modify highlighted):</p> |
| 241 |
| 242 <pre><?xml version='1.0' encoding='UTF-8'?> |
| 243 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> |
| 244 <app appid='<b>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</b>'> |
| 245 <updatecheck codebase='<b>http://myhost.com/mytestextension/mte
_v2.crx</b>' version='<b>2.0</b>' /> |
| 246 </app> |
| 247 </gupdate> |
| 248 </pre> |
| 249 |
| 250 <p>(This xml format is borrowed from that used by Omaha, Google's update infrast
ructure. See <a href="http://code.google.com/p/omaha/">http://code.google.com/p/
omaha/</a> for more details.)</p> |
| 251 |
| 252 <p><b>appid</b><br> |
| 253 The 'appid' property is the extension id, generated based on a hash of the exten
sion's public key as described in <a href="packaging.html">Packaging</a>. You ca
n find out the id of your extension by going to chrome://extensions/ in a chrome
browser where you have the extension installed.</p> |
| 254 |
| 255 <p><b>codebase</b><br> |
| 256 The 'codebase' property is a url to the crx file.</p> |
| 257 |
| 258 <p><b>version</b><br> |
| 259 This is used by the client to determine whether it should download the crx file
at 'codebase'. It should match the version parameter in the crx file's manifest.
json file.</p> |
| 260 <p>The update manifest xml file may contain information about multiple extension
s by including multiple <code><app></code> tags.</p> |
| 261 |
| 262 |
| 263 <a name="H3-4"></a><h3>Testing</h3> |
| 264 <p>The default update check frequency is several hours, which obviously makes te
sting challenging. To overcome this, you can use the --extensions-update-frequen
cy command line flag to set a more frequent interval in seconds. For instance, t
o make checks run every 45 seconds, you would run chrome like this:</p> |
| 265 <pre>chrome.exe <b>--extensions-update-frequency=45</b></pre> |
| 266 |
| 267 <p>Note that this affects checks for all installed extensions, so consider the b
andwidth and server load implications of this. You may want to temporarily unins
tall all but the one extension you are testing with, and should not run with thi
s option turned on during normal browser usage. In the future we may remove this
command flag and replace it with a different mechanism to trigger update checks
for testing (perhaps a button on the chrome://extensions page). Star the follow
ing issue to receive updates: <a href="http://crbug.com/17853" rel="nofollow">ht
tp://crbug.com/17853</a>.</p> |
| 268 |
| 269 <p><b>Addendum:</b> the "Update now" button has been added, and will be present
in dev channel builds soon (likely 4.0.207.x and above).</p> |
| 270 |
| 271 |
| 272 <a name="H3-5"></a><h3>Advanced Usage : Request Parameters</h3> |
| 273 <p>The basic autoupdate mechanism is designed to make the server-side work as ea
sy as just dropping a static xml file onto any plain webserver such as apache, a
nd updating that xml file as you release new versions of your extension(s).</p> |
| 274 <p>More advanced developers may wish to take advantage of the fact that we add o
n parameters to the request for the update manifest to indicate the extension id
and version. Then they can use the same update_url for all of their extensions
pointing to a url running dynamic server side code instead of a static xml file.
</p> |
| 275 <p>The format of the request parameters is:</p> |
| 276 <p><code> ?x=<extension_data></code></p> |
| 277 <p>where <code><extension_data></code> is an url-encoded string of the for
mat:</p> |
| 278 <p><code> id=<id>&v=<version></code></p> |
| 279 |
| 280 <p>So for example, say we have two extensions installed</p> |
| 281 <p> Extension 1 with id "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" and versio
n "1.1"<br> |
| 282 Extension 2 with id "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" and version "
0.4"</p> |
| 283 |
| 284 <p>and that both point at the same update_url: <code>http://test.com/extension_u
pdates.php</code></p> |
| 285 |
| 286 <p>The two requests made would be:</p> |
| 287 <code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaa%26v%3D1.1</code> |
| 288 <br> |
| 289 <code>http://test.com/extension_updates.php?x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbb%26v%3D0.4</code> |
| 290 |
| 291 <p><b>Note</b>: in releases before 3.0.196.x there was a bug in how request para
meters were put together (<a href="http://crbug.com/17469" rel="nofollow">http:/
/crbug.com/17469</a>).</p> |
| 292 |
| 293 <h4>Future work for Request Parameters</h4> |
| 294 <p>While not implemented yet, we will eventually list multiple extensions in a s
ingle request for each unique update_url. For the above example, the request wou
ld end up being:</p> |
| 295 <p><code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaa%26v%3D1.1&x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb%26v%3D0.4</code></p
> |
| 296 |
| 297 <p>If the number of installed extensions using the same update_url is large enou
gh that a GET request url would be too long (probably greater than 1024 characte
rs or so), the update check will instead issue a POST with the request parameter
s in the POST body.</p> |
| 298 |
| 299 |
| 300 <a name="H3-6"></a><h3>Advanced Usage : Minimum Browser Version</h3> |
| 301 <p>As we add more API's to the extensions system, it's possible you will want to
release an updated version of an extension that will only work with newer versi
ons of the chrome browser. While chrome itself is autoupdated, it can take a few
days before the majority of the userbase has updated to any given new release.
To ensure that a given extension update will only apply to chrome version at or
higher than a specific version, you would add the prodversionmin parameter to th
e <code><app></code> tag in your update manifest. For example:</p> |
| 302 |
| 303 <pre><?xml version='1.0' encoding='UTF-8'?> |
| 304 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> |
| 305 <app appid='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'> |
| 306 <updatecheck codebase='http://myhost.com/mytestextens
ion/mte_v2.crx' version='2.0' <b>prodversionmin='3.0.193.0'</b>/> |
| 307 </app> |
| 308 </gupdate> |
| 309 </pre> |
| 310 |
| 311 <p>This would ensure that users of this extension would only autoupdate to versi
on 2 if they are running chrome 3.0.193.0 or greater.</p> |
| 312 |
| 313 </div> |
| 314 |
| 315 <!-- API PAGE --> |
| 316 <div class="apiPage" style="display: none; "> |
| 317 <a name="apiReference"></a> |
| 318 <h2>API reference: chrome.apiname </h2> |
| 319 |
| 320 <!-- PROPERTIES --> |
| 321 <div class="apiGroup"> |
| 322 <a name="properties"></a> |
| 323 <h3 id="properties">Properties</h3> |
| 324 |
| 325 <div> |
| 326 <a></a> |
| 327 <h4>getLastError</h4> |
| 328 <div class="summary"> |
| 329 <!-- Note: intentionally longer 80 columns --> |
| 330 <span>chrome.extension</span><span>lastError</span> |
| 331 </div> |
| 332 <div> |
| 333 </div> |
| 334 </div> |
| 335 |
| 336 </div> <!-- /apiGroup --> |
| 337 |
| 338 <!-- METHODS --> |
| 339 <div class="apiGroup" id="methods"> |
| 340 <a name="methods"></a> |
| 341 <h3>Methods</h3> |
| 342 |
| 343 <!-- iterates over all functions --> |
| 344 <div class="apiItem"> |
| 345 <a></a> <!-- method-anchor --> |
| 346 <h4>method name</h4> |
| 347 |
| 348 <div class="summary"><span>void</span> |
| 349 <!-- Note: intentionally longer 80 columns --> |
| 350 <span>chrome.module.methodName</span>(<span><span>, </span><sp
an></span> |
| 351 <var><span></span></var></span>)</div> |
| 352 |
| 353 <div class="description"> |
| 354 <p class="todo">Undocumented.</p> |
| 355 <p> |
| 356 A description from the json schema def of the function goes he
re. |
| 357 </p> |
| 358 |
| 359 <!-- PARAMETERS --> |
| 360 <h4>Parameters</h4> |
| 361 <dl> |
| 362 <div> |
| 363 <div> |
| 364 </div> |
| 365 </div> |
| 366 </dl> |
| 367 |
| 368 <!-- RETURNS --> |
| 369 <h4>Returns</h4> |
| 370 <dl> |
| 371 <div> |
| 372 <div> |
| 373 </div> |
| 374 </div> |
| 375 </dl> |
| 376 |
| 377 <!-- CALLBACK --> |
| 378 <div> |
| 379 <div> |
| 380 <h4>Callback function</h4> |
| 381 <p> |
| 382 If you specify the <em>callback</em> parameter, |
| 383 it should specify a function that looks like this: |
| 384 </p> |
| 385 |
| 386 <!-- Note: intentionally longer 80 columns --> |
| 387 <pre>function(<span>Type param1, Type param2</span>) <span cla
ss="subdued">{...}</span>);</pre> |
| 388 <dl> |
| 389 <div> |
| 390 <div> |
| 391 </div> |
| 392 </div> |
| 393 </dl> |
| 394 </div> |
| 395 </div> |
| 396 |
| 397 </div> <!-- /description --> |
| 398 |
| 399 </div> <!-- /apiItem --> |
| 400 |
| 401 </div> <!-- /apiGroup --> |
| 402 |
| 403 <!-- EVENTS --> |
| 404 <div class="apiGroup"> |
| 405 <a name="events"></a> |
| 406 <h3 id="events">Events</h3> |
| 407 |
| 408 <!-- iterates over all events --> |
| 409 <div class="apiItem"> |
| 410 <a></a> |
| 411 <h4>event name</h4> |
| 412 |
| 413 <div class="summary"> |
| 414 <!-- Note: intentionally longer 80 columns --> |
| 415 <span class="subdued">chrome.bookmarks</span><span>onEvent</span
><span class="subdued">.addListener</span>(function(<span>Type param1, Type para
m2</span>) <span class="subdued">{...}</span>); |
| 416 </div> |
| 417 |
| 418 <div class="description"> |
| 419 <p class="todo">Undocumented.</p> |
| 420 <p> |
| 421 A description from the json schema def of the event goes here. |
| 422 </p> |
| 423 |
| 424 <!-- PARAMETERS --> |
| 425 <h4>Parameters</h4> |
| 426 <dl> |
| 427 <div> |
| 428 <div> |
| 429 </div> |
| 430 </div> |
| 431 </dl> |
| 432 |
| 433 </div> <!-- /decription --> |
| 434 |
| 435 </div> <!-- /apiItem --> |
| 436 |
| 437 </div> <!-- /apiGroup --> |
| 438 |
| 439 <!-- TYPES --> |
| 440 <div class="apiGroup"> |
| 441 <a name="types.sort(sortByName)"></a> |
| 442 <h3 id="types">Types</h3> |
| 443 |
| 444 <!-- iterates over all types --> |
| 445 <div class="apiItem"> |
| 446 <a></a> |
| 447 <h4>type name</h4> |
| 448 |
| 449 <div> |
| 450 </div> |
| 451 |
| 452 </div> <!-- /apiItem --> |
| 453 |
| 454 </div> <!-- /apiGroup --> |
| 455 |
| 456 </div> <!-- /apiPage --> |
| 457 </div> <!-- /mainColumn --> |
| 458 </div> <!-- /pageContent --> |
| 459 <div id="pageFooter" --=""> |
| 460 <p> |
| 461 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
">noted</a>, |
| 462 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/">Creative Commons |
| 463 Attribution 3.0 License</a>, and code samples are licensed under the |
| 464 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic
ense</a>. |
| 465 </p> |
| 466 <p> |
| 467 ©2009 Google |
| 468 </p> |
| 469 </div> <!-- /pageFooter --> |
| 470 </div> <!-- /container --> |
| 471 </body></html> |
| 472 |
OLD | NEW |