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

Side by Side Diff: chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js

Issue 2936003003: MD Settings: Set all content setting values in Site Details Javascript. (Closed)
Patch Set: Fix last reference to |site| in site_details.html. Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * @fileoverview A helper object used from the "Site Settings" section to 6 * @fileoverview A helper object used from the "Site Settings" section to
7 * interact with the content settings prefs. 7 * interact with the content settings prefs.
8 */ 8 */
9 9
10 /** 10 /**
11 * The handler will send a policy source that is similar, but not exactly the 11 * The handler will send a policy source that is similar, but not exactly the
12 * same as a ControlledBy value. If the ContentSettingProvider is omitted it 12 * same as a ControlledBy value. If the ContentSettingProvider is omitted it
13 * should be treated as 'default'. 13 * should be treated as 'default'.
14 * @enum {string} 14 * @enum {string}
15 */ 15 */
16 var ContentSettingProvider = { 16 var ContentSettingProvider = {
17 EXTENSION: 'extension', 17 EXTENSION: 'extension',
18 PREFERENCE: 'preference', 18 PREFERENCE: 'preference',
19 }; 19 };
20 20
21 /** 21 /**
22 * The site exception information passed form the C++ handler. 22 * The site exception information passed from the C++ handler.
23 * See also: SiteException. 23 * See also: SiteException.
24 * @typedef {{embeddingOrigin: string, 24 * @typedef {{embeddingOrigin: string,
25 * embeddingDisplayName: string, 25 * embeddingDisplayName: string,
26 * incognito: boolean, 26 * incognito: boolean,
27 * origin: string, 27 * origin: string,
28 * displayName: string, 28 * displayName: string,
29 * setting: string, 29 * setting: string,
30 * source: string}} 30 * source: string}}
31 */ 31 */
32 var RawSiteException; 32 var RawSiteException;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 getDefaultValueForContentType: function(contentType) {}, 123 getDefaultValueForContentType: function(contentType) {},
124 124
125 /** 125 /**
126 * Gets the exceptions (site list) for a particular category. 126 * Gets the exceptions (site list) for a particular category.
127 * @param {string} contentType The name of the category to query. 127 * @param {string} contentType The name of the category to query.
128 * @return {!Promise<!Array<!RawSiteException>>} 128 * @return {!Promise<!Array<!RawSiteException>>}
129 */ 129 */
130 getExceptionList: function(contentType) {}, 130 getExceptionList: function(contentType) {},
131 131
132 /** 132 /**
133 * Gets the exception details for a particular site.
134 * @param {string} site The name of the site.
135 * @return {!Promise<!RawSiteException>}
136 */
137 getSiteDetails: function(site) {},
138
139 /**
140 * Resets the category permission for a given origin (expressed as primary 133 * Resets the category permission for a given origin (expressed as primary
141 * and secondary patterns). 134 * and secondary patterns).
142 * @param {string} primaryPattern The origin to change (primary pattern). 135 * @param {string} primaryPattern The origin to change (primary pattern).
143 * @param {string} secondaryPattern The embedding origin to change 136 * @param {string} secondaryPattern The embedding origin to change
144 * (secondary pattern). 137 * (secondary pattern).
145 * @param {string} contentType The name of the category to reset. 138 * @param {string} contentType The name of the category to reset.
146 * @param {boolean} incognito Whether this applies only to a current 139 * @param {boolean} incognito Whether this applies only to a current
147 * incognito session exception. 140 * incognito session exception.
148 */ 141 */
149 resetCategoryPermissionForOrigin: function( 142 resetCategoryPermissionForOrigin: function(
150 primaryPattern, secondaryPattern, contentType, incognito) {}, 143 primaryPattern, secondaryPattern, contentType, incognito) {},
151 144
152 /** 145 /**
146 * Gets the category permission for a given origin. Note that this may be
147 * different to the result retrieved by getExceptionList(), since it
148 * combines different sources of data into a single value.
149 * @param {string} contentType The name of the category to query.
150 * @param {string} origin The origin to look up the permission for.
151 * @return {!Promise<!RawSiteException>}
152 */
153 getCategoryPermissionForOrigin: function(contentType, origin) {},
154
155 /**
153 * Sets the category permission for a given origin (expressed as primary 156 * Sets the category permission for a given origin (expressed as primary
154 * and secondary patterns). 157 * and secondary patterns).
155 * @param {string} primaryPattern The origin to change (primary pattern). 158 * @param {string} primaryPattern The origin to change (primary pattern).
156 * @param {string} secondaryPattern The embedding origin to change 159 * @param {string} secondaryPattern The embedding origin to change
157 * (secondary pattern). 160 * (secondary pattern).
158 * @param {string} contentType The name of the category to change. 161 * @param {string} contentType The name of the category to change.
159 * @param {string} value The value to change the permission to. 162 * @param {string} value The value to change the permission to.
160 * @param {boolean} incognito Whether this rule applies only to the current 163 * @param {boolean} incognito Whether this rule applies only to the current
161 * incognito session. 164 * incognito session.
162 */ 165 */
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 getDefaultValueForContentType: function(contentType) { 315 getDefaultValueForContentType: function(contentType) {
313 return cr.sendWithPromise('getDefaultValueForContentType', contentType); 316 return cr.sendWithPromise('getDefaultValueForContentType', contentType);
314 }, 317 },
315 318
316 /** @override */ 319 /** @override */
317 getExceptionList: function(contentType) { 320 getExceptionList: function(contentType) {
318 return cr.sendWithPromise('getExceptionList', contentType); 321 return cr.sendWithPromise('getExceptionList', contentType);
319 }, 322 },
320 323
321 /** @override */ 324 /** @override */
322 getSiteDetails: function(site) {
323 return cr.sendWithPromise('getSiteDetails', site);
324 },
325
326 /** @override */
327 resetCategoryPermissionForOrigin: function( 325 resetCategoryPermissionForOrigin: function(
328 primaryPattern, secondaryPattern, contentType, incognito) { 326 primaryPattern, secondaryPattern, contentType, incognito) {
329 chrome.send( 327 chrome.send(
330 'resetCategoryPermissionForOrigin', 328 'resetCategoryPermissionForOrigin',
331 [primaryPattern, secondaryPattern, contentType, incognito]); 329 [primaryPattern, secondaryPattern, contentType, incognito]);
332 }, 330 },
333 331
334 /** @override */ 332 /** @override */
333 getCategoryPermissionForOrigin: function(contentType, origin) {
334 return cr.sendWithPromise(
335 'getCategoryPermissionForOrigin', contentType, origin);
336 },
337
338 /** @override */
335 setCategoryPermissionForOrigin: function( 339 setCategoryPermissionForOrigin: function(
336 primaryPattern, secondaryPattern, contentType, value, incognito) { 340 primaryPattern, secondaryPattern, contentType, value, incognito) {
337 // TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin 341 // TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin
338 // pattern. Look into removing this parameter from site_settings_handler. 342 // pattern. Look into removing this parameter from site_settings_handler.
339 // Ignoring the |secondaryPattern| and using '' instead is a quick-fix. 343 // Ignoring the |secondaryPattern| and using '' instead is a quick-fix.
340 chrome.send( 344 chrome.send(
341 'setCategoryPermissionForOrigin', 345 'setCategoryPermissionForOrigin',
342 [primaryPattern, '', contentType, value, incognito]); 346 [primaryPattern, '', contentType, value, incognito]);
343 }, 347 },
344 348
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 removeZoomLevel: function(host) { 430 removeZoomLevel: function(host) {
427 chrome.send('removeZoomLevel', [host]); 431 chrome.send('removeZoomLevel', [host]);
428 }, 432 },
429 }; 433 };
430 434
431 return { 435 return {
432 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, 436 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy,
433 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, 437 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl,
434 }; 438 };
435 }); 439 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698