blob: a72b22fb5209f4340e527d5da5918c805f96e477 [file] [log] [blame] [view]
waffles51732142016-07-28 23:48:441# Component Updater
2
3## Overview
4The Component Updater is a piece of Chrome responsible for updating other pieces
5of Chrome. It runs in the browser process and communicates with a set of servers
6using the [Omaha](https://github.com/google/omaha) protocol to find the latest
7versions of components, download them, and register them with the rest of
8Chrome.
9
10The primary benefit of components is that they can be updated without an update
11to Chrome itself, which allows them to have faster (or desynchronized) release
12cadences, lower bandwidth consumption, and avoids bloat in the (already sizable)
13Chrome installer. The primary drawback is that they require Chrome to tolerate
14their absence in a sane way.
15
16In the normal configuration, the component updater registers all components
17during (or close to) browser start-up, and then begins checking for updates six
18minutes later, with substantial pauses between successive update application.
19
20## Terminology
21For the purposes of this document:
22
23 * A `component` is any element of Chrome's core functionality that is sometimes
24 delivered by the component updater separately from the browser itself,
25 usually as a dynamically-linked library or data file.
26 * A `crx file` is any file in the
27 [CRX package format](https://developer.chrome.com/extensions/crx).
28
29## Adding New Components
30This document covers the work that must be done on the client side. Additional
31work is necessary to integrate with the Omaha servers, and is covered in
32[Google-internal documentation](http://go/newchromecomponent).
33
34This assumes you've already done the hard work of splitting your functionality
35out into a dynamically-linked library or data file.
36
37### Create a CRX Package Signing Key & Manifest (Non-Google)
38All components are delivered as CRX files (signed ZIP archives). You need to
39create a signing key. If you are a Googler, follow the instructions at
David Benjamin2c77ed712019-03-07 18:21:1140http://go/newchromecomponent for maximum key security. Otherwise, you can
waffles51732142016-07-28 23:48:4441create an RSA key pair using `openssl` or a similar tool.
42
43You will additionally need to create a manifest.json file. If nothing else, the
44manifest file must specify the component's version and name. If you plan to
45release the component using Google infrastructure, this file can be generated
46for you automatically.
47
48### Writing an Installer
49The "installer" is a piece of Chrome code that the component updater will run to
50install or update the component. Installers live at
51`src/chrome/browser/component_updater`.
52
53You will need the SHA256 hash of the public key generated in the previous step,
54as well as the CRX ID, which consists of the first half (128 bits) of that hash,
55rendered as hexadecimal using the characters `a-p` (rather than `0-9a-f`).
56
57New components should use
Sorin Jianu08f92b3c2017-09-25 16:17:1258[`component_installer`](component_installer.h)
waffles51732142016-07-28 23:48:4459if possible, as this provides you with transparent differential updates, version
Sorin Jianu08f92b3c2017-09-25 16:17:1260management, and more. You must provide a `ComponentInstallerPolicy` object to
61a new `ComponentInstaller`.
waffles51732142016-07-28 23:48:4462[file\_type\_policies\_component\_installer.cc](../../chrome/browser/component_updater/file_type_policies_component_installer.cc)
63is a good example to work from.
64
65Components need to be registered with the component updater. This is done in
66[RegisterComponentsForUpdate](https://cs.chromium.org/chromium/src/chrome/browser/chrome_browser_main.cc).
67
68### Bundle with the Chrome Installer (Optional)
69If you need the guarantee that some implementation of your component is always
70available, you must bundle a component implementation with the browser itself.
Sorin Jianu08f92b3c2017-09-25 16:17:1271If you are using `ComponentInstaller`, you simply need to make sure that
waffles51732142016-07-28 23:48:4472your component implementation (and a corresponding manifest.json file) are
73written to DIR\_COMPONENTS as part of the build. The manifest.json file must
74state the version of this component implementation, and the files must be
75bitwise identical to the contents of any update CRX with that version for that
76platform, as the system will attempt to apply differential updates over these
77files.
78
79### Implement On-Demand or Just-In-Time Updates (Optional)
80Contact the component\_updater OWNERS.