Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: chrome/common/extensions/docs/server2/templates/articles/autoupdate.html

Issue 10832042: Extensions Docs Server: Doc conversion script (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: everything but svn stuff Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <h1>Autoupdating</h1>
2
3
4 <p>We want extensions to be autoupdated for some of the same reasons as Google C hrome itself: to incorporate bug and security fixes, add new features or perform ance enhancements, and improve user interfaces.</p>
5
6 <p>If you publish your extension using the <a href="https://chrome.google.com/we bstore/developer/dashboard">Chrome Developer Dashboard</a>, you can <em>ignore t his page</em>. You can use the dashboard to release updated versions of your ext ension to users, as well as to the Chrome Web Store.</p>
7
8 <p>If you want to host your extension somewhere other than the store, keep readi ng.
9 You should also read <a href="hosting.html">Hosting</a> and
10 <a href="packaging.html">Packaging</a>.</p>
11
12
13 <h2>Overview</h2>
14 <ul><li>An extension manifest may contain an "update_url" field, pointing to a l ocation for doing update checks.</li>
15 <li>The content returned by an update check is an <em>update manifest</em> XML d ocument listing the latest version of an extension.</li></ul>
16
17 <p>Every few hours, the browser checks whether any installed extensions have an update URL. For each one, it makes a request to that URL looking for an update m anifest XML file. If the update manifest mentions a version of an extension that is more recent than what's installed, the browser downloads and installs the ne w version. As with manual updates, the new <code>.crx</code> file must be signed with the same private key as the currently installed version.</p>
18
19
20 <h2>Update URL</h2>
21 <p>If you're hosting your own extension, you need to add the "update_url" field to your <a href="manifest.html"><code>manifest.json</code></a> file,
22 like this:</p>
23
24 <pre>{
25 "name": "My extension",
26 ...
27 <b>"update_url": "http://myhost.com/mytestextension/updates.xml"</b>,
28 ...
29 }
30 </pre>
31
32 <h2>Update manifest</h2>
33 <p>The update manifest returned by the server should be an XML document that loo ks like this (highlights indicate parts you should modify):</p>
34
35 <pre>
36 &lt;?xml version='1.0' encoding='UTF-8'?&gt;
37 &lt;gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'&gt;
38 &lt;app appid='<b>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</b>'&gt;
39 &nbsp;&lt;updatecheck&nbsp;codebase='<b>http://myhost.com/mytestextension/mte _v2.crx</b>'&nbsp;version='<b>2.0</b>' /&gt;
40 &lt;/app&gt;
41 &lt;/gupdate&gt;
42 </pre>
43
44 <p>This XML format is borrowed from that used by Omaha, Google's update infrastr ucture. See <a href="http://code.google.com/p/omaha/">http://code.google.com/p/o maha/</a> for more details.
45 The extensions system uses the following attributes
46 for the <strong>&lt;app></strong>
47 and <strong>&lt;updatecheck></strong> elements of the update manifest:
48 </p>
49
50 <p><b>appid</b><br>
51 The extension ID, generated based on a hash of the extension's public key,
52 as described in <a href="packaging.html">Packaging</a>. You can find the
53 ID of an extension or packaged app by going to the Extensions page (<b>chrome:// extensions</b>).
54
55 Hosted apps, however, are not listed on the Extensions page. You can find the I D of any
56 app using the following steps:
57 </p>
58
59 <ul>
60 <li> Open the app. You can do this by clicking its icon on the New Tab page.</ li>
61 <li> Open the JavaScript console. You can do this by clicking the wrench icon
62 and choosing <b>Tools &gt; JavaScript Console</b>.</li>
63 <li> Enter the following expression into the JavaScript console: <code>chrome. app.getDetails().id</code>
64 <p>The console shows the app's ID as a quoted string.</p>
65 </li>
66 </ul>
67
68 <p><b>codebase</b><br>
69 A URL to the extension's <code>.crx</code> file.</p>
70
71 <p><b>version</b><br>
72 Used by the client to determine whether it should download the <code>.crx</code> file specified by <code>codebase</code>. It should match the value of "version" in the <code>.crx</code> file's <code>manifest.json</code> file.</p>
73 <p>The update manifest XML file may contain information about multiple extension s by including multiple &lt;app&gt; elements.</p>
74
75
76 <h2>Testing</h2>
77 <p>The default update check frequency is several hours,
78 but you can force an update using the Extensions page's
79 <b>Update extensions now</b> button.
80 </p>
81
82 <p>
83 Another option is to use the --extensions-update-frequency command-line flag to set a more frequent interval in seconds. For example, to make checks run every 4 5 seconds, run Google Chrome like this:</p>
84 <pre>
85 chrome.exe <b>--extensions-update-frequency=45</b></pre>
86
87 <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.</p>
88
89
90 <h2>Advanced usage: request parameters</h2>
91 <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 web server such as Apache, and updating that XML file as you release new versions of your extensions.</p>
92 <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>
93 <p>The format of the request parameters is:</p>
94 <p><code>&nbsp;&nbsp;?x=<em>&lt;extension_data&gt;</em></code></p>
95 <p>Where <code><em>&lt;extension_data&gt;</em></code> is a URL-encoded string of the format:</p>
96 <p><code>&nbsp;&nbsp;<em>id=&lt;id&gt;</em>&amp;v=<em>&lt;version&gt;</em></code ></p>
97
98 <p>For example, say you have two extensions,
99 both of which point to the same update URL
100 (<code>http://test.com/extension_updates.php</code>):
101 </p>
102
103 <ul>
104 <li> Extension 1
105 <ul>
106 <li> ID: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" </li>
107 <li> Version: "1.1"</li>
108 </ul>
109 <li> Extension 2
110 <ul>
111 <li> ID: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" </li>
112 <li> Version: "0.4"</li>
113 </ul>
114 </ul>
115
116
117 <p>The request to update each individual extension would be:</p>
118
119 <ul>
120 <li> <code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa%26v%3D1.1</code> </li>
121 <li> <code>http://test.com/extension_updates.php?x=id%3Dbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbb%26v%3D0.4</code> </li>
122 </ul>
123
124 <p>
125 Multiple extensions can be listed in a single request for each unique update URL .
126 For the above example, if a user has both of the extensions installed,
127 then the two requests are merged into a single request:</p>
128 <p><code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaa%26v%3D1.1&amp;x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb%26v%3D0.4</code></p >
129
130 <p>If the number of installed extensions using the same update URL is large enou gh that a GET request URL is too long (over 2000 characters or so), the update c heck issues additional GET requests as necessary.</p>
131
132 <p class="note">
133 <b>Note:</b>
134 In the future, instead of issuing multiple GET requests,
135 a single POST request might be issued
136 with the request parameters in the POST body.
137 </p>
138
139 <h2>Advanced usage: minimum browser version</h2>
140 <p>As we add more APIs to the extensions system, it's possible you will want to release an updated version of an extension that will work only with newer versio ns of the browser. While Google Chrome itself is autoupdated, it can take a few days before the majority of the user base has updated to any given new release. To ensure that a given extension update will apply only to Google Chrome version s at or higher than a specific version, you add the "prodversionmin" attribute t o the &lt;app&gt; element in your update manifest. For example:</p>
141
142 <pre>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
143 &lt;gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'&gt;
144 &nbsp;&nbsp;&lt;app appid='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'&gt;
145 &nbsp;&nbsp; &nbsp;&lt;updatecheck&nbsp;codebase='http://myhost.com/mytestextens ion/mte_v2.crx'&nbsp;version='2.0' <b>prodversionmin='3.0.193.0'</b>/&gt;
146 &nbsp;&nbsp;&lt;/app&gt;
147 &lt;/gupdate&gt;
148 </pre>
149
150 <p>This would ensure that users of this extension would autoupdate to version 2 only if they are running Google Chrome 3.0.193.0 or greater.</p>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698