1 <h2 id="manifest">Manifest</h2> 2 <p> 3 When requested, a <code>$(ref:windows.Window)</code> 4 will contain an array of <code>$(ref:tabs.Tab)</code> objects. 5 6 You must declare the <code>"tabs"</code> permission in your 7 <a href="manifest">manifest</a> if you require access to the 8 <code>$(ref:tabs.Tab.url url)</code>, 9 <code>$(ref:tabs.Tab.title title)</code>, or 10 <code>$(ref:tabs.Tab.favIconUrl favIconUrl)</code> properties of 11 <code>$(ref:tabs.Tab)</code>. 12 For example: 13 </p> 14 15 <pre data-filename="manifest.json"> 16 { 17 "name": "My extension", 18 ... 19 <b>"permissions": ["tabs"]</b>, 20 ... 21 } 22 </pre> 23 24 <h2 id="current-window">The current window</h2> 25 26 <p>Many functions in the extension system 27 take an optional <var>windowId</var> parameter, 28 which defaults to the current window. 29 </p> 30 31 <p>The <em>current window</em> is the window that 32 contains the code that is currently executing. 33 It's important to realize that this can be 34 different from the topmost or focused window. 35 </p> 36 37 <p>For example, say an extension 38 creates a few tabs or windows from a single HTML file, 39 and that the HTML file 40 contains a call to 41 $(ref:tabs.query). 42 The current window is the window that contains the page that made 43 the call, no matter what the topmost window is. 44 </p> 45 46 <p>In the case of the <a href="event_pages">event page</a>, 47 the value of the current window falls back to the last active window. Under some 48 circumstances, there may be no current window for background pages. 49 </p> 50 51 <h2 id="examples"> Examples </h2> 52 53 <p> 54 <img src="{{static}}/images/windows.png" 55 width="561" height="224" alt="Two windows, each with one tab" /> 56 <br> 57 You can find simple examples of using the windows module in the 58 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/windows/">examples/api/windows</a> 59 directory. 60 Another example is in the 61 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/tabs/inspector/tabs_api.html?content-type=text/plain">tabs_api.html</a> file 62 of the 63 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/tabs/inspector/">inspector</a> 64 example. 65 For other examples and for help in viewing the source code, see 66 <a href="samples">Samples</a>. 67 </p> 68