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