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

Side by Side Diff: chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js

Issue 2676103002: MD Settings: Move bluetooth UI from dialog to subpage (Closed)
Patch Set: Feedback Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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
(...skipping 24 matching lines...) Expand all
35 }, 35 },
36 36
37 /** @private */ 37 /** @private */
38 bluetoothEnabled_: { 38 bluetoothEnabled_: {
39 type: Boolean, 39 type: Boolean,
40 observer: 'bluetoothEnabledChanged_', 40 observer: 'bluetoothEnabledChanged_',
41 notify: true, 41 notify: true,
42 }, 42 },
43 43
44 /** 44 /**
45 * Set by bluetooth-subpage to controll spinner visibilit in the header.
46 * @private
47 */
48 showSpinner_: {
49 type: Boolean,
50 notify: true,
51 value: false,
52 },
53
54 /**
55 * The cached bluetooth adapter state. 45 * The cached bluetooth adapter state.
56 * @type {!chrome.bluetooth.AdapterState|undefined} 46 * @type {!chrome.bluetooth.AdapterState|undefined}
57 * @private 47 * @private
58 */ 48 */
59 adapterState_: { 49 adapterState_: {
60 type: Object, 50 type: Object,
61 notify: true, 51 notify: true,
62 }, 52 },
63 53
64 /** 54 /**
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 getIcon_: function() { 115 getIcon_: function() {
126 if (!this.bluetoothEnabled_) 116 if (!this.bluetoothEnabled_)
127 return 'settings:bluetooth-disabled'; 117 return 'settings:bluetooth-disabled';
128 return 'settings:bluetooth'; 118 return 'settings:bluetooth';
129 }, 119 },
130 120
131 /** 121 /**
132 * @return {string} 122 * @return {string}
133 * @private 123 * @private
134 */ 124 */
135 getTitle_: function() { 125 getDescription_: function() {
136 return this.i18n( 126 return this.i18n(
137 this.bluetoothEnabled_ ? 'bluetoothEnabled' : 'bluetoothDisabled'); 127 this.bluetoothEnabled_ ? 'bluetoothEnabled' : 'bluetoothDisabled');
138 }, 128 },
139 129
140 /** 130 /**
141 * Process bluetooth.onAdapterStateChanged events. 131 * Process bluetooth.onAdapterStateChanged events.
142 * @param {!chrome.bluetooth.AdapterState} state 132 * @param {!chrome.bluetooth.AdapterState} state
143 * @private 133 * @private
144 */ 134 */
145 onBluetoothAdapterStateChanged_: function(state) { 135 onBluetoothAdapterStateChanged_: function(state) {
146 this.adapterState_ = state; 136 this.adapterState_ = state;
147 this.bluetoothEnabled_ = state.powered; 137 this.bluetoothEnabled_ = state.powered;
148 }, 138 },
149 139
150 /** @private */ 140 /** @private */
151 onTap_: function() { 141 onTap_: function() {
152 if (this.adapterState_.available === false) 142 if (this.adapterState_.available === false)
153 return; 143 return;
154 if (!this.bluetoothEnabled_) 144 if (!this.bluetoothEnabled_)
155 this.bluetoothEnabled_ = true; 145 this.bluetoothEnabled_ = true;
156 else 146 else
157 this.openSubpage_(); 147 this.openSubpage_();
158 }, 148 },
159 149
160 /** 150 /**
161 * @param {Event} e 151 * @param {Event} e
162 * @private 152 * @private
163 */ 153 */
154 stopTap_: function(e) {
155 e.stopPropagation();
156 },
157
158 /**
159 * @param {Event} e
160 * @private
161 */
164 onSubpageArrowTap_: function(e) { 162 onSubpageArrowTap_: function(e) {
165 this.openSubpage_(); 163 this.openSubpage_();
166 e.stopPropagation(); 164 e.stopPropagation();
167 }, 165 },
168 166
169 /** @private */ 167 /** @private */
170 bluetoothEnabledChanged_: function() { 168 bluetoothEnabledChanged_: function() {
171 this.bluetoothPrivate.setAdapterState( 169 this.bluetoothPrivate.setAdapterState(
172 {powered: this.bluetoothEnabled_}, function() { 170 {powered: this.bluetoothEnabled_}, function() {
173 if (chrome.runtime.lastError) { 171 if (chrome.runtime.lastError) {
174 console.error( 172 console.error(
175 'Error enabling bluetooth: ' + 173 'Error enabling bluetooth: ' +
176 chrome.runtime.lastError.message); 174 chrome.runtime.lastError.message);
177 } 175 }
178 }); 176 });
179 }, 177 },
180 178
181 /** @private */ 179 /** @private */
182 openSubpage_: function() { 180 openSubpage_: function() {
183 settings.navigateTo(settings.Route.BLUETOOTH_DEVICES); 181 settings.navigateTo(settings.Route.BLUETOOTH_DEVICES);
184 } 182 }
185 }); 183 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698