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

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

Issue 2397633002: Remove fullscreen and mouselock from contentSettings API sample. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « chrome/common/extensions/docs/examples/api/contentSettings/popup.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var incognito; 5 var incognito;
6 var url; 6 var url;
7 7
8 function settingChanged() { 8 function settingChanged() {
9 var type = this.id; 9 var type = this.id;
10 var setting = this.value; 10 var setting = this.value;
11 var pattern = /^file:/.test(url) ? url : url.replace(/\/[^\/]*?$/, '/*'); 11 var pattern = /^file:/.test(url) ? url : url.replace(/\/[^\/]*?$/, '/*');
12 console.log(type+' setting for '+pattern+': '+setting); 12 console.log(type+' setting for '+pattern+': '+setting);
13 // HACK: [type] is not recognised by the docserver's sample crawler, so 13 // HACK: [type] is not recognised by the docserver's sample crawler, so
14 // mention an explicit 14 // mention an explicit
15 // type: chrome.contentSettings.cookies.set - See http://crbug.com/299634 15 // type: chrome.contentSettings.cookies.set - See http://crbug.com/299634
16 chrome.contentSettings[type].set({ 16 chrome.contentSettings[type].set({
17 'primaryPattern': pattern, 17 'primaryPattern': pattern,
18 'setting': setting, 18 'setting': setting,
19 'scope': (incognito ? 'incognito_session_only' : 'regular') 19 'scope': (incognito ? 'incognito_session_only' : 'regular')
20 }); 20 });
21 } 21 }
22 22
23 document.addEventListener('DOMContentLoaded', function () { 23 document.addEventListener('DOMContentLoaded', function () {
24 chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { 24 chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
25 var current = tabs[0]; 25 var current = tabs[0];
26 incognito = current.incognito; 26 incognito = current.incognito;
27 url = current.url; 27 url = current.url;
28 var types = ['cookies', 'images', 'javascript', 'location', 'plugins', 28 var types = ['cookies', 'images', 'javascript', 'location', 'plugins',
29 'popups', 'notifications', 'fullscreen', 'mouselock', 29 'popups', 'notifications', 'microphone', 'camera',
30 'microphone', 'camera', 'unsandboxedPlugins', 30 'unsandboxedPlugins', 'automaticDownloads'];
31 'automaticDownloads'];
32 types.forEach(function(type) { 31 types.forEach(function(type) {
33 // HACK: [type] is not recognised by the docserver's sample crawler, so 32 // HACK: [type] is not recognised by the docserver's sample crawler, so
34 // mention an explicit 33 // mention an explicit
35 // type: chrome.contentSettings.cookies.get - See http://crbug.com/299634 34 // type: chrome.contentSettings.cookies.get - See http://crbug.com/299634
36 chrome.contentSettings[type] && chrome.contentSettings[type].get({ 35 chrome.contentSettings[type] && chrome.contentSettings[type].get({
37 'primaryUrl': url, 36 'primaryUrl': url,
38 'incognito': incognito 37 'incognito': incognito
39 }, 38 },
40 function(details) { 39 function(details) {
41 document.getElementById(type).disabled = false; 40 document.getElementById(type).disabled = false;
42 document.getElementById(type).value = details.setting; 41 document.getElementById(type).value = details.setting;
43 }); 42 });
44 }); 43 });
45 }); 44 });
46 45
47 var selects = document.querySelectorAll('select'); 46 var selects = document.querySelectorAll('select');
48 for (var i = 0; i < selects.length; i++) { 47 for (var i = 0; i < selects.length; i++) {
49 selects[i].addEventListener('change', settingChanged); 48 selects[i].addEventListener('change', settingChanged);
50 } 49 }
51 }); 50 });
52 51
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/examples/api/contentSettings/popup.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698