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

Side by Side Diff: chrome/browser/resources/options/website_settings.js

Issue 566863005: Expose the Website Settings page in the Content Setting page if it is enabled via flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 cr.define('options', function() { 5 cr.define('options.ContentSettings', function() {
6 /** @const */ var Page = cr.ui.pageManager.Page; 6 /** @const */ var Page = cr.ui.pageManager.Page;
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager;
8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
9 9
10 // Lookup table to generate the i18n strings. 10 // Lookup table to generate the i18n strings.
11 /** @const */ var permissionsLookup = { 11 /** @const */ var permissionsLookup = {
12 'geolocation': 'location', 12 'geolocation': 'location',
13 'notifications': 'notifications', 13 'notifications': 'notifications',
14 'media-stream': 'mediaStream', 14 'media-stream': 'mediaStream',
15 'cookies': 'cookies', 15 'cookies': 'cookies',
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 */ 52 */
53 blockedList_: null, 53 blockedList_: null,
54 54
55 /** @override */ 55 /** @override */
56 initializePage: function() { 56 initializePage: function() {
57 Page.prototype.initializePage.call(this); 57 Page.prototype.initializePage.call(this);
58 58
59 $('website-settings-overlay-confirm').onclick = 59 $('website-settings-overlay-confirm').onclick =
60 PageManager.closeOverlay.bind(PageManager); 60 PageManager.closeOverlay.bind(PageManager);
61 61
62 $('resourceType').onchange = function(event) {
63 var target = event.target;
64 assert(target.tagName == 'SELECT');
65 WebsiteSettingsManager.getInstance().updatePage_(target.value);
66 };
67
68 $('global-setting').onchange = function(event) { 62 $('global-setting').onchange = function(event) {
69 chrome.send('setDefaultContentSetting', [this.value]); 63 chrome.send('setDefaultContentSetting', [this.value]);
70 }; 64 };
71 65
72 var searchBox = $('website-settings-search-box'); 66 var searchBox = $('website-settings-search-box');
73 searchBox.addEventListener('search', 67 searchBox.addEventListener('search',
74 this.handleSearchQueryChange_.bind(this)); 68 this.handleSearchQueryChange_.bind(this));
75 69
76 searchBox.onkeydown = function(e) { 70 searchBox.onkeydown = function(e) {
77 if (e.keyIdentifier == 'Enter') 71 if (e.keyIdentifier == 'Enter')
78 e.preventDefault(); 72 e.preventDefault();
79 }; 73 };
80 74
81 this.createOriginsList_(); 75 this.createOriginsList_();
82 this.updatePage_('geolocation'); 76 this.updatePage_('geolocation');
83 }, 77 },
84 78
85 /** 79 /**
86 * Called after the page has been shown. Show the content settings or 80 * Called after the page has been shown. Show the content settings or
87 * resource auditing for the location's hash. 81 * resource auditing for the location's hash.
88 */ 82 */
89 didShowPage: function() { 83 didShowPage: function() {
90 var hash = location.hash; 84 var hash = location.hash;
91 if (hash) 85 if (hash)
92 hash = hash.slice(1); 86 hash = hash.slice(1);
93 else 87 else
94 hash = 'geolocation'; 88 hash = 'geolocation';
95 this.updatePage_(hash); 89 this.updatePage_(hash);
96
97 $('resourceType').value = hash;
98 }, 90 },
99 91
100 /** 92 /**
101 * Creates, decorates and initializes the origin list. 93 * Creates, decorates and initializes the origin list.
102 * @private 94 * @private
103 */ 95 */
104 createOriginsList_: function() { 96 createOriginsList_: function() {
105 this.allowedList_ = $('allowed-origin-list'); 97 this.allowedList_ = $('allowed-origin-list');
106 options.OriginList.decorate(this.allowedList_); 98 options.OriginList.decorate(this.allowedList_);
107 this.allowedList_.autoExpands = true; 99 this.allowedList_.autoExpands = true;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 options.add(new Option(loadTimeData.getString(valueId), 223 options.add(new Option(loadTimeData.getString(valueId),
232 permissions[i].toLowerCase())); 224 permissions[i].toLowerCase()));
233 } 225 }
234 } 226 }
235 if (options.length == 0) { 227 if (options.length == 0) {
236 $('website-settings-global-controls').hidden = true; 228 $('website-settings-global-controls').hidden = true;
237 } else { 229 } else {
238 $('website-settings-global-controls').hidden = false; 230 $('website-settings-global-controls').hidden = false;
239 chrome.send('updateDefaultSetting'); 231 chrome.send('updateDefaultSetting');
240 } 232 }
233
234 $('website-settings-title').textContent =
235 loadTimeData.getString(permissionString + 'TabLabel');
241 } 236 }
242 }; 237 };
243 238
244 WebsiteSettingsManager.populateOrigins = function(allowedDict, blockedDict) { 239 WebsiteSettingsManager.populateOrigins = function(allowedDict, blockedDict) {
245 WebsiteSettingsManager.getInstance().populateOrigins(allowedDict, 240 WebsiteSettingsManager.getInstance().populateOrigins(allowedDict,
246 blockedDict); 241 blockedDict);
247 }; 242 };
248 243
249 WebsiteSettingsManager.updateDefault = function(dict) { 244 WebsiteSettingsManager.updateDefault = function(dict) {
250 WebsiteSettingsManager.getInstance().updateDefault(dict); 245 WebsiteSettingsManager.getInstance().updateDefault(dict);
251 }; 246 };
252 247
253 // Export 248 // Export
254 return { 249 return {
255 WebsiteSettingsManager: WebsiteSettingsManager 250 WebsiteSettingsManager: WebsiteSettingsManager
256 }; 251 };
257 }); 252 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698