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

Side by Side Diff: chrome/browser/resources/bluetooth_internals/characteristic_list.js

Issue 2627243002: bluetooth: Add control for reading/writing of characteristics to internals page. (Closed)
Patch Set: Merge upstream, add comment detail for type converter Created 3 years, 11 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 * Javascript for CharacteristicList and CharacteristicListItem, served from 6 * Javascript for CharacteristicList and CharacteristicListItem, served from
7 * chrome://bluetooth-internals/. 7 * chrome://bluetooth-internals/.
8 */ 8 */
9 9
10 cr.define('characteristic_list', function() { 10 cr.define('characteristic_list', function() {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 writable_auxiliaries: (this.info.properties & 104 writable_auxiliaries: (this.info.properties &
105 Property.WRITABLE_AUXILIARIES) > 0, 105 Property.WRITABLE_AUXILIARIES) > 0,
106 read_encrypted: (this.info.properties & Property.READ_ENCRYPTED) > 0, 106 read_encrypted: (this.info.properties & Property.READ_ENCRYPTED) > 0,
107 write_encrypted: (this.info.properties & Property.WRITE_ENCRYPTED) > 0, 107 write_encrypted: (this.info.properties & Property.WRITE_ENCRYPTED) > 0,
108 read_encrypted_authenticated: (this.info.properties & 108 read_encrypted_authenticated: (this.info.properties &
109 Property.READ_ENCRYPTED_AUTHENTICATED) > 0, 109 Property.READ_ENCRYPTED_AUTHENTICATED) > 0,
110 write_encrypted_authenticated: (this.info.properties & 110 write_encrypted_authenticated: (this.info.properties &
111 Property.WRITE_ENCRYPTED_AUTHENTICATED) > 0, 111 Property.WRITE_ENCRYPTED_AUTHENTICATED) > 0,
112 }); 112 });
113 113
114 /** @private {!value_control.ValueControl} */
115 this.valueControl_ = new value_control.ValueControl();
116 this.valueControl_.load(this.deviceAddress_, this.serviceId_, this.info);
117 this.valueControl_.setValue(this.info.last_known_value);
118
114 /** @private {!descriptor_list.DescriptorList} */ 119 /** @private {!descriptor_list.DescriptorList} */
115 this.descriptorList_ = new descriptor_list.DescriptorList(); 120 this.descriptorList_ = new descriptor_list.DescriptorList();
116 121
117 // Create content for display in brief content container. 122 // Create content for display in brief content container.
118 var characteristicHeaderText = document.createElement('div'); 123 var characteristicHeaderText = document.createElement('div');
119 characteristicHeaderText.textContent = 'Characteristic:'; 124 characteristicHeaderText.textContent = 'Characteristic:';
120 125
121 var characteristicHeaderValue = document.createElement('div'); 126 var characteristicHeaderValue = document.createElement('div');
122 characteristicHeaderValue.textContent = this.info.uuid.uuid; 127 characteristicHeaderValue.textContent = this.info.uuid.uuid;
123 128
(...skipping 15 matching lines...) Expand all
139 144
140 var propertiesDiv = document.createElement('div'); 145 var propertiesDiv = document.createElement('div');
141 propertiesDiv.classList.add('flex'); 146 propertiesDiv.classList.add('flex');
142 propertiesDiv.appendChild(this.propertiesFieldSet_); 147 propertiesDiv.appendChild(this.propertiesFieldSet_);
143 148
144 var descriptorsHeader = document.createElement('h4'); 149 var descriptorsHeader = document.createElement('h4');
145 descriptorsHeader.textContent = 'Descriptors'; 150 descriptorsHeader.textContent = 'Descriptors';
146 151
147 var infoDiv = document.createElement('div'); 152 var infoDiv = document.createElement('div');
148 infoDiv.classList.add('info-container'); 153 infoDiv.classList.add('info-container');
154
155 var valueHeader = document.createElement('h4');
156 valueHeader.textContent = 'Value';
157
149 infoDiv.appendChild(characteristicInfoHeader); 158 infoDiv.appendChild(characteristicInfoHeader);
150 infoDiv.appendChild(characteristicDiv); 159 infoDiv.appendChild(characteristicDiv);
151 infoDiv.appendChild(propertiesHeader); 160 infoDiv.appendChild(propertiesHeader);
152 infoDiv.appendChild(propertiesDiv); 161 infoDiv.appendChild(propertiesDiv);
162 infoDiv.appendChild(valueHeader);
163 infoDiv.appendChild(this.valueControl_);
153 infoDiv.appendChild(descriptorsHeader); 164 infoDiv.appendChild(descriptorsHeader);
154 infoDiv.appendChild(this.descriptorList_); 165 infoDiv.appendChild(this.descriptorList_);
155 166
156 this.expandedContent_.appendChild(infoDiv); 167 this.expandedContent_.appendChild(infoDiv);
157 }, 168 },
158 169
159 /** @override */ 170 /** @override */
160 onExpandInternal: function(expanded) { 171 onExpandInternal: function(expanded) {
161 this.descriptorList_.load( 172 this.descriptorList_.load(
162 this.deviceAddress_, this.serviceId_, this.info.id); 173 this.deviceAddress_, this.serviceId_, this.info.id);
163 }, 174 },
164 }; 175 };
165 176
166 /** 177 /**
167 * A list that displays CharacteristicListItems. 178 * A list that displays CharacteristicListItems.
168 * @constructor 179 * @constructor
169 */ 180 */
170 var CharacteristicList = cr.ui.define('list'); 181 var CharacteristicList = cr.ui.define('list');
171 182
172 CharacteristicList.prototype = { 183 CharacteristicList.prototype = {
173 __proto__: ExpandableList.prototype, 184 __proto__: ExpandableList.prototype,
174 185
175 /** @override */ 186 /** @override */
176 decorate: function() { 187 decorate: function() {
177 ExpandableList.prototype.decorate.call(this); 188 ExpandableList.prototype.decorate.call(this);
178 189
190 /** @private {?string} */
191 this.deviceAddress_ = null;
192 /** @private {?string} */
193 this.serviceId_ = null;
179 /** @private {boolean} */ 194 /** @private {boolean} */
180 this.characteristicsRequested_ = false; 195 this.characteristicsRequested_ = false;
181 196
182 this.classList.add('characteristic-list'); 197 this.classList.add('characteristic-list');
183 this.setEmptyMessage('No Characteristics Found'); 198 this.setEmptyMessage('No Characteristics Found');
184 }, 199 },
185 200
186 /** @override */ 201 /** @override */
187 createItem: function(data) { 202 createItem: function(data) {
188 return new CharacteristicListItem( 203 return new CharacteristicListItem(
(...skipping 30 matching lines...) Expand all
219 }.bind(this)); 234 }.bind(this));
220 }.bind(this)); 235 }.bind(this));
221 }, 236 },
222 }; 237 };
223 238
224 return { 239 return {
225 CharacteristicList: CharacteristicList, 240 CharacteristicList: CharacteristicList,
226 CharacteristicListItem: CharacteristicListItem, 241 CharacteristicListItem: CharacteristicListItem,
227 }; 242 };
228 }); 243 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698