Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: chrome/common/extensions/docs/templates/articles/activeTab.html

Issue 219213007: Remove .html extension from links (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <style> 1 <style>
2 #active-tab-images { 2 #active-tab-images {
3 margin-top: 1em; 3 margin-top: 1em;
4 } 4 }
5 #active-tab-images tr { 5 #active-tab-images tr {
6 vertical-align: top; 6 vertical-align: top;
7 } 7 }
8 #active-tab-images .spacing { 8 #active-tab-images .spacing {
9 width: 1em; 9 width: 1em;
10 } 10 }
11 #active-tab-before { 11 #active-tab-before {
12 width: 334px; 12 width: 334px;
13 } 13 }
14 #active-tab-after { 14 #active-tab-after {
15 width: 334px; 15 width: 334px;
16 } 16 }
17 </style> 17 </style>
18 18
19 <h1>The activeTab permission</h1> 19 <h1>The activeTab permission</h1>
20 20
21 <p> 21 <p>
22 The <code>activeTab</code> permission gives an extension temporary access to the currently active tab when the user <em>invokes</em> the extension - for example by clicking its <a href="browserAction.html">browser action</a>. Access to the tab lasts until the tab is navigated or closed. 22 The <code>activeTab</code> permission gives an extension temporary access to the currently active tab when the user <em>invokes</em> the extension - for example by clicking its <a href="browserAction">browser action</a>. Access to the tab l asts until the tab is navigated or closed.
23 </p> 23 </p>
24 24
25 <p> 25 <p>
26 This serves as an alternative for many uses of <code>&lt;all_urls&gt;</code>, bu t displays <em>no warning message</em> during installation: 26 This serves as an alternative for many uses of <code>&lt;all_urls&gt;</code>, bu t displays <em>no warning message</em> during installation:
27 </p> 27 </p>
28 28
29 <table id="active-tab-images" class="simple"> 29 <table id="active-tab-images" class="simple">
30 <tr> 30 <tr>
31 <th>Without activeTab</th> 31 <th>Without activeTab</th>
32 <th class="spacing"></th> 32 <th class="spacing"></th>
33 <th>With activeTab</th> 33 <th>With activeTab</th>
34 </tr> 34 </tr>
35 <tr> 35 <tr>
36 <td><img id="active-tab-before" src="{{static}}/images/active-tab-before.png "></td> 36 <td><img id="active-tab-before" src="{{static}}/images/active-tab-before.png "></td>
37 <td class="spacing"></td> 37 <td class="spacing"></td>
38 <td><img id="active-tab-after" src="{{static}}/images/active-tab-after.png"> </td> 38 <td><img id="active-tab-after" src="{{static}}/images/active-tab-after.png"> </td>
39 </tr> 39 </tr>
40 </table> 40 </table>
41 41
42 <h2 id="example">Example</h2> 42 <h2 id="example">Example</h2>
43 43
44 <p> 44 <p>
45 See the <a href="samples.html#page-redder">Page Redder</a> sample extension: 45 See the <a href="samples#page-redder">Page Redder</a> sample extension:
46 </p> 46 </p>
47 47
48 <pre data-filename="manifest.json"> 48 <pre data-filename="manifest.json">
49 { 49 {
50 "name": "Page Redder", 50 "name": "Page Redder",
51 "version": "2.0", 51 "version": "2.0",
52 <b>"permissions": [ 52 <b>"permissions": [
53 "activeTab" 53 "activeTab"
54 ],</b> 54 ],</b>
55 "background": { 55 "background": {
(...skipping 14 matching lines...) Expand all
70 console.log('Turning ' + tab.url + ' red!'); 70 console.log('Turning ' + tab.url + ' red!');
71 chrome.tabs.executeScript({ 71 chrome.tabs.executeScript({
72 code: 'document.body.style.backgroundColor="red"' 72 code: 'document.body.style.backgroundColor="red"'
73 }); 73 });
74 }); 74 });
75 </pre> 75 </pre>
76 76
77 <h2 id="motivation">Motivation</h2> 77 <h2 id="motivation">Motivation</h2>
78 78
79 <p> 79 <p>
80 Consider a web clipping extension that has a <a href="browserAction.html">browse r action</a> and <a href="contextMenus.html">context menu item</a>. This extensi on may only really need to access tabs when its browser action is clicked, or wh en its context menu item is executed. 80 Consider a web clipping extension that has a <a href="browserAction">browser act ion</a> and <a href="contextMenus">context menu item</a>. This extension may onl y really need to access tabs when its browser action is clicked, or when its con text menu item is executed.
81 </p> 81 </p>
82 82
83 <p> 83 <p>
84 Without <code>activeTab</code>, this extension would need to request full, persi stent access to every web site, just so that it could do its work if it happened to be called upon by the user. This is a lot of power to entrust to such a simp le extension. And if the extension is ever compromised, the attacker gets access to everything the extension had. 84 Without <code>activeTab</code>, this extension would need to request full, persi stent access to every web site, just so that it could do its work if it happened to be called upon by the user. This is a lot of power to entrust to such a simp le extension. And if the extension is ever compromised, the attacker gets access to everything the extension had.
85 </p> 85 </p>
86 86
87 <p> 87 <p>
88 In contrast, an extension with the <code>activeTab</code> permission only obtain s access to a tab in response to an explicit user gesture. If the extension is c ompromised the attacker would need to wait for the user to invoke the extension before obtaining access. And that access only lasts until the tab is navigated o r closed. 88 In contrast, an extension with the <code>activeTab</code> permission only obtain s access to a tab in response to an explicit user gesture. If the extension is c ompromised the attacker would need to wait for the user to invoke the extension before obtaining access. And that access only lasts until the tab is navigated o r closed.
89 </p> 89 </p>
90 90
91 <h2 id="what-activeTab-allows">What activeTab allows</h2> 91 <h2 id="what-activeTab-allows">What activeTab allows</h2>
92 92
93 <p> 93 <p>
94 While the <code>activeTab</code> permission is enabled for a tab, an extension c an: 94 While the <code>activeTab</code> permission is enabled for a tab, an extension c an:
95 <ul> 95 <ul>
96 <li>Call <code>$(ref:tabs.executeScript)</code> or <code>$(ref:tabs.insertCSS) </code> on that tab. 96 <li>Call <code>$(ref:tabs.executeScript)</code> or <code>$(ref:tabs.insertCSS) </code> on that tab.
97 <li>Get the URL, title, and favicon for that tab via an API that returns a <co de>$(ref:tabs.Tab)</code> object (essentially, <code>activeTab</code> grants the <code><a href="tabs.html#manifest">tabs</a></code> permission temporarily). 97 <li>Get the URL, title, and favicon for that tab via an API that returns a <co de>$(ref:tabs.Tab)</code> object (essentially, <code>activeTab</code> grants the <code><a href="tabs#manifest">tabs</a></code> permission temporarily).
98 </ul> 98 </ul>
99 </p> 99 </p>
100 100
101 <h2 id="invoking-activeTab">Invoking activeTab</h2> 101 <h2 id="invoking-activeTab">Invoking activeTab</h2>
102 102
103 <p> 103 <p>
104 The following user gestures enable <code>activeTab</code>: 104 The following user gestures enable <code>activeTab</code>:
105 <ul> 105 <ul>
106 <li>Executing a <a href="browserAction.html">browser action</a> 106 <li>Executing a <a href="browserAction">browser action</a>
107 <li>Executing a <a href="pageAction.html">page action</a> 107 <li>Executing a <a href="pageAction">page action</a>
108 <li>Executing a <a href="contextMenus.html">context menu item</a> 108 <li>Executing a <a href="contextMenus">context menu item</a>
109 <li>Executing a keyboard shortcut from the <a href="commands.html">commands AP I</a> 109 <li>Executing a keyboard shortcut from the <a href="commands">commands API</a>
110 <li>Accepting a suggestion from the <a href="omnibox.html">omnibox API</a> 110 <li>Accepting a suggestion from the <a href="omnibox">omnibox API</a>
111 </ul> 111 </ul>
112 </p> 112 </p>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698