Commit 6dff07c7 authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

chrome_pass: move almost all @enums/@typedefs into cr.define()

Previously there were technical issues regarding @typedef in a
non-global (contextual?) scope. These were solved so we can return to a
saner model of exporting enums and @typedefs the same way as everything
else.

This is in hopes of removing cr.exportPath from --chrome_pass at least.
(We may forever benefit from the runtime effects.)

R=dpapad@chromium.org
BUG=986481

Change-Id: Ic07c7c87e3b6f6279167cee182d3c2fa0a10105e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992697
Commit-Queue: Dan Beam <dbeam@chromium.org>
Auto-Submit: Dan Beam <dbeam@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730033}
parent 6696ec8d
...@@ -2,24 +2,26 @@ ...@@ -2,24 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
cr.exportPath('settings'); cr.define('settings', function() {
/**
/** * For each line in the item list, the text field will be shown in normal
* For each line in the item list, the text field will be shown in normal style * style at front of the line. The highlightSuffix will be appended to the end
* at front of the line. The highlightSuffix will be appended to the end of line * of line and emphasized with bold font.
* and emphasized with bold font.
* @typedef {{ * @typedef {{
* text: string, * text: string,
* highlightSuffix: ?string, * highlightSuffix: ?string,
* }} * }}
*/ */
settings.ChromeCleanupRemovalListItem; let ChromeCleanupRemovalListItem;
/** /**
* The default number of items to show for files, registry keys and extensions * The default number of items to show for files, registry keys and extensions
* on the detailed view when user-initiated cleanups are enabled. * on the detailed view when user-initiated cleanups are enabled.
*/ */
settings.CHROME_CLEANUP_DEFAULT_ITEMS_TO_SHOW = 4; const CHROME_CLEANUP_DEFAULT_ITEMS_TO_SHOW = 4;
return {ChromeCleanupRemovalListItem, CHROME_CLEANUP_DEFAULT_ITEMS_TO_SHOW};
});
/** /**
* @fileoverview * @fileoverview
......
...@@ -2,19 +2,17 @@ ...@@ -2,19 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** @fileoverview A helper object used for testing the Device page. */ cr.define('settings', function() {
cr.exportPath('settings'); /**
/**
* @typedef {{ * @typedef {{
* id: string, * id: string,
* is_dedicated_charger: boolean, * is_dedicated_charger: boolean,
* description: string * description: string
* }} * }}
*/ */
settings.PowerSource; let PowerSource;
/** /**
* @typedef {{ * @typedef {{
* present: boolean, * present: boolean,
* charging: boolean, * charging: boolean,
...@@ -23,31 +21,31 @@ settings.PowerSource; ...@@ -23,31 +21,31 @@ settings.PowerSource;
* statusText: string, * statusText: string,
* }} * }}
*/ */
settings.BatteryStatus; let BatteryStatus;
/** /**
* Mirrors chromeos::settings::PowerHandler::IdleBehavior. * Mirrors chromeos::settings::PowerHandler::IdleBehavior.
* @enum {number} * @enum {number}
*/ */
settings.IdleBehavior = { const IdleBehavior = {
DISPLAY_OFF_SLEEP: 0, DISPLAY_OFF_SLEEP: 0,
DISPLAY_OFF: 1, DISPLAY_OFF: 1,
DISPLAY_ON: 2, DISPLAY_ON: 2,
OTHER: 3, OTHER: 3,
}; };
/** /**
* Mirrors chromeos::PowerPolicyController::Action. * Mirrors chromeos::PowerPolicyController::Action.
* @enum {number} * @enum {number}
*/ */
settings.LidClosedBehavior = { const LidClosedBehavior = {
SUSPEND: 0, SUSPEND: 0,
STOP_SESSION: 1, STOP_SESSION: 1,
SHUT_DOWN: 2, SHUT_DOWN: 2,
DO_NOTHING: 3, DO_NOTHING: 3,
}; };
/** /**
* @typedef {{ * @typedef {{
* idleBehavior: settings.IdleBehavior, * idleBehavior: settings.IdleBehavior,
* idleControlled: boolean, * idleControlled: boolean,
...@@ -56,37 +54,34 @@ settings.LidClosedBehavior = { ...@@ -56,37 +54,34 @@ settings.LidClosedBehavior = {
* hasLid: boolean, * hasLid: boolean,
* }} * }}
*/ */
settings.PowerManagementSettings; let PowerManagementSettings;
/** /**
* A note app's availability for running as note handler app from lock screen. * A note app's availability for running as note handler app from lock screen.
* Mirrors chromeos::NoteTakingLockScreenSupport. * Mirrors chromeos::NoteTakingLockScreenSupport.
* @enum {number} * @enum {number}
*/ */
settings.NoteAppLockScreenSupport = { const NoteAppLockScreenSupport =
NOT_SUPPORTED: 0, {NOT_SUPPORTED: 0, NOT_ALLOWED_BY_POLICY: 1, SUPPORTED: 2, ENABLED: 3};
NOT_ALLOWED_BY_POLICY: 1,
SUPPORTED: 2, /**
ENABLED: 3 * @typedef {{
}; * name:string,
/**
* @typedef {{name:string,
* value:string, * value:string,
* preferred:boolean, * preferred:boolean,
* lockScreenSupport: settings.NoteAppLockScreenSupport}} * lockScreenSupport: settings.NoteAppLockScreenSupport,
* }}
*/ */
settings.NoteAppInfo; let NoteAppInfo;
/** /**
* @typedef {{ * @typedef {{
* label: string, * label: string,
* uuid: string * uuid: string
* }} * }}
*/ */
settings.ExternalStorage; let ExternalStorage;
cr.define('settings', function() {
/** @interface */ /** @interface */
class DevicePageBrowserProxy { class DevicePageBrowserProxy {
/** Initializes the mouse and touchpad handler. */ /** Initializes the mouse and touchpad handler. */
...@@ -267,7 +262,15 @@ cr.define('settings', function() { ...@@ -267,7 +262,15 @@ cr.define('settings', function() {
cr.addSingletonGetter(DevicePageBrowserProxyImpl); cr.addSingletonGetter(DevicePageBrowserProxyImpl);
return { return {
DevicePageBrowserProxy: DevicePageBrowserProxy, BatteryStatus,
DevicePageBrowserProxyImpl: DevicePageBrowserProxyImpl, DevicePageBrowserProxy,
DevicePageBrowserProxyImpl,
ExternalStorage,
IdleBehavior,
LidClosedBehavior,
NoteAppInfo,
NoteAppLockScreenSupport,
PowerManagementSettings,
PowerSource,
}; };
}); });
...@@ -2,25 +2,16 @@ ...@@ -2,25 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** cr.define('settings', function() {
* @fileoverview /**
* 'settings-storage' is the settings subpage for storage settings.
*/
cr.exportPath('settings');
/**
* Enumeration for device state about remaining space. * Enumeration for device state about remaining space.
* These values must be kept in sync with * These values must be kept in sync with
* StorageManagerHandler::StorageSpaceState in C++ code. * StorageManagerHandler::StorageSpaceState in C++ code.
* @enum {number} * @enum {number}
*/ */
settings.StorageSpaceState = { const StorageSpaceState = {NORMAL: 0, LOW: 1, CRITICALLY_LOW: 2};
NORMAL: 0,
LOW: 1,
CRITICALLY_LOW: 2
};
/** /**
* @typedef {{ * @typedef {{
* totalSize: string, * totalSize: string,
* availableSize: string, * availableSize: string,
...@@ -29,7 +20,10 @@ settings.StorageSpaceState = { ...@@ -29,7 +20,10 @@ settings.StorageSpaceState = {
* spaceState: settings.StorageSpaceState, * spaceState: settings.StorageSpaceState,
* }} * }}
*/ */
settings.StorageSizeStat; let StorageSizeStat;
return {StorageSpaceState, StorageSizeStat};
});
Polymer({ Polymer({
is: 'settings-storage', is: 'settings-storage',
......
...@@ -2,23 +2,21 @@ ...@@ -2,23 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
cr.exportPath('settings'); cr.define('settings', function() {
/**
/**
* An object containing messages for web permissisions origin * An object containing messages for web permissisions origin
* and the messages multidevice feature state. * and the messages multidevice feature state.
* *
* @typedef {{origin: string, * @typedef {{origin: string,
* enabled: boolean}} * enabled: boolean}}
*/ */
settings.AndroidSmsInfo; let AndroidSmsInfo;
cr.define('settings', function() {
/** @interface */ /** @interface */
class MultiDeviceBrowserProxy { class MultiDeviceBrowserProxy {
showMultiDeviceSetupDialog() {} showMultiDeviceSetupDialog() {}
/** @return {!Promise<!MultiDevicePageContentData>} */ /** @return {!Promise<!settings.MultiDevicePageContentData>} */
getPageContentData() {} getPageContentData() {}
/** /**
...@@ -132,7 +130,8 @@ cr.define('settings', function() { ...@@ -132,7 +130,8 @@ cr.define('settings', function() {
cr.addSingletonGetter(MultiDeviceBrowserProxyImpl); cr.addSingletonGetter(MultiDeviceBrowserProxyImpl);
return { return {
MultiDeviceBrowserProxy: MultiDeviceBrowserProxy, AndroidSmsInfo,
MultiDeviceBrowserProxyImpl: MultiDeviceBrowserProxyImpl, MultiDeviceBrowserProxy,
MultiDeviceBrowserProxyImpl,
}; };
}); });
...@@ -49,25 +49,18 @@ cr.define('settings', function() { ...@@ -49,25 +49,18 @@ cr.define('settings', function() {
FURTHER_SETUP_REQUIRED: 8, FURTHER_SETUP_REQUIRED: 8,
}; };
return { /**
MultiDeviceSettingsMode: MultiDeviceSettingsMode,
MultiDeviceFeature: MultiDeviceFeature,
MultiDeviceFeatureState: MultiDeviceFeatureState,
};
});
/**
* Container for the initial data that the page requires in order to display * Container for the initial data that the page requires in order to display
* the correct content. It is also used for receiving status updates during * the correct content. It is also used for receiving status updates during
* use. Note that the host device may be verified (enabled or disabled), * use. Note that the host device may be verified (enabled or disabled),
* awaiting verification, or it may have failed setup because it was not able * awaiting verification, or it may have failed setup because it was not able
* to connect to the server. * to connect to the server.
* *
* For each MultiDevice feature (including the "suite" feature, which acts as a * For each MultiDevice feature (including the "suite" feature, which acts as
* gatekeeper for the others), the corresponding *State property is an enum * a gatekeeper for the others), the corresponding *State property is an enum
* containing the data necessary to display it. Note that hostDeviceName should * containing the data necessary to display it. Note that hostDeviceName
* be undefined if and only if no host has been set up, regardless of whether * should be undefined if and only if no host has been set up, regardless of
* there are potential hosts on the account. * whether there are potential hosts on the account.
* *
* @typedef {{ * @typedef {{
* mode: !settings.MultiDeviceSettingsMode, * mode: !settings.MultiDeviceSettingsMode,
...@@ -79,4 +72,12 @@ cr.define('settings', function() { ...@@ -79,4 +72,12 @@ cr.define('settings', function() {
* isAndroidSmsPairingComplete: boolean * isAndroidSmsPairingComplete: boolean
* }} * }}
*/ */
let MultiDevicePageContentData; let MultiDevicePageContentData;
return {
MultiDeviceSettingsMode,
MultiDeviceFeature,
MultiDeviceFeatureState,
MultiDevicePageContentData,
};
});
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
cr.exportPath('settings'); cr.define('settings', function() {
/**
/**
* @enum {number} * @enum {number}
* These values must be kept in sync with the values in * These values must be kept in sync with the values in
* third_party/cros_system_api/dbus/service_constants.h. * third_party/cros_system_api/dbus/service_constants.h.
*/ */
settings.FingerprintResultType = { const FingerprintResultType = {
SUCCESS: 0, SUCCESS: 0,
PARTIAL: 1, PARTIAL: 1,
INSUFFICIENT: 2, INSUFFICIENT: 2,
...@@ -17,9 +16,9 @@ settings.FingerprintResultType = { ...@@ -17,9 +16,9 @@ settings.FingerprintResultType = {
TOO_SLOW: 4, TOO_SLOW: 4,
TOO_FAST: 5, TOO_FAST: 5,
IMMOBILE: 6, IMMOBILE: 6,
}; };
/** /**
* An object describing a attempt from the fingerprint hardware. The structure * An object describing a attempt from the fingerprint hardware. The structure
* of this data must be kept in sync with C++ FingerprintHandler. * of this data must be kept in sync with C++ FingerprintHandler.
* @typedef {{ * @typedef {{
...@@ -27,9 +26,9 @@ settings.FingerprintResultType = { ...@@ -27,9 +26,9 @@ settings.FingerprintResultType = {
* indexes: !Array<number>, * indexes: !Array<number>,
* }} * }}
*/ */
settings.FingerprintAttempt; let FingerprintAttempt;
/** /**
* An object describing a scan from the fingerprint hardware. The structure of * An object describing a scan from the fingerprint hardware. The structure of
* this data must be kept in sync with C++ FingerprintHandler. * this data must be kept in sync with C++ FingerprintHandler.
* @typedef {{ * @typedef {{
...@@ -38,9 +37,9 @@ settings.FingerprintAttempt; ...@@ -38,9 +37,9 @@ settings.FingerprintAttempt;
* percentComplete: number, * percentComplete: number,
* }} * }}
*/ */
settings.FingerprintScan; let FingerprintScan;
/** /**
* An object describing the necessary info to display on the fingerprint * An object describing the necessary info to display on the fingerprint
* settings. The structure of this data must be kept in sync with * settings. The structure of this data must be kept in sync with
* C++ FingerprintHandler. * C++ FingerprintHandler.
...@@ -49,9 +48,8 @@ settings.FingerprintScan; ...@@ -49,9 +48,8 @@ settings.FingerprintScan;
* isMaxed: boolean, * isMaxed: boolean,
* }} * }}
*/ */
settings.FingerprintInfo; let FingerprintInfo;
cr.define('settings', function() {
/** @interface */ /** @interface */
class FingerprintBrowserProxy { class FingerprintBrowserProxy {
/** /**
...@@ -159,7 +157,11 @@ cr.define('settings', function() { ...@@ -159,7 +157,11 @@ cr.define('settings', function() {
cr.addSingletonGetter(FingerprintBrowserProxyImpl); cr.addSingletonGetter(FingerprintBrowserProxyImpl);
return { return {
FingerprintBrowserProxy: FingerprintBrowserProxy, FingerprintAttempt,
FingerprintBrowserProxyImpl: FingerprintBrowserProxyImpl, FingerprintBrowserProxy,
FingerprintBrowserProxyImpl,
FingerprintInfo,
FingerprintResultType,
FingerprintScan,
}; };
}); });
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
* the "People" section of Settings, to interact with the browser. Chrome OS * the "People" section of Settings, to interact with the browser. Chrome OS
* only. * only.
*/ */
cr.exportPath('settings');
/** cr.define('settings', function() {
/**
* Information for a Chrome OS Kerberos account. * Information for a Chrome OS Kerberos account.
* @typedef {{ * @typedef {{
* principalName: string, * principalName: string,
...@@ -22,9 +22,9 @@ cr.exportPath('settings'); ...@@ -22,9 +22,9 @@ cr.exportPath('settings');
* validForDuration: string * validForDuration: string
* }} * }}
*/ */
settings.KerberosAccount; let KerberosAccount;
/** /**
* @typedef {{ * @typedef {{
* error: !settings.KerberosErrorType, * error: !settings.KerberosErrorType,
* errorInfo: !{ * errorInfo: !{
...@@ -33,9 +33,8 @@ settings.KerberosAccount; ...@@ -33,9 +33,8 @@ settings.KerberosAccount;
* } * }
* }} * }}
*/ */
settings.ValidateKerberosConfigResult; let ValidateKerberosConfigResult;
cr.define('settings', function() {
/** /**
* @enum {number} * @enum {number}
* These values must be kept in sync with the ErrorType enum in * These values must be kept in sync with the ErrorType enum in
...@@ -163,9 +162,11 @@ cr.define('settings', function() { ...@@ -163,9 +162,11 @@ cr.define('settings', function() {
cr.addSingletonGetter(KerberosAccountsBrowserProxyImpl); cr.addSingletonGetter(KerberosAccountsBrowserProxyImpl);
return { return {
KerberosErrorType: KerberosErrorType, KerberosAccount,
KerberosConfigErrorCode: KerberosConfigErrorCode, KerberosErrorType,
KerberosAccountsBrowserProxy: KerberosAccountsBrowserProxy, KerberosConfigErrorCode,
KerberosAccountsBrowserProxyImpl: KerberosAccountsBrowserProxyImpl, KerberosAccountsBrowserProxy,
KerberosAccountsBrowserProxyImpl,
ValidateKerberosConfigResult,
}; };
}); });
...@@ -2,13 +2,8 @@ ...@@ -2,13 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** cr.define('settings', function() {
* @fileoverview A helper object to get the status of the sync backend and user /**
* preferences on what data to sync.
*/
cr.exportPath('settings');
/**
* User preferences for OS sync. 'Registered' means the user has the option to * User preferences for OS sync. 'Registered' means the user has the option to
* select a type. For example, a type might not be registered due to a feature * select a type. For example, a type might not be registered due to a feature
* flag being disabled. * flag being disabled.
...@@ -27,9 +22,8 @@ cr.exportPath('settings'); ...@@ -27,9 +22,8 @@ cr.exportPath('settings');
* wifiConfigurationsSynced: boolean, * wifiConfigurationsSynced: boolean,
* }} * }}
*/ */
settings.OsSyncPrefs; let OsSyncPrefs;
cr.define('settings', function() {
/** @interface */ /** @interface */
class OsSyncBrowserProxy { class OsSyncBrowserProxy {
/** /**
...@@ -86,7 +80,8 @@ cr.define('settings', function() { ...@@ -86,7 +80,8 @@ cr.define('settings', function() {
cr.addSingletonGetter(OsSyncBrowserProxyImpl); cr.addSingletonGetter(OsSyncBrowserProxyImpl);
return { return {
OsSyncBrowserProxy: OsSyncBrowserProxy, OsSyncBrowserProxy,
OsSyncBrowserProxyImpl: OsSyncBrowserProxyImpl, OsSyncBrowserProxyImpl,
OsSyncPrefs,
}; };
}); });
...@@ -2,14 +2,8 @@ ...@@ -2,14 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** cr.define('settings', function() {
* @fileoverview A helper object used from the Incompatible Applications section /**
* to interact with the browser.
*/
cr.exportPath('settings');
/**
* All possible actions to take on an incompatible application. * All possible actions to take on an incompatible application.
* *
* Must be kept in sync with BlacklistMessageType in * Must be kept in sync with BlacklistMessageType in
...@@ -17,22 +11,21 @@ cr.exportPath('settings'); ...@@ -17,22 +11,21 @@ cr.exportPath('settings');
* @readonly * @readonly
* @enum {number} * @enum {number}
*/ */
settings.ActionTypes = { const ActionTypes = {
UNINSTALL: 0, UNINSTALL: 0,
MORE_INFO: 1, MORE_INFO: 1,
UPGRADE: 2, UPGRADE: 2,
}; };
/** /**
* @typedef {{ * @typedef {{
* name: string, * name: string,
* actionType: {settings.ActionTypes}, * actionType: {settings.ActionTypes},
* actionUrl: string, * actionUrl: string,
* }} * }}
*/ */
settings.IncompatibleApplication; let IncompatibleApplication;
cr.define('settings', function() {
/** @interface */ /** @interface */
class IncompatibleApplicationsBrowserProxy { class IncompatibleApplicationsBrowserProxy {
/** /**
...@@ -116,8 +109,9 @@ cr.define('settings', function() { ...@@ -116,8 +109,9 @@ cr.define('settings', function() {
cr.addSingletonGetter(IncompatibleApplicationsBrowserProxyImpl); cr.addSingletonGetter(IncompatibleApplicationsBrowserProxyImpl);
return { return {
IncompatibleApplicationsBrowserProxy: IncompatibleApplicationsBrowserProxy, ActionTypes,
IncompatibleApplicationsBrowserProxyImpl: IncompatibleApplication,
IncompatibleApplicationsBrowserProxy,
IncompatibleApplicationsBrowserProxyImpl, IncompatibleApplicationsBrowserProxyImpl,
}; };
}); });
...@@ -2,14 +2,8 @@ ...@@ -2,14 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** cr.define('settings', function() {
* @fileoverview A helper object used from the "Google Accounts" subsection of /**
* the "People" section of Settings, to interact with the browser. Chrome OS
* only.
*/
cr.exportPath('settings');
/**
* Information for an account managed by Chrome OS AccountManager. * Information for an account managed by Chrome OS AccountManager.
* @typedef {{ * @typedef {{
* id: string, * id: string,
...@@ -23,9 +17,8 @@ cr.exportPath('settings'); ...@@ -23,9 +17,8 @@ cr.exportPath('settings');
* organization: (string|undefined), * organization: (string|undefined),
* }} * }}
*/ */
settings.Account; let Account;
cr.define('settings', function() {
/** @interface */ /** @interface */
class AccountManagerBrowserProxy { class AccountManagerBrowserProxy {
/** /**
...@@ -41,17 +34,17 @@ cr.define('settings', function() { ...@@ -41,17 +34,17 @@ cr.define('settings', function() {
/** /**
* Triggers the re-authentication flow for the account pointed to by * Triggers the re-authentication flow for the account pointed to by
* |account_email|. * |accountEmail|.
* @param {string} account_email * @param {string} accountEmail
*/ */
reauthenticateAccount(account_email) {} reauthenticateAccount(accountEmail) {}
/** /**
* Triggers the migration dialog for the account pointed to by * Triggers the migration dialog for the account pointed to by
* |account_email|. * |accountEmail|.
* @param {string} account_email * @param {string} accountEmail
*/ */
migrateAccount(account_email) {} migrateAccount(accountEmail) {}
/** /**
* Removes |account| from Account Manager. * Removes |account| from Account Manager.
...@@ -80,13 +73,13 @@ cr.define('settings', function() { ...@@ -80,13 +73,13 @@ cr.define('settings', function() {
} }
/** @override */ /** @override */
reauthenticateAccount(account_email) { reauthenticateAccount(accountEmail) {
chrome.send('reauthenticateAccount', [account_email]); chrome.send('reauthenticateAccount', [accountEmail]);
} }
/** @override */ /** @override */
migrateAccount(account_email) { migrateAccount(accountEmail) {
chrome.send('migrateAccount', [account_email]); chrome.send('migrateAccount', [accountEmail]);
} }
/** @override */ /** @override */
...@@ -103,7 +96,8 @@ cr.define('settings', function() { ...@@ -103,7 +96,8 @@ cr.define('settings', function() {
cr.addSingletonGetter(AccountManagerBrowserProxyImpl); cr.addSingletonGetter(AccountManagerBrowserProxyImpl);
return { return {
AccountManagerBrowserProxy: AccountManagerBrowserProxy, Account,
AccountManagerBrowserProxyImpl: AccountManagerBrowserProxyImpl, AccountManagerBrowserProxy,
AccountManagerBrowserProxyImpl,
}; };
}); });
...@@ -2,13 +2,8 @@ ...@@ -2,13 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** cr.define('settings', function() {
* @fileoverview A helper object used from the "Change Picture" subpage of /**
* the People section to interact with the browser. ChromeOS only.
*/
cr.exportPath('settings');
/**
* An object describing a default image. * An object describing a default image.
* @typedef {{ * @typedef {{
* author: (string|undefined), * author: (string|undefined),
...@@ -18,9 +13,8 @@ cr.exportPath('settings'); ...@@ -18,9 +13,8 @@ cr.exportPath('settings');
* website: (string|undefined) * website: (string|undefined)
* }} * }}
*/ */
settings.DefaultImage; let DefaultImage;
cr.define('settings', function() {
/** @interface */ /** @interface */
class ChangePictureBrowserProxy { class ChangePictureBrowserProxy {
/** /**
...@@ -113,7 +107,8 @@ cr.define('settings', function() { ...@@ -113,7 +107,8 @@ cr.define('settings', function() {
cr.addSingletonGetter(ChangePictureBrowserProxyImpl); cr.addSingletonGetter(ChangePictureBrowserProxyImpl);
return { return {
ChangePictureBrowserProxy: ChangePictureBrowserProxy, ChangePictureBrowserProxy,
ChangePictureBrowserProxyImpl: ChangePictureBrowserProxyImpl, ChangePictureBrowserProxyImpl,
DefaultImage,
}; };
}); });
...@@ -2,13 +2,8 @@ ...@@ -2,13 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** cr.define('settings', function() {
* @fileoverview A helper object used from the the Import Data dialog to allow /**
* users to import data (like bookmarks) from other web browsers.
*/
cr.exportPath('settings');
/**
* An object describing a source browser profile that may be imported. * An object describing a source browser profile that may be imported.
* The structure of this data must be kept in sync with C++ ImportDataHandler. * The structure of this data must be kept in sync with C++ ImportDataHandler.
* @typedef {{ * @typedef {{
...@@ -21,20 +16,19 @@ cr.exportPath('settings'); ...@@ -21,20 +16,19 @@ cr.exportPath('settings');
* autofillFormData: boolean, * autofillFormData: boolean,
* }} * }}
*/ */
settings.BrowserProfile; let BrowserProfile;
/** /**
* @enum {string} * @enum {string}
* These string values must be kept in sync with the C++ ImportDataHandler. * These string values must be kept in sync with the C++ ImportDataHandler.
*/ */
settings.ImportDataStatus = { const ImportDataStatus = {
INITIAL: 'initial', INITIAL: 'initial',
IN_PROGRESS: 'inProgress', IN_PROGRESS: 'inProgress',
SUCCEEDED: 'succeeded', SUCCEEDED: 'succeeded',
FAILED: 'failed', FAILED: 'failed',
}; };
cr.define('settings', function() {
/** @interface */ /** @interface */
class ImportDataBrowserProxy { class ImportDataBrowserProxy {
/** /**
...@@ -81,7 +75,9 @@ cr.define('settings', function() { ...@@ -81,7 +75,9 @@ cr.define('settings', function() {
cr.addSingletonGetter(ImportDataBrowserProxyImpl); cr.addSingletonGetter(ImportDataBrowserProxyImpl);
return { return {
ImportDataBrowserProxy: ImportDataBrowserProxy, BrowserProfile,
ImportDataBrowserProxyImpl: ImportDataBrowserProxyImpl, ImportDataStatus,
ImportDataBrowserProxy,
ImportDataBrowserProxyImpl,
}; };
}); });
...@@ -2,23 +2,16 @@ ...@@ -2,23 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** cr.define('settings', function() {
* @fileoverview A helper object used from the the People section to get the /**
* profile info, which consists of the profile name and icon. Used for both
* Chrome browser and ChromeOS.
*/
cr.exportPath('settings');
/**
* An object describing the profile. * An object describing the profile.
* @typedef {{ * @typedef {{
* name: string, * name: string,
* iconUrl: string * iconUrl: string
* }} * }}
*/ */
settings.ProfileInfo; let ProfileInfo;
cr.define('settings', function() {
/** @interface */ /** @interface */
class ProfileInfoBrowserProxy { class ProfileInfoBrowserProxy {
/** /**
...@@ -51,7 +44,5 @@ cr.define('settings', function() { ...@@ -51,7 +44,5 @@ cr.define('settings', function() {
cr.addSingletonGetter(ProfileInfoBrowserProxyImpl); cr.addSingletonGetter(ProfileInfoBrowserProxyImpl);
return { return {ProfileInfo, ProfileInfoBrowserProxyImpl};
ProfileInfoBrowserProxyImpl: ProfileInfoBrowserProxyImpl,
};
}); });
...@@ -2,23 +2,17 @@ ...@@ -2,23 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/** cr.define('settings', function() {
* @fileoverview A helper object used from the the People section to get the /**
* status of the sync backend and user preferences on what data to sync. Used
* for both Chrome browser and ChromeOS.
*/
cr.exportPath('settings');
/**
* @typedef {{fullName: (string|undefined), * @typedef {{fullName: (string|undefined),
* givenName: (string|undefined), * givenName: (string|undefined),
* email: string, * email: string,
* avatarImage: (string|undefined)}} * avatarImage: (string|undefined)}}
* @see chrome/browser/ui/webui/settings/people_handler.cc * @see chrome/browser/ui/webui/settings/people_handler.cc
*/ */
settings.StoredAccount; let StoredAccount;
/** /**
* @typedef {{childUser: (boolean|undefined), * @typedef {{childUser: (boolean|undefined),
* disabled: (boolean|undefined), * disabled: (boolean|undefined),
* domain: (string|undefined), * domain: (string|undefined),
...@@ -37,15 +31,14 @@ settings.StoredAccount; ...@@ -37,15 +31,14 @@ settings.StoredAccount;
* syncSystemEnabled: (boolean|undefined)}} * syncSystemEnabled: (boolean|undefined)}}
* @see chrome/browser/ui/webui/settings/people_handler.cc * @see chrome/browser/ui/webui/settings/people_handler.cc
*/ */
settings.SyncStatus; let SyncStatus;
/** /**
* Must be kept in sync with the return values of getSyncErrorAction in * Must be kept in sync with the return values of getSyncErrorAction in
* chrome/browser/ui/webui/settings/people_handler.cc * chrome/browser/ui/webui/settings/people_handler.cc
* @enum {string} * @enum {string}
*/ */
settings.StatusAction = { const StatusAction = {
NO_ACTION: 'noAction', // No action to take. NO_ACTION: 'noAction', // No action to take.
REAUTHENTICATE: 'reauthenticate', // User needs to reauthenticate. REAUTHENTICATE: 'reauthenticate', // User needs to reauthenticate.
SIGNOUT_AND_SIGNIN: SIGNOUT_AND_SIGNIN:
...@@ -56,9 +49,9 @@ settings.StatusAction = { ...@@ -56,9 +49,9 @@ settings.StatusAction = {
RETRIEVE_TRUSTED_VAULT_KEYS: 'retrieveTrustedVaultKeys', RETRIEVE_TRUSTED_VAULT_KEYS: 'retrieveTrustedVaultKeys',
CONFIRM_SYNC_SETTINGS: CONFIRM_SYNC_SETTINGS:
'confirmSyncSettings', // User needs to confirm sync settings. 'confirmSyncSettings', // User needs to confirm sync settings.
}; };
/** /**
* The state of sync. This is the data structure sent back and forth between * The state of sync. This is the data structure sent back and forth between
* C++ and JS. Its naming and structure is not optimal, but changing it would * C++ and JS. Its naming and structure is not optimal, but changing it would
* require changes to the C++ handler, which is already functional. * require changes to the C++ handler, which is already functional.
...@@ -93,20 +86,17 @@ settings.StatusAction = { ...@@ -93,20 +86,17 @@ settings.StatusAction = {
* typedUrlsSynced: boolean, * typedUrlsSynced: boolean,
* }} * }}
*/ */
settings.SyncPrefs; let SyncPrefs;
/** /** @enum {string} */
* @enum {string} const PageStatus = {
*/
settings.PageStatus = {
SPINNER: 'spinner', // Before the page has loaded. SPINNER: 'spinner', // Before the page has loaded.
CONFIGURE: 'configure', // Preferences ready to be configured. CONFIGURE: 'configure', // Preferences ready to be configured.
TIMEOUT: 'timeout', // Preferences loading has timed out. TIMEOUT: 'timeout', // Preferences loading has timed out.
DONE: 'done', // Sync subpage can be closed now. DONE: 'done', // Sync subpage can be closed now.
PASSPHRASE_FAILED: 'passphraseFailed', // Error in the passphrase. PASSPHRASE_FAILED: 'passphraseFailed', // Error in the passphrase.
}; };
cr.define('settings', function() {
/** /**
* Key to be used with localStorage. * Key to be used with localStorage.
* @type {string} * @type {string}
...@@ -319,7 +309,12 @@ cr.define('settings', function() { ...@@ -319,7 +309,12 @@ cr.define('settings', function() {
cr.addSingletonGetter(SyncBrowserProxyImpl); cr.addSingletonGetter(SyncBrowserProxyImpl);
return { return {
SyncBrowserProxy: SyncBrowserProxy, PageStatus,
SyncBrowserProxyImpl: SyncBrowserProxyImpl, StatusAction,
StoredAccount,
SyncBrowserProxy,
SyncBrowserProxyImpl,
SyncPrefs,
SyncStatus,
}; };
}); });
...@@ -2,15 +2,17 @@ ...@@ -2,15 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
cr.exportPath('settings'); cr.define('settings', function() {
/**
/**
* @typedef {{ * @typedef {{
* enabled: boolean, * enabled: boolean,
* pref: !chrome.settingsPrivate.PrefObject * pref: !chrome.settingsPrivate.PrefObject
* }} * }}
*/ */
let BlockAutoplayStatus; let BlockAutoplayStatus;
return {BlockAutoplayStatus};
});
/** /**
* @fileoverview * @fileoverview
...@@ -142,11 +144,11 @@ Polymer({ ...@@ -142,11 +144,11 @@ Polymer({
} }
}, },
/** @private {BlockAutoplayStatus} */ /** @private {settings.BlockAutoplayStatus} */
blockAutoplayStatus_: { blockAutoplayStatus_: {
type: Object, type: Object,
value: function() { value: function() {
return /** @type {BlockAutoplayStatus} */ ({}); return /** @type {settings.BlockAutoplayStatus} */ ({});
} }
}, },
...@@ -323,7 +325,7 @@ Polymer({ ...@@ -323,7 +325,7 @@ Polymer({
/** /**
* Called when the block autoplay status changes. * Called when the block autoplay status changes.
* @param {BlockAutoplayStatus} autoplayStatus * @param {settings.BlockAutoplayStatus} autoplayStatus
* @private * @private
*/ */
onBlockAutoplayStatusChanged_: function(autoplayStatus) { onBlockAutoplayStatusChanged_: function(autoplayStatus) {
......
...@@ -68,7 +68,7 @@ Polymer({ ...@@ -68,7 +68,7 @@ Polymer({
/** /**
* The list of enrollments displayed. * The list of enrollments displayed.
* @private {!Array<!Enrollment>} * @private {!Array<!settings.Enrollment>}
*/ */
enrollments_: Array, enrollments_: Array,
...@@ -135,7 +135,7 @@ Polymer({ ...@@ -135,7 +135,7 @@ Polymer({
/** /**
* @private * @private
* @param {!Array<!Enrollment>} enrollments * @param {!Array<!settings.Enrollment>} enrollments
*/ */
onEnrollments_: function(enrollments) { onEnrollments_: function(enrollments) {
this.enrollments_ = enrollments; this.enrollments_ = enrollments;
...@@ -210,10 +210,10 @@ Polymer({ ...@@ -210,10 +210,10 @@ Polymer({
/** /**
* @private * @private
* @param {!EnrollmentStatus} response * @param {!settings.EnrollmentStatus} response
*/ */
onEnrolling_: function(response) { onEnrolling_: function(response) {
if (response.code == Ctap2Status.ERR_KEEPALIVE_CANCEL) { if (response.code == settings.Ctap2Status.ERR_KEEPALIVE_CANCEL) {
this.showEnrollmentsPage_(); this.showEnrollmentsPage_();
return; return;
} }
......
...@@ -2,21 +2,20 @@ ...@@ -2,21 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
cr.exportPath('settings'); cr.define('settings', function() {
/**
/**
* Ctap2Status contains a subset of CTAP2 status codes. See * Ctap2Status contains a subset of CTAP2 status codes. See
* device::CtapDeviceResponseCode for the full list. * device::CtapDeviceResponseCode for the full list.
* @enum {number} * @enum {number}
*/ */
const Ctap2Status = { const Ctap2Status = {
OK: 0x0, OK: 0x0,
ERR_KEEPALIVE_CANCEL: 0x2D, ERR_KEEPALIVE_CANCEL: 0x2D,
}; };
/** /**
* Credential represents a CTAP2 resident credential enumerated from a security * Credential represents a CTAP2 resident credential enumerated from a
* key. * security key.
* *
* id: (required) The hex encoding of the CBOR-serialized * id: (required) The hex encoding of the CBOR-serialized
* PublicKeyCredentialDescriptor of the credential. * PublicKeyCredentialDescriptor of the credential.
...@@ -34,13 +33,14 @@ const Ctap2Status = { ...@@ -34,13 +33,14 @@ const Ctap2Status = {
* userDisplayName: string}} * userDisplayName: string}}
* @see chrome/browser/ui/webui/settings/settings_security_key_handler.cc * @see chrome/browser/ui/webui/settings/settings_security_key_handler.cc
*/ */
let Credential; let Credential;
/** /**
* EnrollmentStatus represents the current status of an enrollment suboperation, * EnrollmentStatus represents the current status of an enrollment
* where 'remaining' is the number of samples left, 'status' is the last * suboperation, where 'remaining' is the number of samples left, 'status' is
* enrollment status, 'code' indicates the final CtapDeviceResponseCode of the * the last enrollment status, 'code' indicates the final
* operation, and 'enrollment' contains the new Enrollment. * CtapDeviceResponseCode of the operation, and 'enrollment' contains the new
* Enrollment.
* *
* For each enrollment sample, 'status' is set - when the enrollment operation * For each enrollment sample, 'status' is set - when the enrollment operation
* reaches an end state, 'code' and, if successful, 'enrollment' are set. |OK| * reaches an end state, 'code' and, if successful, 'enrollment' are set. |OK|
...@@ -48,24 +48,23 @@ let Credential; ...@@ -48,24 +48,23 @@ let Credential;
* user-initated cancellation. * user-initated cancellation.
* *
* @typedef {{status: ?number, * @typedef {{status: ?number,
* code: ?Ctap2Status, * code: ?settings.Ctap2Status,
* remaining: number, * remaining: number,
* enrollment: ?Enrollment}} * enrollment: ?settings.Enrollment}}
* @see chrome/browser/ui/webui/settings/settings_security_key_handler.cc * @see chrome/browser/ui/webui/settings/settings_security_key_handler.cc
*/ */
let EnrollmentStatus; let EnrollmentStatus;
/** /**
* Enrollment represents a valid fingerprint template stored on a security key, * Enrollment represents a valid fingerprint template stored on a security
* which can be used in a user verification request. * key, which can be used in a user verification request.
* *
* @typedef {{name: string, * @typedef {{name: string,
* id: string}} * id: string}}
* @see chrome/browser/ui/webui/settings/settings_security_key_handler.cc * @see chrome/browser/ui/webui/settings/settings_security_key_handler.cc
*/ */
let Enrollment; let Enrollment;
cr.define('settings', function() {
/** @interface */ /** @interface */
class SecurityKeysPINBrowserProxy { class SecurityKeysPINBrowserProxy {
/** /**
...@@ -121,7 +120,7 @@ cr.define('settings', function() { ...@@ -121,7 +120,7 @@ cr.define('settings', function() {
* Enumerates credentials on the authenticator. A correct PIN must have * Enumerates credentials on the authenticator. A correct PIN must have
* previously been supplied via providePIN() before this * previously been supplied via providePIN() before this
* method may be called. * method may be called.
* @return {!Promise<!Array<!Credential>>} * @return {!Promise<!Array<!settings.Credential>>}
*/ */
enumerateCredentials() {} enumerateCredentials() {}
...@@ -187,7 +186,7 @@ cr.define('settings', function() { ...@@ -187,7 +186,7 @@ cr.define('settings', function() {
* previously been supplied via bioEnrollProvidePIN() before this method may * previously been supplied via bioEnrollProvidePIN() before this method may
* be called. * be called.
* *
* @return {!Promise<!Array<!Enrollment>>} * @return {!Promise<!Array<!settings.Enrollment>>}
*/ */
enumerateEnrollments() {} enumerateEnrollments() {}
...@@ -202,8 +201,8 @@ cr.define('settings', function() { ...@@ -202,8 +201,8 @@ cr.define('settings', function() {
* out waiting for a touch, or has successfully processed a touch. Any * out waiting for a touch, or has successfully processed a touch. Any
* errors will fire the 'security-keys-bio-enrollment-error' WebListener. * errors will fire the 'security-keys-bio-enrollment-error' WebListener.
* *
* @return {!Promise<!EnrollmentStatus>} resolves when the enrollment * @return {!Promise<!settings.EnrollmentStatus>} resolves when the
* operation is finished successfully. * enrollment operation is finished successfully.
*/ */
startEnrolling() {} startEnrolling() {}
...@@ -218,7 +217,8 @@ cr.define('settings', function() { ...@@ -218,7 +217,8 @@ cr.define('settings', function() {
* Deletes the enrollment with the given ID. * Deletes the enrollment with the given ID.
* *
* @param {string} id * @param {string} id
* @return {!Promise<!Array<!Enrollment>>} The remaining enrollments. * @return {!Promise<!Array<!settings.Enrollment>>} The remaining
* enrollments.
*/ */
deleteEnrollment(id) {} deleteEnrollment(id) {}
...@@ -227,7 +227,8 @@ cr.define('settings', function() { ...@@ -227,7 +227,8 @@ cr.define('settings', function() {
* *
* @param {string} id * @param {string} id
* @param {string} name * @param {string} name
* @return {!Promise<!Array<!Enrollment>>} The updated list of enrollments. * @return {!Promise<!Array<!settings.Enrollment>>} The updated list of
* enrollments.
*/ */
renameEnrollment(id, name) {} renameEnrollment(id, name) {}
...@@ -350,14 +351,17 @@ cr.define('settings', function() { ...@@ -350,14 +351,17 @@ cr.define('settings', function() {
cr.addSingletonGetter(SecurityKeysBioEnrollProxyImpl); cr.addSingletonGetter(SecurityKeysBioEnrollProxyImpl);
return { return {
SecurityKeysPINBrowserProxy: SecurityKeysPINBrowserProxy, Credential,
SecurityKeysPINBrowserProxyImpl: SecurityKeysPINBrowserProxyImpl, Ctap2Status,
SecurityKeysCredentialBrowserProxy: SecurityKeysCredentialBrowserProxy, Enrollment,
SecurityKeysCredentialBrowserProxyImpl: EnrollmentStatus,
SecurityKeysBioEnrollProxy,
SecurityKeysBioEnrollProxyImpl,
SecurityKeysCredentialBrowserProxy,
SecurityKeysCredentialBrowserProxyImpl, SecurityKeysCredentialBrowserProxyImpl,
SecurityKeysResetBrowserProxy: SecurityKeysResetBrowserProxy, SecurityKeysPINBrowserProxy,
SecurityKeysResetBrowserProxyImpl: SecurityKeysResetBrowserProxyImpl, SecurityKeysPINBrowserProxyImpl,
SecurityKeysBioEnrollProxy: SecurityKeysBioEnrollProxy, SecurityKeysResetBrowserProxy,
SecurityKeysBioEnrollProxyImpl: SecurityKeysBioEnrollProxyImpl, SecurityKeysResetBrowserProxyImpl,
}; };
}); });
...@@ -47,7 +47,7 @@ Polymer({ ...@@ -47,7 +47,7 @@ Polymer({
/** /**
* The list of credentials displayed in the dialog. * The list of credentials displayed in the dialog.
* @private {!Array<!Credential>} * @private {!Array<!settings.Credential>}
*/ */
credentials_: Array, credentials_: Array,
...@@ -125,7 +125,7 @@ Polymer({ ...@@ -125,7 +125,7 @@ Polymer({
/** /**
* @private * @private
* @param {!Array<!Credential>} credentials * @param {!Array<!settings.Credential>} credentials
*/ */
onCredentials_: function(credentials) { onCredentials_: function(credentials) {
if (!credentials.length) { if (!credentials.length) {
...@@ -193,7 +193,7 @@ Polymer({ ...@@ -193,7 +193,7 @@ Polymer({
/** /**
* Stringifies the user entity of a Credential for display in the dialog. * Stringifies the user entity of a Credential for display in the dialog.
* @private * @private
* @param {!Credential} credential * @param {!settings.Credential} credential
* @return {string} * @return {string}
*/ */
formatUser_: function(credential) { formatUser_: function(credential) {
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
cr.exportPath('settings'); cr.define('settings', function() {
/**
/**
* A data structure used by callers to combine the results of multiple search * A data structure used by callers to combine the results of multiple search
* requests. * requests.
* *
...@@ -14,9 +13,8 @@ cr.exportPath('settings'); ...@@ -14,9 +13,8 @@ cr.exportPath('settings');
* wasClearSearch: Boolean, * wasClearSearch: Boolean,
* }} * }}
*/ */
settings.SearchResult; let SearchResult;
cr.define('settings', function() {
/** /**
* A CSS attribute indicating that a node should be ignored during searching. * A CSS attribute indicating that a node should be ignored during searching.
* @type {string} * @type {string}
...@@ -621,8 +619,9 @@ cr.define('settings', function() { ...@@ -621,8 +619,9 @@ cr.define('settings', function() {
} }
return { return {
getSearchManager: getSearchManager, getSearchManager,
setSearchManagerForTesting: setSearchManagerForTesting, setSearchManagerForTesting,
SearchRequest: SearchRequest, SearchRequest,
SearchResult,
}; };
}); });
...@@ -912,7 +912,7 @@ suite('SecurityKeysBioEnrollment', function() { ...@@ -912,7 +912,7 @@ suite('SecurityKeysBioEnrollment', function() {
test_util.eventToPromise('bio-enroll-dialog-ready-for-testing', dialog); test_util.eventToPromise('bio-enroll-dialog-ready-for-testing', dialog);
dialog.$.cancelButton.click(); dialog.$.cancelButton.click();
await browserProxy.whenCalled('cancelEnrollment'); await browserProxy.whenCalled('cancelEnrollment');
enrollResolver.resolve({code: Ctap2Status.ERR_KEEPALIVE_CANCEL}); enrollResolver.resolve({code: settings.Ctap2Status.ERR_KEEPALIVE_CANCEL});
await browserProxy.whenCalled('enumerateEnrollments'); await browserProxy.whenCalled('enumerateEnrollments');
await uiReady; await uiReady;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment