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

Unified Diff: third_party/closure_compiler/externs/chrome_extensions.js

Issue 1030963003: Use networkingPrivate types in JS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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: third_party/closure_compiler/externs/chrome_extensions.js
diff --git a/third_party/closure_compiler/externs/chrome_extensions.js b/third_party/closure_compiler/externs/chrome_extensions.js
index 5026048f1b0e93b584d719973eba73cd03f12fe6..37a913b34c2499c1a1182f8eb1e4eddef3f94fae 100644
--- a/third_party/closure_compiler/externs/chrome_extensions.js
+++ b/third_party/closure_compiler/externs/chrome_extensions.js
@@ -8396,33 +8396,105 @@ chrome.mediaGalleriesPrivate.GalleryChangeEvent.prototype.hasListeners =
/**
- * WARNING(2014/08/04): This API is still under active initial development and
- * unstable and has a number of issues:
+ * WARNING(2015/04/09): This API is still under active development and has a few
+ * issues with typing:
*
- * 1. The types NetworkProperties and ManagedNetworkProperties are not defined
- * in the docs; that is, there is no list of fields and their types.
- * Therefore, these types are treated as bags-of-objects, rather than types.
- * 2. According to Steven Bennetts, NetworkProperties *should* be a
- * bag-of-properties as it's a map containing ONC properties and the ONC
- * properties do not follow the JS field naming conventions; specifically,
- * the properties start with an uppercase letter, and at least one property
- * is in all uppercase.
- * 3. The deviceSsid and deviceBssid fields of VerticationProperties are listed
- * as being required while their description mentions "Only set if" which
- * sound optional. The dev team was unclear whether they are required or
- * optional.
- * 4. Some parameters to some functions are marked as being in the Beta channel
- * only (for example, the networkGuid parameter to getCaptivePortalStatus).
+ * 1. See onc_spec.html for ONC property values.
+ * 2. The types NetworkProperties and ManagedNetworkProperties are not currently
+ * defined. They correspond to ONC Property dictionaries. They are treated as
+ * Objects rather than types.
+ * 3. NetworkStateProperties defines a subset of NetworkProperties used by
+ * getState and getNetworks. Since these match ONC property names they
+ * use ONC PascalCase naming conventions instead of traditional JS
+ * camelCase naming.
*
* Because of the above issues, this API should not be used as an example for
- * other APIs added to this file. Please contact mednik@ for questions on and
- * maintenance for this API.
+ * other APIs. Please contact stevenjb@ for questions on and maintenance.
* @const
* @see https://developer.chrome.com/extensions/networkingPrivate
*/
chrome.networkingPrivate = {};
+/** @enum {string} */
+chrome.networkingPrivate.ActivationStateType = {
+ Activated: 'Activated',
+ Activating: 'Activating',
+ NotActivated: 'NotActivated',
+ PartiallyActivated: 'PartiallyActivated',
+};
+
+
+/** @enum {string} */
+chrome.networkingPrivate.ConnectionStateType = {
+ Connected: 'Connected',
+ Connecting: 'Connecting',
+ NotConnected: 'NotConnected',
+};
+
+
+/** @enum {string} */
+chrome.networkingPrivate.IPConfigType = {
+ DHCP: 'DHCP',
+ Static: 'Static'
+};
+
+
+/** @enum {string} */
+chrome.networkingPrivate.NetworkType = {
+ Cellular: 'Cellular',
+ Ethernet: 'Ethernet',
+ VPN: 'VPN',
+ WiFi: 'WiFi',
+ WiMAX: 'WiMAX',
+};
+
+
+/**
+ * @typedef {?{
+ * SignalStrength: number,
+ * OutOfCredits: boolean,
+ * RoamingState: string,
+ * ActivationState: chrome.networkingPrivate.ActivationStateType,
+ * NetworkTechnology: string
+ * }}
+ */
+chrome.networkingPrivate.CellularStateProperties;
+
+
+/**
+ * @typedef {?{
+ * Security: string,
+ * SignalStrength: number
+ * }}
+ */
+chrome.networkingPrivate.WiFiStateProperties;
+
+
+/**
+ * @typedef {?{
+ * SignalStrength: number
+ * }}
+ */
+chrome.networkingPrivate.WiMAXStateProperties;
+
+
+/**
+ * @typedef {?{
+ * Cellular: chrome.networkingPrivate.CellularStateProperties,
+ * Connectable: boolean,
+ * ConnectionState: chrome.networkingPrivate.ConnectionStateType,
+ * ErrorState: string,
+ * GUID: string,
+ * Name: string,
+ * Source: string,
+ * Type: chrome.networkingPrivate.NetworkType,
+ * WiFi: chrome.networkingPrivate.WiFiStateProperties,
+ * WiMAX: chrome.networkingPrivate.WiMAXStateProperties
+ * }}
+ */
+chrome.networkingPrivate.NetworkStateProperties;
+
/**
* @typedef {?{
* certificate: string,
@@ -8464,7 +8536,7 @@ chrome.networkingPrivate.getManagedProperties = function(guid, callback) {};
/**
* @param {string} guid
- * @param {function(!Object)} callback
+ * @param {function(!chrome.networkingPrivate.NetworkStateProperties)} callback
*/
chrome.networkingPrivate.getState = function(guid, callback) {};
@@ -8472,39 +8544,43 @@ chrome.networkingPrivate.getState = function(guid, callback) {};
/**
* @param {string} guid
* @param {!Object} properties
- * @param {function()=} callback
+ * @param {function()=} opt_callback
*/
-chrome.networkingPrivate.setProperties = function(guid, properties, callback) {
-};
+chrome.networkingPrivate.setProperties = function(guid,
+ properties,
+ opt_callback) {};
/**
* @param {boolean} shared
* @param {!Object} properties
- * @param {function(string)} callback Returns guid of the configured
+ * @param {function(string)=} opt_callback Returns guid of the configured
* configuration.
*/
-chrome.networkingPrivate.createNetwork =
- function(shared, properties, callback) {};
+chrome.networkingPrivate.createNetwork = function(shared,
+ properties,
+ opt_callback) {};
/**
* @param {string} guid
- * @param {function()=} opt_callback
+ * @param {function()=} opt_callback Called when the operation has completed.
*/
chrome.networkingPrivate.forgetNetwork = function(guid, opt_callback) {};
/**
* @param {!chrome.networkingPrivate.NetworkFilter} filter
- * @param {function(!Array.<!Object>)=} opt_callback
+ * @param {function(!Array.<!chrome.networkingPrivate.NetworkStateProperties>)=}
+ * opt_callback
*/
chrome.networkingPrivate.getNetworks = function(filter, opt_callback) {};
/**
* @param {string} type
- * @param {function(!Array.<!Object>)=} opt_callback
+ * @param {function(!Array.<!chrome.networkingPrivate.NetworkStateProperties>)=}
+ * opt_callback
*/
chrome.networkingPrivate.getVisibleNetworks = function(type, opt_callback) {};
@@ -8555,8 +8631,8 @@ chrome.networkingPrivate.startActivate =
* @param {!chrome.networkingPrivate.VerificationProperties} verificationInfo
* @param {function(boolean)} callback
*/
-chrome.networkingPrivate.verifyDestination =
- function(verificationInfo, callback) {};
+chrome.networkingPrivate.verifyDestination = function(verificationInfo,
+ callback) {};
/**
@@ -8573,25 +8649,27 @@ chrome.networkingPrivate.verifyAndEncryptCredentials =
* @param {string} data
* @param {function(string)} callback
*/
-chrome.networkingPrivate.verifyAndEncryptData =
- function(verificationInfo, data, callback) {};
+chrome.networkingPrivate.verifyAndEncryptData = function(verificationInfo,
+ data,
+ callback) {};
/**
* @param {string} ipOrMacAddress
* @param {boolean} enabled
- * @param {function(string)} callback
+ * @param {function(string)=} opt_callback
*/
-chrome.networkingPrivate.setWifiTDLSEnabledState =
- function(ipOrMacAddress, enabled, callback) {};
+chrome.networkingPrivate.setWifiTDLSEnabledState = function(ipOrMacAddress,
+ enabled,
+ opt_callback) {};
/**
* @param {string} ipOrMacAddress
* @param {function(string)} callback
*/
-chrome.networkingPrivate.getWifiTDLSStatus =
- function(ipOrMacAddress, callback) {};
+chrome.networkingPrivate.getWifiTDLSStatus = function(ipOrMacAddress,
+ callback) {};
/**
@@ -8612,7 +8690,6 @@ chrome.networkingPrivate.onNetworkListChanged;
/** @type {!ChromeStringStringEvent} */
chrome.networkingPrivate.onPortalDetectionCompleted;
-
/**
* WARNING(2014/08/14): This API is still under active initial development and
* unstable. The types are not well defined or documented, and this API

Powered by Google App Engine
This is Rietveld 408576698