OLD | NEW |
1 <div id="pageData-name" class="pageData">Optional Permissions</div> | 1 <div id="pageData-name" class="pageData">Optional Permissions</div> |
2 | 2 |
3 <!-- BEGIN AUTHORED CONTENT --> | 3 <!-- BEGIN AUTHORED CONTENT --> |
4 <p id="classSummary"> | 4 <p id="classSummary"> |
5 Use the <code>chrome.permissions</code> module to implement | 5 Use the <code>chrome.permissions</code> module to implement |
6 optional permissions. You can request optional permissions during your | 6 optional permissions. You can request optional permissions during your |
7 extension's regular application flow rather than at install time, so users | 7 extension's regular application flow rather than at install time, so users |
8 understand why the permissions are needed and use only those that are | 8 understand why the permissions are needed and use only those that are |
9 necessary. | 9 necessary. |
10 </p> | 10 </p> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 <li>notifications</li> | 91 <li>notifications</li> |
92 <li>pageCapture</li> | 92 <li>pageCapture</li> |
93 <li>tabs</li> | 93 <li>tabs</li> |
94 <li>topSites</li> | 94 <li>topSites</li> |
95 <li>webNavigation</li> | 95 <li>webNavigation</li> |
96 <li>webRequest</li> | 96 <li>webRequest</li> |
97 <li>webRequestBlocking</li> | 97 <li>webRequestBlocking</li> |
98 </ul> | 98 </ul> |
99 </p> | 99 </p> |
100 | 100 |
101 <p class="note"> | |
102 <b>Version note:</b> This list is correct as of Chrome 17. | |
103 More optional permissions might be allowed in future releases. | |
104 </p> | |
105 | |
106 <h3 id="request"> Step 3: Request optional permissions </h3> | 101 <h3 id="request"> Step 3: Request optional permissions </h3> |
107 <p> | 102 <p> |
108 Request the permissions from within a user gesture using | 103 Request the permissions from within a user gesture using |
109 <code>permissions.request()</code>: | 104 <code>permissions.request()</code>: |
110 <pre> | 105 <pre> |
111 document.querySelector('#my-button').addEventListener('click', function(event) { | 106 document.querySelector('#my-button').addEventListener('click', function(event) { |
112 // Permissions must be requested from inside a user gesture, like a button's | 107 // Permissions must be requested from inside a user gesture, like a button's |
113 // click handler. | 108 // click handler. |
114 chrome.permissions.request({ | 109 chrome.permissions.request({ |
115 permissions: ['tabs'], | 110 permissions: ['tabs'], |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 if (removed) { | 169 if (removed) { |
175 // The permissions have been removed. | 170 // The permissions have been removed. |
176 } else { | 171 } else { |
177 // The permissions have not been removed (e.g., you tried to remove | 172 // The permissions have not been removed (e.g., you tried to remove |
178 // required permissions). | 173 // required permissions). |
179 } | 174 } |
180 }); | 175 }); |
181 </pre> | 176 </pre> |
182 | 177 |
183 <!-- END AUTHORED CONTENT --> | 178 <!-- END AUTHORED CONTENT --> |
OLD | NEW |