OLD | NEW |
---|---|
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 Loading... | |
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. | |
raymes
2017/06/19 04:13:12
nit: It may be worth noting that this will be a di
Patti Lor
2017/06/20 08:25:54
Done, kind of quoted you verbatim.
| |
147 * @param {string} contentType The name of the category to query. | |
148 * @param {string} origin The origin to look up the permission for. | |
149 * @param {string} embeddingOrigin the embedding origin to look up. | |
150 */ | |
151 getCategoryPermissionForOrigin: function( | |
152 contentType, origin, embeddingOrigin) {}, | |
raymes
2017/06/19 04:13:12
nit: I think embeddingOrigin isn't needed right no
Patti Lor
2017/06/20 08:25:54
Done.
| |
153 | |
154 /** | |
153 * Sets the category permission for a given origin (expressed as primary | 155 * Sets the category permission for a given origin (expressed as primary |
154 * and secondary patterns). | 156 * and secondary patterns). |
155 * @param {string} primaryPattern The origin to change (primary pattern). | 157 * @param {string} primaryPattern The origin to change (primary pattern). |
156 * @param {string} secondaryPattern The embedding origin to change | 158 * @param {string} secondaryPattern The embedding origin to change |
157 * (secondary pattern). | 159 * (secondary pattern). |
158 * @param {string} contentType The name of the category to change. | 160 * @param {string} contentType The name of the category to change. |
159 * @param {string} value The value to change the permission to. | 161 * @param {string} value The value to change the permission to. |
160 * @param {boolean} incognito Whether this rule applies only to the current | 162 * @param {boolean} incognito Whether this rule applies only to the current |
161 * incognito session. | 163 * incognito session. |
162 */ | 164 */ |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 getDefaultValueForContentType: function(contentType) { | 314 getDefaultValueForContentType: function(contentType) { |
313 return cr.sendWithPromise('getDefaultValueForContentType', contentType); | 315 return cr.sendWithPromise('getDefaultValueForContentType', contentType); |
314 }, | 316 }, |
315 | 317 |
316 /** @override */ | 318 /** @override */ |
317 getExceptionList: function(contentType) { | 319 getExceptionList: function(contentType) { |
318 return cr.sendWithPromise('getExceptionList', contentType); | 320 return cr.sendWithPromise('getExceptionList', contentType); |
319 }, | 321 }, |
320 | 322 |
321 /** @override */ | 323 /** @override */ |
322 getSiteDetails: function(site) { | |
323 return cr.sendWithPromise('getSiteDetails', site); | |
324 }, | |
325 | |
326 /** @override */ | |
327 resetCategoryPermissionForOrigin: function( | 324 resetCategoryPermissionForOrigin: function( |
328 primaryPattern, secondaryPattern, contentType, incognito) { | 325 primaryPattern, secondaryPattern, contentType, incognito) { |
329 chrome.send( | 326 chrome.send( |
330 'resetCategoryPermissionForOrigin', | 327 'resetCategoryPermissionForOrigin', |
331 [primaryPattern, secondaryPattern, contentType, incognito]); | 328 [primaryPattern, secondaryPattern, contentType, incognito]); |
332 }, | 329 }, |
333 | 330 |
334 /** @override */ | 331 /** @override */ |
332 getCategoryPermissionForOrigin: function( | |
333 contentType, origin, embeddingOrigin) { | |
334 return cr.sendWithPromise( | |
335 'getCategoryPermissionForOrigin', contentType, origin, | |
336 embeddingOrigin); | |
337 }, | |
338 | |
339 /** @override */ | |
335 setCategoryPermissionForOrigin: function( | 340 setCategoryPermissionForOrigin: function( |
336 primaryPattern, secondaryPattern, contentType, value, incognito) { | 341 primaryPattern, secondaryPattern, contentType, value, incognito) { |
337 // TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin | 342 // TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin |
338 // pattern. Look into removing this parameter from site_settings_handler. | 343 // pattern. Look into removing this parameter from site_settings_handler. |
339 // Ignoring the |secondaryPattern| and using '' instead is a quick-fix. | 344 // Ignoring the |secondaryPattern| and using '' instead is a quick-fix. |
340 chrome.send( | 345 chrome.send( |
341 'setCategoryPermissionForOrigin', | 346 'setCategoryPermissionForOrigin', |
342 [primaryPattern, '', contentType, value, incognito]); | 347 [primaryPattern, '', contentType, value, incognito]); |
343 }, | 348 }, |
344 | 349 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 removeZoomLevel: function(host) { | 431 removeZoomLevel: function(host) { |
427 chrome.send('removeZoomLevel', [host]); | 432 chrome.send('removeZoomLevel', [host]); |
428 }, | 433 }, |
429 }; | 434 }; |
430 | 435 |
431 return { | 436 return { |
432 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, | 437 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, |
433 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, | 438 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, |
434 }; | 439 }; |
435 }); | 440 }); |
OLD | NEW |