| OLD | NEW |
| 1 <div id="pageData-name" class="pageData">Overview</div> | 1 <h1>Overview</h1> |
| 2 <div id="pageData-showTOC" class="pageData">true</div> | 2 |
| 3 | 3 |
| 4 <p> | 4 <p> |
| 5 Once you've finished this page | 5 Once you've finished this page |
| 6 and the | 6 and the |
| 7 <a href="getstarted.html">Getting Started</a> tutorial, | 7 <a href="getstarted.html">Getting Started</a> tutorial, |
| 8 you'll be all set to start writing extensions and packaged apps. | 8 you'll be all set to start writing extensions and packaged apps. |
| 9 </p> | 9 </p> |
| 10 | 10 |
| 11 <p class="caution"> | 11 <p class="caution"> |
| 12 <strong>Note:</strong> | 12 <strong>Note:</strong> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 Each extension can have at most one browser action or page action. | 47 Each extension can have at most one browser action or page action. |
| 48 Choose a <b>browser action</b> when the extension is relevant to most pages. | 48 Choose a <b>browser action</b> when the extension is relevant to most pages. |
| 49 Choose a <b>page action</b> when the extension's icon | 49 Choose a <b>page action</b> when the extension's icon |
| 50 should appear or disappear, | 50 should appear or disappear, |
| 51 depending on the page. | 51 depending on the page. |
| 52 </p> | 52 </p> |
| 53 | 53 |
| 54 <table class="columns"> | 54 <table class="columns"> |
| 55 <tr> | 55 <tr> |
| 56 <td width="33%"> | 56 <td width="33%"> |
| 57 <img src="../images/overview/browser-action.png" | 57 <img src="{{static}}/images/overview/browser-action.png" |
| 58 width="147" height="100" | 58 width="147" height="100" |
| 59 alt="screenshot" /> | 59 alt="screenshot" /> |
| 60 </td> | 60 </td> |
| 61 <td width="33%"> | 61 <td width="33%"> |
| 62 <img src="../images/overview/page-action.png" | 62 <img src="{{static}}/images/overview/page-action.png" |
| 63 width="147" height="100" | 63 width="147" height="100" |
| 64 alt="screenshot" /> | 64 alt="screenshot" /> |
| 65 </td> | 65 </td> |
| 66 <td> | 66 <td> |
| 67 <img src="../images/overview/browser-action-with-popup.png" | 67 <img src="{{static}}/images/overview/browser-action-with-popup.png" |
| 68 width="147" height="100" | 68 width="147" height="100" |
| 69 alt="screenshot" /> | 69 alt="screenshot" /> |
| 70 </td> | 70 </td> |
| 71 </tr> | 71 </tr> |
| 72 | 72 |
| 73 <tr> | 73 <tr> |
| 74 <td> | 74 <td> |
| 75 This <a href="samples.html#gmail">mail extension</a> | 75 This <a href="samples.html#gmail">mail extension</a> |
| 76 uses a <em>browser action</em> | 76 uses a <em>browser action</em> |
| 77 (icon in the toolbar). | 77 (icon in the toolbar). |
| (...skipping 28 matching lines...) Expand all Loading... |
| 106 | 106 |
| 107 <h3 id="packagedapp-ui">Packaged app UIs</h3> | 107 <h3 id="packagedapp-ui">Packaged app UIs</h3> |
| 108 | 108 |
| 109 <p> | 109 <p> |
| 110 A packaged app usually presents its main functionality using | 110 A packaged app usually presents its main functionality using |
| 111 an HTML page that's bundled into the app. | 111 an HTML page that's bundled into the app. |
| 112 For example, the following packaged app | 112 For example, the following packaged app |
| 113 displays a Flash file within an HTML page. | 113 displays a Flash file within an HTML page. |
| 114 </p> | 114 </p> |
| 115 | 115 |
| 116 <img src="../images/overview/flash-app.png" | 116 <img src="{{static}}/images/overview/flash-app.png" |
| 117 width="372" height="300" | 117 width="372" height="300" |
| 118 alt="screenshot" /> | 118 alt="screenshot" /> |
| 119 | 119 |
| 120 <p> | 120 <p> |
| 121 For more information, | 121 For more information, |
| 122 see <a href="apps.html">Packaged Apps</a>. | 122 see <a href="apps.html">Packaged Apps</a>. |
| 123 </p> | 123 </p> |
| 124 | 124 |
| 125 <h2 id="files">Files</h2> | 125 <h2 id="files">Files</h2> |
| 126 <p> | 126 <p> |
| 127 Each extension has the following files: | 127 Each extension has the following files: |
| 128 <!-- PENDING: This could use a picture --> | 128 |
| 129 </p> | 129 </p> |
| 130 | 130 |
| 131 <ul> | 131 <ul> |
| 132 <li>A <b>manifest file</b></li> | 132 <li>A <b>manifest file</b></li> |
| 133 <li>One or more <b>HTML files</b> (unless the extension is a theme)</li> | 133 <li>One or more <b>HTML files</b> (unless the extension is a theme)</li> |
| 134 <li><em>Optional:</em> One or more <b>JavaScript files</b></li> | 134 <li><em>Optional:</em> One or more <b>JavaScript files</b></li> |
| 135 <li><em>Optional:</em> Any other files your extension needs—for | 135 <li><em>Optional:</em> Any other files your extension needs—for |
| 136 example, image files</li> | 136 example, image files</li> |
| 137 </ul> | 137 </ul> |
| 138 | 138 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 a browser action (yellow icon) | 266 a browser action (yellow icon) |
| 267 and a page action (blue icon). | 267 and a page action (blue icon). |
| 268 Both the browser action and the page action | 268 Both the browser action and the page action |
| 269 have background pages. | 269 have background pages. |
| 270 This figure shows the browser action's background page, | 270 This figure shows the browser action's background page, |
| 271 which is defined by <code>background.html</code> | 271 which is defined by <code>background.html</code> |
| 272 and has JavaScript code that controls | 272 and has JavaScript code that controls |
| 273 the behavior of the browser action in both windows. | 273 the behavior of the browser action in both windows. |
| 274 </p> | 274 </p> |
| 275 | 275 |
| 276 <img src="../images/overview/arch-1.gif" | 276 <img src="{{static}}/images/overview/arch-1.gif" |
| 277 width="232" height="168" | 277 width="232" height="168" |
| 278 alt="Two windows and a box representing a background page (background.html). On
e window has a yellow icon; the other has both a yellow icon and a blue icon. Th
e yellow icons are connected to the background page." /> | 278 alt="Two windows and a box representing a background page (background.html). On
e window has a yellow icon; the other has both a yellow icon and a blue icon. Th
e yellow icons are connected to the background page." /> |
| 279 | 279 |
| 280 <p> | 280 <p> |
| 281 Although background pages can be useful, | 281 Although background pages can be useful, |
| 282 don't use one if you don't need it. | 282 don't use one if you don't need it. |
| 283 Background pages are always open, | 283 Background pages are always open, |
| 284 so when a user installs many extensions that have background pages, | 284 so when a user installs many extensions that have background pages, |
| 285 Chrome's performance can suffer. | 285 Chrome's performance can suffer. |
| 286 </p> | 286 </p> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 The popup's contents are a web page | 349 The popup's contents are a web page |
| 350 defined by an HTML file | 350 defined by an HTML file |
| 351 (<code>popup.html</code>). | 351 (<code>popup.html</code>). |
| 352 This extension also happens to have a background page | 352 This extension also happens to have a background page |
| 353 (<code>background.html</code>). | 353 (<code>background.html</code>). |
| 354 The popup doesn't need to duplicate code | 354 The popup doesn't need to duplicate code |
| 355 that's in the background page | 355 that's in the background page |
| 356 because the popup can invoke functions on the background page. | 356 because the popup can invoke functions on the background page. |
| 357 </p> | 357 </p> |
| 358 | 358 |
| 359 <img src="../images/overview/arch-2.gif" | 359 <img src="{{static}}/images/overview/arch-2.gif" |
| 360 width="256" height="168" | 360 width="256" height="168" |
| 361 alt="A browser window containing a browser action that's displaying a popup. Th
e popup's HTML file (popup.html) can communicate with the extension's background
page (background.html)." /> | 361 alt="A browser window containing a browser action that's displaying a popup. Th
e popup's HTML file (popup.html) can communicate with the extension's background
page (background.html)." /> |
| 362 | 362 |
| 363 <p> | 363 <p> |
| 364 See <a href="browserAction.html">Browser Actions</a>, | 364 See <a href="browserAction.html">Browser Actions</a>, |
| 365 <a href="options.html">Options</a>, | 365 <a href="options.html">Options</a>, |
| 366 <a href="override.html">Override Pages</a>, | 366 <a href="override.html">Override Pages</a>, |
| 367 and the <a href="#pageComm">Communication between pages</a> section | 367 and the <a href="#pageComm">Communication between pages</a> section |
| 368 for more details. | 368 for more details. |
| 369 </p> | 369 </p> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 394 <p> | 394 <p> |
| 395 Content scripts can read details of the web pages the browser visits, | 395 Content scripts can read details of the web pages the browser visits, |
| 396 and they can make changes to the pages. | 396 and they can make changes to the pages. |
| 397 In the following figure, | 397 In the following figure, |
| 398 the content script | 398 the content script |
| 399 can read and modify | 399 can read and modify |
| 400 the DOM for the displayed web page. | 400 the DOM for the displayed web page. |
| 401 It cannot, however, modify the DOM of its parent extension's background page. | 401 It cannot, however, modify the DOM of its parent extension's background page. |
| 402 </p> | 402 </p> |
| 403 | 403 |
| 404 <img src="../images/overview/arch-3.gif" | 404 <img src="{{static}}/images/overview/arch-3.gif" |
| 405 width="238" height="169" | 405 width="238" height="169" |
| 406 alt="A browser window with a browser action (controlled by background.html) and
a content script (controlled by contentscript.js)." /> | 406 alt="A browser window with a browser action (controlled by background.html) and
a content script (controlled by contentscript.js)." /> |
| 407 | 407 |
| 408 <p> | 408 <p> |
| 409 Content scripts aren't completely cut off from their parent extensions. | 409 Content scripts aren't completely cut off from their parent extensions. |
| 410 A content script can exchange messages with its parent extension, | 410 A content script can exchange messages with its parent extension, |
| 411 as the arrows in the following figure show. | 411 as the arrows in the following figure show. |
| 412 For example, a content script might send a message | 412 For example, a content script might send a message |
| 413 whenever it finds an RSS feed in a browser page. | 413 whenever it finds an RSS feed in a browser page. |
| 414 Or a background page might send a message | 414 Or a background page might send a message |
| 415 asking a content script to change the appearance of its browser page. | 415 asking a content script to change the appearance of its browser page. |
| 416 </p> | 416 </p> |
| 417 | 417 |
| 418 <img src="../images/overview/arch-cs.gif" | 418 <img src="{{static}}/images/overview/arch-cs.gif" |
| 419 width="238" height="194" | 419 width="238" height="194" |
| 420 alt="Like the previous figure, but showing more of the parent extension's files
, as well as a communication path between the content script and the parent exte
nsion." /> | 420 alt="Like the previous figure, but showing more of the parent extension's files
, as well as a communication path between the content script and the parent exte
nsion." /> |
| 421 | 421 |
| 422 <!-- [PENDING: Add overview of message passing.] --> | 422 |
| 423 | 423 |
| 424 <p> | 424 <p> |
| 425 For more information, | 425 For more information, |
| 426 see <a href="content_scripts.html">Content Scripts</a>. | 426 see <a href="content_scripts.html">Content Scripts</a>. |
| 427 </p> | 427 </p> |
| 428 | 428 |
| 429 | 429 |
| 430 <h2 id="apis"> Using the chrome.* APIs </h2> | 430 <h2 id="apis"> Using the chrome.* APIs </h2> |
| 431 | 431 |
| 432 <p> | 432 <p> |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 </p> | 558 </p> |
| 559 | 559 |
| 560 <p> | 560 <p> |
| 561 <iframe title="YouTube video player" width="640" height="390" src="http://www.yo
utube.com/embed/bmxr75CV36A?rel=0" frameborder="0" allowfullscreen></iframe> | 561 <iframe title="YouTube video player" width="640" height="390" src="http://www.yo
utube.com/embed/bmxr75CV36A?rel=0" frameborder="0" allowfullscreen></iframe> |
| 562 </p> | 562 </p> |
| 563 | 563 |
| 564 <h2 id="pageComm">Communication between pages </h2> | 564 <h2 id="pageComm">Communication between pages </h2> |
| 565 | 565 |
| 566 <p> | 566 <p> |
| 567 The HTML pages within an extension often need to communicate. | 567 The HTML pages within an extension often need to communicate. |
| 568 <!-- [PENDING: For example, ...] --> | 568 |
| 569 Because all of an extension's pages | 569 Because all of an extension's pages |
| 570 execute in same process on the same thread, | 570 execute in same process on the same thread, |
| 571 the pages can make direct function calls to each other. | 571 the pages can make direct function calls to each other. |
| 572 </p> | 572 </p> |
| 573 | 573 |
| 574 <p> | 574 <p> |
| 575 To find pages in the extension, use | 575 To find pages in the extension, use |
| 576 <a href="extension.html"><code>chrome.extension</code></a> | 576 <a href="extension.html"><code>chrome.extension</code></a> |
| 577 methods such as | 577 methods such as |
| 578 <code>getViews()</code> and | 578 <code>getViews()</code> and |
| 579 <code>getBackgroundPage()</code>. | 579 <code>getBackgroundPage()</code>. |
| 580 Once a page has a reference to other pages within the extension, | 580 Once a page has a reference to other pages within the extension, |
| 581 the first page can invoke functions on the other pages, | 581 the first page can invoke functions on the other pages, |
| 582 and it can manipulate their DOMs. | 582 and it can manipulate their DOMs. |
| 583 </p> | 583 </p> |
| 584 | 584 |
| 585 <!-- [PENDING: Here's an example of communication between xyz and the background
page. (code example goes here)] --> | 585 |
| 586 | 586 |
| 587 | 587 |
| 588 <h2 id="incognito"> Saving data and incognito mode </h2> | 588 <h2 id="incognito"> Saving data and incognito mode </h2> |
| 589 | 589 |
| 590 <p> | 590 <p> |
| 591 Extensions can save data using | 591 Extensions can save data using |
| 592 the HTML5 <a href="http://dev.w3.org/html5/webstorage/">web storage API</a> | 592 the HTML5 <a href="http://dev.w3.org/html5/webstorage/">web storage API</a> |
| 593 (such as <code>localStorage</code>) | 593 (such as <code>localStorage</code>) |
| 594 or by making server requests that result in saving data. | 594 or by making server requests that result in saving data. |
| 595 Whenever you want to save something, | 595 Whenever you want to save something, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 | 651 |
| 652 <ul> | 652 <ul> |
| 653 <li> <a href="getstarted.html">Tutorial: Getting Started</a> </li> | 653 <li> <a href="getstarted.html">Tutorial: Getting Started</a> </li> |
| 654 <li> <a href="tut_debugging.html">Tutorial: Debugging</a> </li> | 654 <li> <a href="tut_debugging.html">Tutorial: Debugging</a> </li> |
| 655 <li> <a href="devguide.html">Developer's Guide</a> </li> | 655 <li> <a href="devguide.html">Developer's Guide</a> </li> |
| 656 <li> <a href="http://dev.chromium.org/developers/design-documents/extensions/s
amples">Samples</a> </li> | 656 <li> <a href="http://dev.chromium.org/developers/design-documents/extensions/s
amples">Samples</a> </li> |
| 657 <li> <a href="http://www.youtube.com/view_play_list?p=CA101D6A85FE9D4B">Videos
</a>, | 657 <li> <a href="http://www.youtube.com/view_play_list?p=CA101D6A85FE9D4B">Videos
</a>, |
| 658 such as | 658 such as |
| 659 <a href="http://www.youtube.com/watch?v=B4M_a7xejYI&feature=PlayList&p=CA101
D6A85FE9D4B&index=6">Extension Message Passing</a> | 659 <a href="http://www.youtube.com/watch?v=B4M_a7xejYI&feature=PlayList&p=CA101
D6A85FE9D4B&index=6">Extension Message Passing</a> |
| 660 </li> | 660 </li> |
| 661 </ul> | 661 </ul> |
| OLD | NEW |