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

Unified Diff: chrome/browser/resources/bluetooth_internals/devices_page.js

Issue 2564113003: bluetooth: Add basic scanning to chrome://bluetooth-internals. (Closed)
Patch Set: Replace discovering string in bluetooth_internals.js 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/bluetooth_internals/bluetooth_internals.js ('k') | device/bluetooth/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/bluetooth_internals/devices_page.js
diff --git a/chrome/browser/resources/bluetooth_internals/devices_page.js b/chrome/browser/resources/bluetooth_internals/devices_page.js
index 6d8f3b49a7d9804d84eb5891bf3e0450e362b1ac..1476f8a7e179fb967da8f317bdf0568b16994bb2 100644
--- a/chrome/browser/resources/bluetooth_internals/devices_page.js
+++ b/chrome/browser/resources/bluetooth_internals/devices_page.js
@@ -11,6 +11,18 @@ cr.define('devices_page', function() {
/** @const */ var Page = cr.ui.pageManager.Page;
/**
+ * Enum of scan status for the devices page.
+ * @enum {number}
+ */
+ var ScanStatus = {
+ OFF: 0,
+ STARTING: 1,
+ ON: 2,
+ STOPPING: 3,
+ };
+
+
+ /**
* Page that contains a header and a DevicesView.
* @constructor
* @extends {cr.ui.pageManager.Page}
@@ -20,6 +32,10 @@ cr.define('devices_page', function() {
this.deviceTable = new device_table.DeviceTable();
this.pageDiv.appendChild(this.deviceTable);
+ this.scanBtn_ = this.pageDiv.querySelector('#scan-btn');
+ this.scanBtn_.addEventListener('click', function(event) {
+ this.pageDiv.dispatchEvent(new CustomEvent('scanpressed'));
+ }.bind(this));
}
DevicesPage.prototype = {
@@ -31,10 +47,32 @@ cr.define('devices_page', function() {
*/
setDevices: function(devices) {
this.deviceTable.setDevices(devices);
+ },
+
+ setScanStatus: function(status) {
+ switch (status) {
+ case ScanStatus.OFF:
+ this.scanBtn_.disabled = false;
+ this.scanBtn_.textContent = 'Start Scan';
+ break;
+ case ScanStatus.STARTING:
+ this.scanBtn_.disabled = true;
+ this.scanBtn_.textContent = 'Starting...';
+ break;
+ case ScanStatus.ON:
+ this.scanBtn_.disabled = false;
+ this.scanBtn_.textContent = 'Stop Scan';
+ break;
+ case ScanStatus.STOPPING:
+ this.scanBtn_.disabled = true;
+ this.scanBtn_.textContent = 'Stopping...';
+ break;
+ }
}
};
return {
- DevicesPage: DevicesPage
+ DevicesPage: DevicesPage,
+ ScanStatus: ScanStatus,
};
});
« no previous file with comments | « chrome/browser/resources/bluetooth_internals/bluetooth_internals.js ('k') | device/bluetooth/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698