OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * Javascript for AdapterPage, served from chrome://bluetooth-internals/. | |
7 */ | |
8 | |
9 cr.define('adapter_page', function() { | |
10 /** @const */ var Page = cr.ui.pageManager.Page; | |
11 | |
12 var PROPERTY_NAMES = { | |
13 address: 'Address', | |
14 name: 'Name', | |
15 initialized: 'Initialized', | |
16 present: 'Present', | |
17 powered: 'Powered', | |
18 discoverable: 'Discoverable', | |
19 discovering: 'Discovering', | |
20 }; | |
21 | |
22 /** | |
23 * Page that contains an ObjectFieldSet that display the latest AdapterInfo. | |
dpapad
2017/01/10 17:21:33
s/display/displays
mbrunson
2017/01/10 20:01:21
Done.
| |
24 * @constructor | |
25 * @extends {cr.ui.pageManager.Page} | |
26 */ | |
27 function AdapterPage() { | |
28 Page.call(this, 'adapter', 'Adapter', 'adapter'); | |
29 | |
30 this.adapterFieldSet = new object_fieldset.ObjectFieldSet(); | |
31 this.adapterFieldSet.setPropertyDisplayNames(PROPERTY_NAMES); | |
32 this.pageDiv.appendChild(this.adapterFieldSet); | |
33 | |
34 this.refreshBtn_ = $('adapter-refresh-btn'); | |
35 this.refreshBtn_.addEventListener('click', function() { | |
36 this.refreshBtn_.disabled = true; | |
37 this.pageDiv.dispatchEvent(new CustomEvent('refreshpressed')); | |
38 }.bind(this)); | |
39 } | |
40 | |
41 AdapterPage.prototype = { | |
42 __proto__: Page.prototype, | |
43 | |
44 /** | |
45 * Sets the information to display in fieldset. | |
46 * @param {!interfaces.BluetoothAdapter.AdapterInfo} info | |
47 */ | |
48 setAdapterInfo: function(info) { | |
49 this.adapterFieldSet.setObject(info); | |
50 this.refreshBtn_.disabled = false; | |
51 }, | |
52 | |
53 /** | |
54 * Redraws the fieldset displaying the adapter info. | |
55 */ | |
56 redraw: function() { | |
57 this.adapterFieldSet.redraw(); | |
58 this.refreshBtn_.disabled = false; | |
59 }, | |
60 }; | |
61 | |
62 return { | |
63 AdapterPage: AdapterPage, | |
64 }; | |
65 }); | |
OLD | NEW |