| OLD | NEW |
| 1 <!-- BEGIN AUTHORED CONTENT --> | |
| 2 <p id="classSummary"> | 1 <p id="classSummary"> |
| 3 Use the <code>chrome.windows</code> module | 2 Use the <code>chrome.windows</code> module |
| 4 to interact with browser windows. | 3 to interact with browser windows. |
| 5 You can use this module to | 4 You can use this module to |
| 6 create, modify, and rearrange windows in the browser. | 5 create, modify, and rearrange windows in the browser. |
| 7 </p> | 6 </p> |
| 7 |
| 8 <img src="{{static}}/images/windows.png" | 8 <img src="{{static}}/images/windows.png" |
| 9 width="256" height="76" alt="Two windows, each with one tab" /> | 9 width="256" height="76" alt="Two windows, each with one tab" /> |
| 10 |
| 10 <h2 id="manifest">Manifest</h2> | 11 <h2 id="manifest">Manifest</h2> |
| 11 <p> | 12 <p> |
| 12 To use the windows API, | 13 To use the windows API, |
| 13 you must declare the "tabs" permission | 14 you must declare the "tabs" permission |
| 14 in <a href="manifest.html">manifest.json</a>. | 15 in <a href="manifest.html">manifest.json</a>. |
| 15 (No, that isn't a typo — | 16 (No, that isn't a typo — |
| 16 the window and tabs modules interact so closely we | 17 the window and tabs modules interact so closely we |
| 17 decided to just share one permission between them.) | 18 decided to just share one permission between them.) |
| 18 For example: | 19 For example: |
| 19 </p> | 20 </p> |
| 21 |
| 20 <pre>{ | 22 <pre>{ |
| 21 "name": "My extension", | 23 "name": "My extension", |
| 22 ... | 24 ... |
| 23 <b>"permissions": ["tabs"]</b>, | 25 <b>"permissions": ["tabs"]</b>, |
| 24 ... | 26 ... |
| 25 }</pre> | 27 }</pre> |
| 28 |
| 26 <h2 id="current-window">The current window</h2> | 29 <h2 id="current-window">The current window</h2> |
| 30 |
| 27 <p>Many functions in the extension system | 31 <p>Many functions in the extension system |
| 28 take an optional <var>windowId</var> parameter, | 32 take an optional <var>windowId</var> parameter, |
| 29 which defaults to the current window. | 33 which defaults to the current window. |
| 30 </p> | 34 </p> |
| 35 |
| 31 <p>The <em>current window</em> is the window that | 36 <p>The <em>current window</em> is the window that |
| 32 contains the code that is currently executing. | 37 contains the code that is currently executing. |
| 33 It's important to realize that this can be | 38 It's important to realize that this can be |
| 34 different from the topmost or focused window. | 39 different from the topmost or focused window. |
| 35 </p> | 40 </p> |
| 41 |
| 36 <p>For example, say an extension | 42 <p>For example, say an extension |
| 37 creates a few tabs or windows from a single HTML file, | 43 creates a few tabs or windows from a single HTML file, |
| 38 and that the HTML file | 44 and that the HTML file |
| 39 contains a call to | 45 contains a call to |
| 40 <a href="tabs.html#method-getSelected">chrome.tabs.getSelected</a>. | 46 <a href="tabs.html#method-getSelected">chrome.tabs.getSelected</a>. |
| 41 The current window is the window that contains the page that made | 47 The current window is the window that contains the page that made |
| 42 the call, no matter what the topmost window is. | 48 the call, no matter what the topmost window is. |
| 43 </p> | 49 </p> |
| 50 |
| 44 <p>In the case of the <a href="background_pages.html">background page</a>, | 51 <p>In the case of the <a href="background_pages.html">background page</a>, |
| 45 the value of the current window falls back to the last active window. Under some | 52 the value of the current window falls back to the last active window. Under some |
| 46 circumstances, there may be no current window for background pages. | 53 circumstances, there may be no current window for background pages. |
| 47 </p> | 54 </p> |
| 55 |
| 48 <h2 id="examples"> Examples </h2> | 56 <h2 id="examples"> Examples </h2> |
| 57 |
| 49 <p> | 58 <p> |
| 50 You can find simple examples of using the windows module in the | 59 You can find simple examples of using the windows module in the |
| 51 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/windows/">examples/api/windows</a> | 60 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/windows/">examples/api/windows</a> |
| 52 directory. | 61 directory. |
| 53 Another example is in the | 62 Another example is in the |
| 54 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/tabs/inspector/tabs_api.html?content-type=text/plain">tabs_a
pi.html</a> file | 63 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/tabs/inspector/tabs_api.html?content-type=text/plain">tabs_a
pi.html</a> file |
| 55 of the | 64 of the |
| 56 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/tabs/inspector/">inspector</a> | 65 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/tabs/inspector/">inspector</a> |
| 57 example. | 66 example. |
| 58 For other examples and for help in viewing the source code, see | 67 For other examples and for help in viewing the source code, see |
| 59 <a href="samples.html">Samples</a>. | 68 <a href="samples.html">Samples</a>. |
| 60 </p> | 69 </p> |
| 61 <!-- END AUTHORED CONTENT --> | |
| OLD | NEW |