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

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

Issue 8309001: Adding `content_security_policy` to a few sample extensions. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: License and whitespace. 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 <title>Popup</title>
5 var incognito; 5 <script src="popup.js"></script>
6 var url; 6 </head>
7 7 <body>
8 function init() { 8 <fieldset>
9 chrome.tabs.getSelected(undefined, function(tab) { 9 <dl>
10 incognito = tab.incognito; 10 <dt><label for="cookies">Cookies: </label></dt>
11 url = tab.url; 11 <dd><select id="cookies">
12 var types = ["cookies", "images", "javascript", "plugins", "popups", 12 <option value="allow">Allow</option>
13 "notifications"]; 13 <option value="session_only">Session only</option>
14 types.forEach(function(type) { 14 <option value="block">Block</option>
15 chrome.contentSettings[type].get({ 15 </select></dd>
16 'primaryUrl': url, 16 <dt><label for="images">Images: </label></dt>
17 'incognito': incognito 17 <dd><select id="images">
18 }, 18 <option value="allow">Allow</option>
19 function(details) { 19 <option value="block">Block</option>
20 document.getElementById(type).value = details.setting; 20 </select>
21 }); 21 <dt><label for="javascript">Javascript: </label></dt>
22 }); 22 <dd><select id="javascript">
23 }); 23 <option value="allow">Allow</option>
24 } 24 <option value="block">Block</option>
25 25 </select></dd>
26 function settingChanged(element) { 26 <dt><label for="plugins">Plug-ins: </label></dt>
27 var type = element.id; 27 <dd><select id="plugins">
28 var setting = element.value; 28 <option value="allow">Allow</option>
29 var pattern = /^file:/.test(url) ? url : url.replace(/\/[^\/]*?$/, '/*'); 29 <option value="block">Block</option>
30 console.log(type+" setting for "+pattern+": "+setting); 30 </select></dd>
31 chrome.contentSettings[type].set({ 31 <dt><label for="popups">Pop-ups: </label></dt>
32 'primaryPattern': pattern, 32 <dd><select id="popups">
33 'setting': setting, 33 <option value="allow">Allow</option>
34 'scope': (incognito ? 'incognito_session_only' : 'regular') 34 <option value="block">Block</option>
35 }); 35 </select></dd>
36 } 36 <dt><label for="location">Location: </label></dt>
37 </script> 37 <dd><select id="location" disabled>
38 </head> 38 <option value="allow">Allow</option>
39 <body onload="init()"> 39 <option value="ask">Ask</option>
40 40 <option value="block">Block</option>
41 <fieldset> 41 </select></dd>
42 <dl> 42 <dt><label for="notifications">Notifications: </label></dt>
43 <dt><label for="cookies">Cookies: </label></dt> 43 <dd><select id="notifications">
44 <dd><select id="cookies" onchange="settingChanged(this);"> 44 <option value="allow">Allow</option>
45 <option value="allow">Allow</option> 45 <option value="ask">Ask</option>
46 <option value="session_only">Session only</option> 46 <option value="block">Block</option>
47 <option value="block">Block</option> 47 </select></dd>
48 </select></dd> 48 </dl>
49 <dt><label for="images">Images: </label></dt> 49 </fieldset>
50 <dd><select id="images" onchange="settingChanged(this);">
51 <option value="allow">Allow</option>
52 <option value="block">Block</option>
53 </select>
54 <dt><label for="javascript">Javascript: </label></dt>
55 <dd><select id="javascript" onchange="settingChanged(this);">
56 <option value="allow">Allow</option>
57 <option value="block">Block</option>
58 </select></dd>
59 <dt><label for="plugins">Plug-ins: </label></dt>
60 <dd><select id="plugins" onchange="settingChanged(this);">
61 <option value="allow">Allow</option>
62 <option value="block">Block</option>
63 </select></dd>
64 <dt><label for="popups">Pop-ups: </label></dt>
65 <dd><select id="popups" onchange="settingChanged(this);">
66 <option value="allow">Allow</option>
67 <option value="block">Block</option>
68 </select></dd>
69 <dt><label for="location">Location: </label></dt>
70 <dd><select id="location" onchange="settingChanged(this);" disabled>
71 <option value="allow">Allow</option>
72 <option value="ask">Ask</option>
73 <option value="block">Block</option>
74 </select></dd>
75 <dt><label for="notifications">Notifications: </label></dt>
76 <dd><select id="notifications" onchange="settingChanged(this);">
77 <option value="allow">Allow</option>
78 <option value="ask">Ask</option>
79 <option value="block">Block</option>
80 </select></dd>
81 </dl>
82 </fieldset>
83 50
84 51
85 </body> 52 </body>
86 </html> 53 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698