Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / options / chromeos / bluetooth_pair_device_overlay.js
index 7fa1a73..35c5b20 100644 (file)
@@ -42,6 +42,7 @@ cr.define('options', function() {
   /**
    * Encapsulated handling of the Bluetooth device pairing page.
    * @constructor
+   * @extends {cr.ui.pageManager.Page}
    */
   function BluetoothPairing() {
     Page.call(this, 'bluetoothPairing',
@@ -56,16 +57,7 @@ cr.define('options', function() {
 
     /**
      * Description of the bluetooth device.
-     * @type {{name: string,
-     *         address: string,
-     *         paired: boolean,
-     *         connected: boolean,
-     *         connecting: boolean,
-     *         connectable: boolean,
-     *         pairing: string|undefined,
-     *         passkey: number|undefined,
-     *         pincode: string|undefined,
-     *         entered: number|undefined}}
+     * @type {?BluetoothDevice}
      * @private
      */
     device_: null,
@@ -151,7 +143,7 @@ cr.define('options', function() {
      * @return {boolean} True if the overlay can be displayed.
      */
     canShowPage: function() {
-      return this.device_ && this.device_.address && this.device_.pairing;
+      return !!(this.device_ && this.device_.address && this.device_.pairing);
     },
 
     /**
@@ -169,11 +161,11 @@ cr.define('options', function() {
      * @param {Object} device Description of the bluetooth device.
      */
     update: function(device) {
-      this.device_ = {};
-      for (key in device)
+      this.device_ = /** @type {BluetoothDevice} */({});
+      for (var key in device)
         this.device_[key] = device[key];
       // Update the pairing instructions.
-      var instructionsEl = $('bluetooth-pairing-instructions');
+      var instructionsEl = assert($('bluetooth-pairing-instructions'));
       this.clearElement_(instructionsEl);
       this.dismissible_ = ('dismissible' in device) ?
         device.dismissible : true;
@@ -227,7 +219,7 @@ cr.define('options', function() {
 
     /**
      * Handles the ENTER key for the passkey or pincode entry field.
-     * @return {Event} a keydown event.
+     * @param {Event} event A keydown event.
      * @private
      */
     keyDownEventHandler_: function(event) {
@@ -274,7 +266,7 @@ cr.define('options', function() {
      * @param {string} key Passkey or PIN to display.
      */
     updatePasskey_: function(key) {
-      var passkeyEl = $('bluetooth-pairing-passkey-display');
+      var passkeyEl = assert($('bluetooth-pairing-passkey-display'));
       var keyClass = (this.device_.pairing == PAIRING.REMOTE_PASSKEY ||
                       this.device_.pairing == PAIRING.REMOTE_PIN_CODE) ?
           'bluetooth-keyboard-button' : 'bluetooth-passkey-char';
@@ -330,9 +322,9 @@ cr.define('options', function() {
 
   /**
    * Displays a message from the Bluetooth adapter.
-   * @param {Object} data Data for constructing the message.
-   * @param {string} data.message Name of message to show.
-   * @param {string} data.address Device address.
+   * @param {{message: string, address: string}} data Data for constructing the
+   *     message. |data.message| is the name of message to show. |data.address|
+   *     is the device address.
    */
   BluetoothPairing.showMessage = function(data) {
     var name = data.address;