Google Chrome Extensions: Platform Design


Uploaded by GoogleDevelopers on 07.12.2009

Transcript:
Hi I'm Aaron, a programmer working on Google Chrome's extension system.
When we started this project, we had 3 main goals:
1. It should be incredibly easy to build an extension.
We think the easier extensions are to build, the more of them there will be.
2. The extension system should reuse web technologies.
This helps make extensions easy to build because many programmers already know web technologies.
3. Extensions shouldn't crash your browser, and if they slow it down you should be able
to find out which extension is responsible and stop it.
In this video, I'm going to give an overview of the design of the core extension system,
and talk about how it helps to meet these objectives.
A Google Chrome extension is basically a zip file containing a collection of HTML files,
JavaScript, and other web resources like CSS and images.
These zip files are named with the "crx" suffix by convention.
When an extension is loaded into Google Chrome, all of its contents are accessible under a
special URL:
And just like with web pages, you can use relative paths to refer to resources.
This basic setup provides a number of advantages:
Because we use the extension's ID as the host, each extension gets its own unique origin.
Origins are a key part of the web security model, and reusing them gives us a well-tested
way to keep extensions separate from each other, from web pages, and from the browser.
Since extensions are just web pages, Google Chrome runs them in subprocesses, just like
it does for web pages.
So if one extension is misbehaving you can see that in the task manager and disable it.
Also if one extension crashes, it won't take down any other extensions or your browser.
Just like web pages, Google Chrome runs extensions in a sandbox.
This helps protect against malicious web pages on the internet that might try and abuse an
extension to exploit your system.
Finally, and most fun, because extensions are web pages, developers get to use all of
the APIs that come with the web platform, from XHR to the DOM and CSS, to local storage.
Everything that works on the web works for extensions, too.
In fact, since extensions only need to run in Google Chrome, developers can use cutting-edge
new features that aren't yet available in other browsers.
Web pages are used in many parts of the extension system.
The most important of these is a special page called the "background page".
The background page is just a normal HTML file, but it runs invisibly, "in the background"
of your extension.
This is a good place to put all the core logic of your extension, and any state that you
need to keep in memory while your extension is running.
Web pages are also used to show most pieces of the UI in an extension.
For example, the contents of browser and page action popups are implemented using HTML.
We've designed the extension system to rely heavily on HTML, so that you can reuse your
web development skills.
You can build your first extension in five minutes.
To learn more visit our website at code.google.com/chrome/extensions