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

Unified Diff: chrome/browser/resources/settings/internet_page/network_summary_item.js

Issue 2684193005: MD Settings: Internet: Request network scan (Closed)
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/internet_page/network_summary_item.js
diff --git a/chrome/browser/resources/settings/internet_page/network_summary_item.js b/chrome/browser/resources/settings/internet_page/network_summary_item.js
index 22662ba8e6d18dfa71d437be12eccf4a16d1cc2a..b6ecc79ca55d0344dc4ab31524b285e01abdc3cb 100644
--- a/chrome/browser/resources/settings/internet_page/network_summary_item.js
+++ b/chrome/browser/resources/settings/internet_page/network_summary_item.js
@@ -43,6 +43,12 @@ Polymer({
},
/**
+ * Type of networks in networkStateList. Used to initialte scanning.
+ * @type {CrOnc.Type}
+ */
+ networkType: String,
+
+ /**
* Interface for networkingPrivate calls, passed from internet_page.
* @type {!NetworkingPrivate}
*/
@@ -69,6 +75,19 @@ Polymer({
},
},
+ observers: ['updateScanning_(networkingPrivate, networkType, expanded_)'],
+
+ /** @private {number|null} */
+ scanIntervalId_: null,
+
+ /** override */
+ detached: function() {
+ if (this.scanIntervalId_ !== null) {
+ window.clearInterval(this.scanIntervalId_);
+ this.scanIntervalId_ = null;
+ }
+ },
+
/** @private */
expandedChanged_: function() {
var type = this.deviceState ? this.deviceState.Type : '';
@@ -81,6 +100,27 @@ Polymer({
this.expanded_ = false;
},
+ /** @private */
+ updateScanning_: function() {
+ if (this.scanIntervalId_ != null) {
+ if (!this.expanded_) {
+ window.clearInterval(this.scanIntervalId_);
+ this.scanIntervalId_ = null;
+ }
+ return;
+ }
+ if (!this.expanded_ ||
+ (this.networkType != CrOnc.Type.ALL &&
+ this.networkType != CrOnc.Type.WI_FI)) {
+ return;
+ }
+ /** @const */ var INTERVAL_MS = 10 * 1000;
+ this.networkingPrivate.requestNetworkScan();
+ this.scanIntervalId_ = window.setInterval(function() {
+ this.networkingPrivate.requestNetworkScan();
+ }.bind(this), INTERVAL_MS);
+ },
+
/**
* @return {boolean} Whether or not the scanning spinner should be visible.
* @private

Powered by Google App Engine
This is Rietveld 408576698