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

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

Powered by Google App Engine
This is Rietveld 408576698