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

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: Review comments. Created 3 years, 5 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 * incognito: boolean, 25 * incognito: boolean,
26 * origin: string, 26 * origin: string,
27 * displayName: string, 27 * displayName: string,
28 * setting: string, 28 * setting: string,
29 * source: string}} 29 * source: string}}
30 */ 30 */
31 var RawSiteException; 31 var RawSiteException;
32 32
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 getDefaultValueForContentType(contentType) {} 119 getDefaultValueForContentType(contentType) {}
120 120
121 /** 121 /**
122 * Gets the exceptions (site list) for a particular category. 122 * Gets the exceptions (site list) for a particular category.
123 * @param {string} contentType The name of the category to query. 123 * @param {string} contentType The name of the category to query.
124 * @return {!Promise<!Array<!RawSiteException>>} 124 * @return {!Promise<!Array<!RawSiteException>>}
125 */ 125 */
126 getExceptionList(contentType) {} 126 getExceptionList(contentType) {}
127 127
128 /** 128 /**
129 * Gets the exception details for a particular site.
130 * @param {string} site The name of the site.
131 * @return {!Promise<!RawSiteException>}
132 */
133 getSiteDetails(site) {}
134
135 /**
136 * Resets the category permission for a given origin (expressed as primary 129 * Resets the category permission for a given origin (expressed as primary
137 * and secondary patterns). 130 * and secondary patterns).
138 * @param {string} primaryPattern The origin to change (primary pattern). 131 * @param {string} primaryPattern The origin to change (primary pattern).
139 * @param {string} secondaryPattern The embedding origin to change 132 * @param {string} secondaryPattern The embedding origin to change
140 * (secondary pattern). 133 * (secondary pattern).
141 * @param {string} contentType The name of the category to reset. 134 * @param {string} contentType The name of the category to reset.
142 * @param {boolean} incognito Whether this applies only to a current 135 * @param {boolean} incognito Whether this applies only to a current
143 * incognito session exception. 136 * incognito session exception.
144 */ 137 */
145 resetCategoryPermissionForOrigin( 138 resetCategoryPermissionForOrigin(
146 primaryPattern, secondaryPattern, contentType, incognito) {} 139 primaryPattern, secondaryPattern, contentType, incognito) {}
147 140
148 /** 141 /**
142 * Gets a list of category permissions for a given origin. Note that this
143 * may be different to the results retrieved by getExceptionList(), since it
144 * combines different sources of data to get a permission's value.
145 * @param {string} origin The origin to look up permissions for.
146 * @param {!Array<string>} contentTypes A list of categories to retrieve
147 * the ContentSetting for.
148 * @return {!Promise<!NodeList<!RawSiteException>>}
149 */
150 getOriginPermissions(origin, contentTypes) {}
151
152 /**
149 * Sets the category permission for a given origin (expressed as primary 153 * Sets the category permission for a given origin (expressed as primary
150 * and secondary patterns). 154 * and secondary patterns).
151 * @param {string} primaryPattern The origin to change (primary pattern). 155 * @param {string} primaryPattern The origin to change (primary pattern).
152 * @param {string} secondaryPattern The embedding origin to change 156 * @param {string} secondaryPattern The embedding origin to change
153 * (secondary pattern). 157 * (secondary pattern).
154 * @param {string} contentType The name of the category to change. 158 * @param {string} contentType The name of the category to change.
155 * @param {string} value The value to change the permission to. 159 * @param {string} value The value to change the permission to.
156 * @param {boolean} incognito Whether this rule applies only to the current 160 * @param {boolean} incognito Whether this rule applies only to the current
157 * incognito session. 161 * incognito session.
158 */ 162 */
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 getDefaultValueForContentType(contentType) { 305 getDefaultValueForContentType(contentType) {
302 return cr.sendWithPromise('getDefaultValueForContentType', contentType); 306 return cr.sendWithPromise('getDefaultValueForContentType', contentType);
303 } 307 }
304 308
305 /** @override */ 309 /** @override */
306 getExceptionList(contentType) { 310 getExceptionList(contentType) {
307 return cr.sendWithPromise('getExceptionList', contentType); 311 return cr.sendWithPromise('getExceptionList', contentType);
308 } 312 }
309 313
310 /** @override */ 314 /** @override */
311 getSiteDetails(site) {
312 return cr.sendWithPromise('getSiteDetails', site);
313 }
314
315 /** @override */
316 resetCategoryPermissionForOrigin( 315 resetCategoryPermissionForOrigin(
317 primaryPattern, secondaryPattern, contentType, incognito) { 316 primaryPattern, secondaryPattern, contentType, incognito) {
318 chrome.send( 317 chrome.send(
319 'resetCategoryPermissionForOrigin', 318 'resetCategoryPermissionForOrigin',
320 [primaryPattern, secondaryPattern, contentType, incognito]); 319 [primaryPattern, secondaryPattern, contentType, incognito]);
321 } 320 }
322 321
323 /** @override */ 322 /** @override */
323 getOriginPermissions(origin, contentTypes) {
324 return cr.sendWithPromise('getOriginPermissions', origin, contentTypes);
325 }
326
327 /** @override */
324 setCategoryPermissionForOrigin( 328 setCategoryPermissionForOrigin(
325 primaryPattern, secondaryPattern, contentType, value, incognito) { 329 primaryPattern, secondaryPattern, contentType, value, incognito) {
326 // TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin 330 // TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin
327 // pattern. Look into removing this parameter from site_settings_handler. 331 // pattern. Look into removing this parameter from site_settings_handler.
328 // Ignoring the |secondaryPattern| and using '' instead is a quick-fix. 332 // Ignoring the |secondaryPattern| and using '' instead is a quick-fix.
329 chrome.send( 333 chrome.send(
330 'setCategoryPermissionForOrigin', 334 'setCategoryPermissionForOrigin',
331 [primaryPattern, '', contentType, value, incognito]); 335 [primaryPattern, '', contentType, value, incognito]);
332 } 336 }
333 337
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 423
420 // The singleton instance_ is replaced with a test version of this wrapper 424 // The singleton instance_ is replaced with a test version of this wrapper
421 // during testing. 425 // during testing.
422 cr.addSingletonGetter(SiteSettingsPrefsBrowserProxyImpl); 426 cr.addSingletonGetter(SiteSettingsPrefsBrowserProxyImpl);
423 427
424 return { 428 return {
425 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, 429 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy,
426 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, 430 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl,
427 }; 431 };
428 }); 432 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698