| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 6 * @fileoverview |
| 7 * 'Settings page for managing bluetooth properties and devices. This page | 7 * 'Settings page for managing bluetooth properties and devices. This page |
| 8 * just provodes a summary and link to the subpage. | 8 * just provodes a summary and link to the subpage. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 var bluetoothApis = bluetoothApis || { | 11 var bluetoothApis = bluetoothApis || { |
| 12 /** | 12 /** |
| 13 * Set this to provide a fake implementation for testing. | 13 * Set this to provide a fake implementation for testing. |
| 14 * @type {Bluetooth} | 14 * @type {Bluetooth} |
| 15 */ | 15 */ |
| 16 bluetoothApiForTest: null, | 16 bluetoothApiForTest: null, |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Set this to provide a fake implementation for testing. | 19 * Set this to provide a fake implementation for testing. |
| 20 * @type {BluetoothPrivate} | 20 * @type {BluetoothPrivate} |
| 21 */ | 21 */ |
| 22 bluetoothPrivateApiForTest: null, | 22 bluetoothPrivateApiForTest: null, |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 Polymer({ | 25 Polymer({ |
| 26 is: 'settings-bluetooth-page', | 26 is: 'settings-bluetooth-page', |
| 27 | 27 |
| 28 behaviors: [I18nBehavior], | |
| 29 | |
| 30 properties: { | 28 properties: { |
| 31 /** Preferences state. */ | 29 /** Preferences state. */ |
| 32 prefs: { | 30 prefs: { |
| 33 type: Object, | 31 type: Object, |
| 34 notify: true, | 32 notify: true, |
| 35 }, | 33 }, |
| 36 | 34 |
| 37 /** @private */ | 35 /** @private */ |
| 38 bluetoothEnabled_: { | 36 bluetoothEnabled_: { |
| 39 type: Boolean, | 37 type: Boolean, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 * @return {string} | 110 * @return {string} |
| 113 * @private | 111 * @private |
| 114 */ | 112 */ |
| 115 getIcon_: function() { | 113 getIcon_: function() { |
| 116 if (!this.bluetoothEnabled_) | 114 if (!this.bluetoothEnabled_) |
| 117 return 'settings:bluetooth-disabled'; | 115 return 'settings:bluetooth-disabled'; |
| 118 return 'settings:bluetooth'; | 116 return 'settings:bluetooth'; |
| 119 }, | 117 }, |
| 120 | 118 |
| 121 /** | 119 /** |
| 120 * @param {boolean} enabled |
| 121 * @param {string} onstr |
| 122 * @param {string} offstr |
| 122 * @return {string} | 123 * @return {string} |
| 123 * @private | 124 * @private |
| 124 */ | 125 */ |
| 125 getDescription_: function() { | 126 getOnOffString_: function(enabled, onstr, offstr) { |
| 126 return this.i18n( | 127 return enabled ? onstr : offstr; |
| 127 this.bluetoothEnabled_ ? 'bluetoothEnabled' : 'bluetoothDisabled'); | |
| 128 }, | 128 }, |
| 129 | 129 |
| 130 /** | 130 /** |
| 131 * Process bluetooth.onAdapterStateChanged events. | 131 * Process bluetooth.onAdapterStateChanged events. |
| 132 * @param {!chrome.bluetooth.AdapterState} state | 132 * @param {!chrome.bluetooth.AdapterState} state |
| 133 * @private | 133 * @private |
| 134 */ | 134 */ |
| 135 onBluetoothAdapterStateChanged_: function(state) { | 135 onBluetoothAdapterStateChanged_: function(state) { |
| 136 this.adapterState_ = state; | 136 this.adapterState_ = state; |
| 137 this.bluetoothEnabled_ = state.powered; | 137 this.bluetoothEnabled_ = state.powered; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 chrome.runtime.lastError.message); | 174 chrome.runtime.lastError.message); |
| 175 } | 175 } |
| 176 }); | 176 }); |
| 177 }, | 177 }, |
| 178 | 178 |
| 179 /** @private */ | 179 /** @private */ |
| 180 openSubpage_: function() { | 180 openSubpage_: function() { |
| 181 settings.navigateTo(settings.Route.BLUETOOTH_DEVICES); | 181 settings.navigateTo(settings.Route.BLUETOOTH_DEVICES); |
| 182 } | 182 } |
| 183 }); | 183 }); |
| OLD | NEW |