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

Unified Diff: chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js

Issue 2954863003: MD Settings: Convert all browser proxies to use ES6 class syntax. (Closed)
Patch Set: Remove @constructor annotations. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js
diff --git a/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js b/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js
index ecbd1c138d70f5b520611d535a0a904a06a42cbd..e335cdfbbb16c8d372b4050ffb1aa32be9299e1b 100644
--- a/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js
+++ b/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js
@@ -98,43 +98,41 @@ var ZoomLevelEntry;
cr.define('settings', function() {
/** @interface */
- function SiteSettingsPrefsBrowserProxy() {}
-
- SiteSettingsPrefsBrowserProxy.prototype = {
+ class SiteSettingsPrefsBrowserProxy {
/**
* Sets the default value for a site settings category.
* @param {string} contentType The name of the category to change.
* @param {string} defaultValue The name of the value to set as default.
*/
- setDefaultValueForContentType: function(contentType, defaultValue) {},
+ setDefaultValueForContentType(contentType, defaultValue) {}
/**
* Gets the cookie details for a particular site.
* @param {string} site The name of the site.
* @return {!Promise<!CookieList>}
*/
- getCookieDetails: function(site) {},
+ getCookieDetails(site) {}
/**
* Gets the default value for a site settings category.
* @param {string} contentType The name of the category to query.
* @return {!Promise<!DefaultContentSetting>}
*/
- getDefaultValueForContentType: function(contentType) {},
+ getDefaultValueForContentType(contentType) {}
/**
* Gets the exceptions (site list) for a particular category.
* @param {string} contentType The name of the category to query.
* @return {!Promise<!Array<!RawSiteException>>}
*/
- getExceptionList: function(contentType) {},
+ getExceptionList(contentType) {}
/**
* Gets the exception details for a particular site.
* @param {string} site The name of the site.
* @return {!Promise<!RawSiteException>}
*/
- getSiteDetails: function(site) {},
+ getSiteDetails(site) {}
/**
* Resets the category permission for a given origin (expressed as primary
@@ -146,8 +144,8 @@ cr.define('settings', function() {
* @param {boolean} incognito Whether this applies only to a current
* incognito session exception.
*/
- resetCategoryPermissionForOrigin: function(
- primaryPattern, secondaryPattern, contentType, incognito) {},
+ resetCategoryPermissionForOrigin(
+ primaryPattern, secondaryPattern, contentType, incognito) {}
/**
* Sets the category permission for a given origin (expressed as primary
@@ -160,36 +158,36 @@ cr.define('settings', function() {
* @param {boolean} incognito Whether this rule applies only to the current
* incognito session.
*/
- setCategoryPermissionForOrigin: function(
- primaryPattern, secondaryPattern, contentType, value, incognito) {},
+ setCategoryPermissionForOrigin(
+ primaryPattern, secondaryPattern, contentType, value, incognito) {}
/**
* Checks whether a pattern is valid.
* @param {string} pattern The pattern to check
* @return {!Promise<boolean>} True if the pattern is valid.
*/
- isPatternValid: function(pattern) {},
+ isPatternValid(pattern) {}
/**
* Gets the list of default capture devices for a given type of media. List
* is returned through a JS call to updateDevicesMenu.
* @param {string} type The type to look up.
*/
- getDefaultCaptureDevices: function(type) {},
+ getDefaultCaptureDevices(type) {}
/**
* Sets a default devices for a given type of media.
* @param {string} type The type of media to configure.
* @param {string} defaultValue The id of the media device to set.
*/
- setDefaultCaptureDevice: function(type, defaultValue) {},
+ setDefaultCaptureDevice(type, defaultValue) {}
/**
* Reloads all cookies.
* @return {!Promise<!CookieList>} Returns the full cookie
* list.
*/
- reloadCookies: function() {},
+ reloadCookies() {}
/**
* Fetches all children of a given cookie.
@@ -197,20 +195,20 @@ cr.define('settings', function() {
* @return {!Promise<!Array<!CookieDataSummaryItem>>} Returns a cookie list
* for the given path.
*/
- loadCookieChildren: function(path) {},
+ loadCookieChildren(path) {}
/**
* Removes a given cookie.
* @param {string} path The path to the parent cookie.
*/
- removeCookie: function(path) {},
+ removeCookie(path) {}
/**
* Removes all cookies.
* @return {!Promise<!CookieList>} Returns the up to date
* cookie list once deletion is complete (empty list).
*/
- removeAllCookies: function() {},
+ removeAllCookies() {}
/**
* observes _all_ of the the protocol handler state, which includes a list
@@ -218,7 +216,7 @@ cr.define('settings', function() {
* other state sent with the messages 'setIgnoredProtocolHandler' and
* 'setHandlersEnabled'.
*/
- observeProtocolHandlers: function() {},
+ observeProtocolHandlers() {}
/**
* Observes one aspect of the protocol handler so that updates to the
@@ -229,34 +227,34 @@ cr.define('settings', function() {
* If |observeProtocolHandlers| is called, there's no need to call this
* observe as well.
*/
- observeProtocolHandlersEnabledState: function() {},
+ observeProtocolHandlersEnabledState() {}
/**
* Enables or disables the ability for sites to ask to become the default
* protocol handlers.
* @param {boolean} enabled Whether sites can ask to become default.
*/
- setProtocolHandlerDefault: function(enabled) {},
+ setProtocolHandlerDefault(enabled) {}
/**
* Sets a certain url as default for a given protocol handler.
* @param {string} protocol The protocol to set a default for.
* @param {string} url The url to use as the default.
*/
- setProtocolDefault: function(protocol, url) {},
+ setProtocolDefault(protocol, url) {}
/**
* Deletes a certain protocol handler by url.
* @param {string} protocol The protocol to delete the url from.
* @param {string} url The url to delete.
*/
- removeProtocolHandler: function(protocol, url) {},
+ removeProtocolHandler(protocol, url) {}
/**
* Fetches a list of all USB devices and the sites permitted to use them.
* @return {!Promise<!Array<!UsbDeviceEntry>>} The list of USB devices.
*/
- fetchUsbDevices: function() {},
+ fetchUsbDevices() {}
/**
* Removes a particular USB device object permission by origin and embedding
@@ -266,73 +264,66 @@ cr.define('settings', function() {
* @param {!UsbDeviceDetails} usbDevice The USB device to revoke permission
* for.
*/
- removeUsbDevice: function(origin, embeddingOrigin, usbDevice) {},
+ removeUsbDevice(origin, embeddingOrigin, usbDevice) {}
/**
* Fetches the incognito status of the current profile (whether an icognito
* profile exists). Returns the results via onIncognitoStatusChanged.
*/
- updateIncognitoStatus: function() {},
+ updateIncognitoStatus() {}
/**
* Fetches the currently defined zoom levels for sites. Returns the results
* via onZoomLevelsChanged.
*/
- fetchZoomLevels: function() {},
+ fetchZoomLevels() {}
/**
* Removes a zoom levels for a given host.
* @param {string} host The host to remove zoom levels for.
*/
- removeZoomLevel: function(host) {},
- };
+ removeZoomLevel(host) {}
+ }
/**
- * @constructor
* @implements {settings.SiteSettingsPrefsBrowserProxy}
*/
- function SiteSettingsPrefsBrowserProxyImpl() {}
-
- // The singleton instance_ is replaced with a test version of this wrapper
- // during testing.
- cr.addSingletonGetter(SiteSettingsPrefsBrowserProxyImpl);
-
- SiteSettingsPrefsBrowserProxyImpl.prototype = {
+ class SiteSettingsPrefsBrowserProxyImpl {
/** @override */
- setDefaultValueForContentType: function(contentType, defaultValue) {
+ setDefaultValueForContentType(contentType, defaultValue) {
chrome.send('setDefaultValueForContentType', [contentType, defaultValue]);
- },
+ }
/** @override */
- getCookieDetails: function(site) {
+ getCookieDetails(site) {
return cr.sendWithPromise('getCookieDetails', site);
- },
+ }
/** @override */
- getDefaultValueForContentType: function(contentType) {
+ getDefaultValueForContentType(contentType) {
return cr.sendWithPromise('getDefaultValueForContentType', contentType);
- },
+ }
/** @override */
- getExceptionList: function(contentType) {
+ getExceptionList(contentType) {
return cr.sendWithPromise('getExceptionList', contentType);
- },
+ }
/** @override */
- getSiteDetails: function(site) {
+ getSiteDetails(site) {
return cr.sendWithPromise('getSiteDetails', site);
- },
+ }
/** @override */
- resetCategoryPermissionForOrigin: function(
+ resetCategoryPermissionForOrigin(
primaryPattern, secondaryPattern, contentType, incognito) {
chrome.send(
'resetCategoryPermissionForOrigin',
[primaryPattern, secondaryPattern, contentType, incognito]);
- },
+ }
/** @override */
- setCategoryPermissionForOrigin: function(
+ setCategoryPermissionForOrigin(
primaryPattern, secondaryPattern, contentType, value, incognito) {
// TODO(dschuyler): It may be incorrect for JS to send the embeddingOrigin
// pattern. Look into removing this parameter from site_settings_handler.
@@ -340,93 +331,97 @@ cr.define('settings', function() {
chrome.send(
'setCategoryPermissionForOrigin',
[primaryPattern, '', contentType, value, incognito]);
- },
+ }
/** @override */
- isPatternValid: function(pattern) {
+ isPatternValid(pattern) {
return cr.sendWithPromise('isPatternValid', pattern);
- },
+ }
/** @override */
- getDefaultCaptureDevices: function(type) {
+ getDefaultCaptureDevices(type) {
chrome.send('getDefaultCaptureDevices', [type]);
- },
+ }
/** @override */
- setDefaultCaptureDevice: function(type, defaultValue) {
+ setDefaultCaptureDevice(type, defaultValue) {
chrome.send('setDefaultCaptureDevice', [type, defaultValue]);
- },
+ }
/** @override */
- reloadCookies: function() {
+ reloadCookies() {
return cr.sendWithPromise('reloadCookies');
- },
+ }
/** @override */
- loadCookieChildren: function(path) {
+ loadCookieChildren(path) {
return cr.sendWithPromise('loadCookie', path);
- },
+ }
/** @override */
- removeCookie: function(path) {
+ removeCookie(path) {
chrome.send('removeCookie', [path]);
- },
+ }
/** @override */
- removeAllCookies: function() {
+ removeAllCookies() {
return cr.sendWithPromise('removeAllCookies');
- },
+ }
/** @override */
- observeProtocolHandlers: function() {
+ observeProtocolHandlers() {
chrome.send('observeProtocolHandlers');
- },
+ }
/** @override */
- observeProtocolHandlersEnabledState: function() {
+ observeProtocolHandlersEnabledState() {
chrome.send('observeProtocolHandlersEnabledState');
- },
+ }
/** @override */
- setProtocolHandlerDefault: function(enabled) {
+ setProtocolHandlerDefault(enabled) {
chrome.send('setHandlersEnabled', [enabled]);
- },
+ }
/** @override */
- setProtocolDefault: function(protocol, url) {
+ setProtocolDefault(protocol, url) {
chrome.send('setDefault', [[protocol, url]]);
- },
+ }
/** @override */
- removeProtocolHandler: function(protocol, url) {
+ removeProtocolHandler(protocol, url) {
chrome.send('removeHandler', [[protocol, url]]);
- },
+ }
/** @override */
- fetchUsbDevices: function() {
+ fetchUsbDevices() {
return cr.sendWithPromise('fetchUsbDevices');
- },
+ }
/** @override */
- removeUsbDevice: function(origin, embeddingOrigin, usbDevice) {
+ removeUsbDevice(origin, embeddingOrigin, usbDevice) {
chrome.send('removeUsbDevice', [origin, embeddingOrigin, usbDevice]);
- },
+ }
/** @override */
- updateIncognitoStatus: function() {
+ updateIncognitoStatus() {
chrome.send('updateIncognitoStatus');
- },
+ }
/** @override */
- fetchZoomLevels: function() {
+ fetchZoomLevels() {
chrome.send('fetchZoomLevels');
- },
+ }
/** @override */
- removeZoomLevel: function(host) {
+ removeZoomLevel(host) {
chrome.send('removeZoomLevel', [host]);
- },
- };
+ }
+ }
+
+ // The singleton instance_ is replaced with a test version of this wrapper
+ // during testing.
+ cr.addSingletonGetter(SiteSettingsPrefsBrowserProxyImpl);
return {
SiteSettingsPrefsBrowserProxy: SiteSettingsPrefsBrowserProxy,

Powered by Google App Engine
This is Rietveld 408576698