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

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: Finished renaming method. 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..661a62c126196ecc063b6fafb2de4682c8e451b0 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<!function()>}
+ */
+ 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]();
michaelpg 2015/03/19 19:48:28 What would happen if an observer tried to set prov
bartfab (slow) 2015/03/20 00:10:25 As discussed, I added a comment warning about this
+ },
+
+ /**
+ * Adds an observer to be notified when the list of VPN providers changes.
+ * @param {!function()} observer The observer to add.
+ */
+ addObserver: function(observer) {
+ this.observers_.push(observer);
+ },
+
+ /**
* 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.
michaelpg 2015/03/19 19:48:28 nit: s/notified/called
bartfab (slow) 2015/03/20 00:10:25 Done.
+ * @param {!function()} 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;
};
/**

Powered by Google App Engine
This is Rietveld 408576698