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

Side by Side Diff: chrome/common/extensions/docs/examples/api/contentSettings/popup.html

Issue 8071025: Move contentSettings extension API out of experimental (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script> 4 <script>
5 var incognito; 5 var incognito;
6 var url; 6 var url;
7 7
8 function init() { 8 function init() {
9 chrome.tabs.getSelected(undefined, function(tab) { 9 chrome.tabs.getSelected(undefined, function(tab) {
10 incognito = tab.incognito; 10 incognito = tab.incognito;
11 url = tab.url; 11 url = tab.url;
12 var types = ["cookies", "images", "javascript", "plugins", "popups", 12 var types = ["cookies", "images", "javascript", "plugins", "popups",
13 "notifications"]; 13 "notifications"];
14 types.forEach(function(type) { 14 types.forEach(function(type) {
15 chrome.experimental.contentSettings[type].get({ 15 chrome.contentSettings[type].get({
16 'primaryUrl': url, 16 'primaryUrl': url,
17 'incognito': incognito 17 'incognito': incognito
18 }, 18 },
19 function(details) { 19 function(details) {
20 document.getElementById(type).value = details.setting; 20 document.getElementById(type).value = details.setting;
21 }); 21 });
22 }); 22 });
23 }); 23 });
24 } 24 }
25 25
26 function settingChanged(element) { 26 function settingChanged(element) {
27 var type = element.id; 27 var type = element.id;
28 var setting = element.value; 28 var setting = element.value;
29 var pattern = /^file:/.test(url) ? url : url.replace(/\/[^\/]*?$/, '/*'); 29 var pattern = /^file:/.test(url) ? url : url.replace(/\/[^\/]*?$/, '/*');
30 console.log(type+" setting for "+pattern+": "+setting); 30 console.log(type+" setting for "+pattern+": "+setting);
31 chrome.experimental.contentSettings[type].set({ 31 chrome.contentSettings[type].set({
32 'primaryPattern': pattern, 32 'primaryPattern': pattern,
33 'setting': setting, 33 'setting': setting,
34 'scope': (incognito ? 'incognito_session_only' : 'regular') 34 'scope': (incognito ? 'incognito_session_only' : 'regular')
35 }); 35 });
36 } 36 }
37 </script> 37 </script>
38 </head> 38 </head>
39 <body onload="init()"> 39 <body onload="init()">
40 40
41 <fieldset> 41 <fieldset>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 <option value="allow">Allow</option> 77 <option value="allow">Allow</option>
78 <option value="ask">Ask</option> 78 <option value="ask">Ask</option>
79 <option value="block">Block</option> 79 <option value="block">Block</option>
80 </select></dd> 80 </select></dd>
81 </dl> 81 </dl>
82 </fieldset> 82 </fieldset>
83 83
84 84
85 </body> 85 </body>
86 </html> 86 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698