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

Unified Diff: chrome/browser/resources/options/chromeos/vpn_providers.js

Issue 1017443002: Allow users to add third-party VPNs from the settings page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@f_3_460428_update_details_dialog
Patch Set: Fixed typo; rebased. Created 5 years, 9 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/options/chromeos/vpn_providers.js
diff --git a/chrome/browser/resources/options/chromeos/vpn_providers.js b/chrome/browser/resources/options/chromeos/vpn_providers.js
index 911c68487fbf67238d92644ad4eb93e2329bdd87..0a45e9dfb0bcc04dc81eee7774ee361d9be933b6 100644
--- a/chrome/browser/resources/options/chromeos/vpn_providers.js
+++ b/chrome/browser/resources/options/chromeos/vpn_providers.js
@@ -26,6 +26,33 @@ cr.define('options', function() {
providers_: [],
/**
+ * Observers who will be notified when the list of VPN providers changes.
+ * @type {!Array<!options.VPNProviders.Observer>}
+ */
+ observers_: [],
+
+ /**
+ * The VPN providers enabled in the primary user's profile.
+ * @type {!Array<{name: string, extensionID: ?string}>}
+ */
+ get providers() {
+ return this.providers_;
+ },
+ set providers(providers) {
+ this.providers_ = providers;
+ for (var i = 0; i < this.observers_.length; ++i)
+ this.observers_[i].onVPNProvidersChanged();
+ },
+
+ /**
+ * Adds an observer to be notified when the list of VPN providers changes.
+ * @param {!options.VPNProviders.Observer} observer The observer to add.
+ */
+ addObserver: function(observer) {
+ this.observers_.push(observer);
+ },
stevenjb 2015/03/19 16:02:02 We should make this more easily compatible with ex
bartfab (slow) 2015/03/19 16:22:05 Done.
+
+ /**
* Formats a network name for display purposes. If the network belongs to
* a third-party VPN provider, the provider name is added to the network
* name.
@@ -50,12 +77,20 @@ cr.define('options', function() {
};
/**
+ * Adds an observer to be notified when the list of VPN providers changes.
+ * @param {!options.VPNProviders.Observer} observer The observer to add.
+ */
+ VPNProviders.addObserver = function(observer) {
+ VPNProviders.getInstance().addObserver(observer);
+ };
+
+ /**
* Returns the list of VPN providers enabled in the primary user's profile.
* @return {!Array<{name: string, extensionID: ?string}>} The list of VPN
* providers enabled in the primary user's profile.
*/
VPNProviders.getProviders = function() {
- return VPNProviders.getInstance().providers_;
+ return VPNProviders.getInstance().providers;
};
/**
@@ -64,7 +99,7 @@ cr.define('options', function() {
* of VPN providers enabled in the primary user's profile.
*/
VPNProviders.setProviders = function(providers) {
- VPNProviders.getInstance().providers_ = providers;
+ VPNProviders.getInstance().providers = providers;
};
/**
@@ -77,6 +112,19 @@ cr.define('options', function() {
return VPNProviders.getInstance().formatNetworkName_(onc);
};
+ /**
+ * An observer of VPNProviders.
+ * @interface
+ */
+ VPNProviders.Observer = function() {};
+
+ VPNProviders.Observer.prototype = {
+ /**
+ * Called when the list of VPN providers changes.
+ */
+ onVPNProvidersChanged: function() {},
+ };
stevenjb 2015/03/19 16:02:02 If we use listener functions instead of observer o
bartfab (slow) 2015/03/19 16:22:05 Done.
+
// Export
return {
VPNProviders: VPNProviders

Powered by Google App Engine
This is Rietveld 408576698