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 |
145 getCategoryPermissionForOrigin: function( | |
tsergeant
2017/06/16 03:11:40
As discussed in person, Closure is failing because
Patti Lor
2017/06/20 08:25:54
Thanks for debugging this Tim! Fixed :D
| |
146 contentType, requestingOrigin, embeddingOrigin) {}, | |
147 | |
152 /** | 148 /** |
153 * Sets the category permission for a given origin (expressed as primary | 149 * Sets the category permission for a given origin (expressed as primary |
154 * and secondary patterns). | 150 * and secondary patterns). |
155 * @param {string} primaryPattern The origin to change (primary pattern). | 151 * @param {string} primaryPattern The origin to change (primary pattern). |
156 * @param {string} secondaryPattern The embedding origin to change | 152 * @param {string} secondaryPattern The embedding origin to change |
157 * (secondary pattern). | 153 * (secondary pattern). |
158 * @param {string} contentType The name of the category to change. | 154 * @param {string} contentType The name of the category to change. |
159 * @param {string} value The value to change the permission to. | 155 * @param {string} value The value to change the permission to. |
160 * @param {boolean} incognito Whether this rule applies only to the current | 156 * @param {boolean} incognito Whether this rule applies only to the current |
161 * incognito session. | 157 * incognito session. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 getDefaultValueForContentType: function(contentType) { | 308 getDefaultValueForContentType: function(contentType) { |
313 return cr.sendWithPromise('getDefaultValueForContentType', contentType); | 309 return cr.sendWithPromise('getDefaultValueForContentType', contentType); |
314 }, | 310 }, |
315 | 311 |
316 /** @override */ | 312 /** @override */ |
317 getExceptionList: function(contentType) { | 313 getExceptionList: function(contentType) { |
318 return cr.sendWithPromise('getExceptionList', contentType); | 314 return cr.sendWithPromise('getExceptionList', contentType); |
319 }, | 315 }, |
320 | 316 |
321 /** @override */ | 317 /** @override */ |
322 getSiteDetails: function(site) { | |
323 return cr.sendWithPromise('getSiteDetails', site); | |
324 }, | |
325 | |
326 /** @override */ | |
327 resetCategoryPermissionForOrigin: function( | 318 resetCategoryPermissionForOrigin: function( |
328 primaryPattern, secondaryPattern, contentType, incognito) { | 319 primaryPattern, secondaryPattern, contentType, incognito) { |
329 chrome.send( | 320 chrome.send( |
330 'resetCategoryPermissionForOrigin', | 321 'resetCategoryPermissionForOrigin', |
331 [primaryPattern, secondaryPattern, contentType, incognito]); | 322 [primaryPattern, secondaryPattern, contentType, incognito]); |
332 }, | 323 }, |
333 | 324 |
334 /** @override */ | 325 /** @override */ |
326 getCategoryPermissionForOrigin: function( | |
327 contentType, requestingOrigin, embeddingOrigin) { | |
328 return cr.sendWithPromise( | |
329 'getCategoryPermissionForOrigin', contentType, requestingOrigin, | |
330 embeddingOrigin); | |
331 }, | |
332 | |
333 /** @override */ | |
335 setCategoryPermissionForOrigin: function( | 334 setCategoryPermissionForOrigin: function( |
336 primaryPattern, secondaryPattern, contentType, value, incognito) { | 335 primaryPattern, secondaryPattern, contentType, value, incognito) { |
337 // TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin | 336 // TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin |
338 // pattern. Look into removing this parameter from site_settings_handler. | 337 // pattern. Look into removing this parameter from site_settings_handler. |
339 // Ignoring the |secondaryPattern| and using '' instead is a quick-fix. | 338 // Ignoring the |secondaryPattern| and using '' instead is a quick-fix. |
340 chrome.send( | 339 chrome.send( |
341 'setCategoryPermissionForOrigin', | 340 'setCategoryPermissionForOrigin', |
342 [primaryPattern, '', contentType, value, incognito]); | 341 [primaryPattern, '', contentType, value, incognito]); |
343 }, | 342 }, |
344 | 343 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 removeZoomLevel: function(host) { | 425 removeZoomLevel: function(host) { |
427 chrome.send('removeZoomLevel', [host]); | 426 chrome.send('removeZoomLevel', [host]); |
428 }, | 427 }, |
429 }; | 428 }; |
430 | 429 |
431 return { | 430 return { |
432 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, | 431 SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy, |
433 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, | 432 SiteSettingsPrefsBrowserProxyImpl: SiteSettingsPrefsBrowserProxyImpl, |
434 }; | 433 }; |
435 }); | 434 }); |
OLD | NEW |