From 90f38e213e3dd82ac87894a089647b0081c727d7 Mon Sep 17 00:00:00 2001 From: "jamiewalch@google.com" Date: Wed, 14 Sep 2011 23:07:01 +0000 Subject: Persist remoting.useP2pApi BUG=None TEST=Manual Review URL: http://codereview.chromium.org/7887054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101186 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/webapp/me2mom/client_session.js | 6 ------ remoting/webapp/me2mom/remoting.js | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'remoting') diff --git a/remoting/webapp/me2mom/client_session.js b/remoting/webapp/me2mom/client_session.js index 5f634f7..7cbbb0d 100644 --- a/remoting/webapp/me2mom/client_session.js +++ b/remoting/webapp/me2mom/client_session.js @@ -16,12 +16,6 @@ /** @suppress {duplicate} */ var remoting = remoting || {}; -/** - * Whether or not the P2P Transport API should be used. - * @type {boolean} - */ -remoting.useP2pApi = false; - (function() { /** * @param {string} hostJid The jid of the host to connect to. diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js index 3b1434d..6e64d30 100644 --- a/remoting/webapp/me2mom/remoting.js +++ b/remoting/webapp/me2mom/remoting.js @@ -54,9 +54,18 @@ remoting.ClientError = { */ remoting.scaleToFit = false; +/** + * Whether or not the P2P Transport API should be used. This flag is an interim + * measure to allow testing by early adopters, and will be removed when P2P API + * is enabled by default. See http://crbug.com/51198 for details. + * @type {boolean} + */ +remoting.useP2pApi = false; + // Constants representing keys used for storing persistent application state. var KEY_APP_MODE_ = 'remoting-app-mode'; var KEY_EMAIL_ = 'remoting-email'; +var KEY_USE_P2P_API_ = 'remoting-use-p2p-api'; // Some constants for pretty-printing the access code. var kSupportIdLen = 7; @@ -171,6 +180,8 @@ remoting.init = function() { document.getElementById('client-footer-text-cros').id = 'client-footer-text'; } + + remoting.useP2pApi = !(window.localStorage.getItem(KEY_USE_P2P_API_) == null); } /** @@ -704,4 +715,13 @@ remoting.checkHotkeys = function(event) { } } +remoting.setUseP2pApi = function(use) { + remoting.useP2pApi = use; + if (use) { + window.localStorage.setItem(KEY_USE_P2P_API_, 'true'); + } else { + window.localStorage.removeItem(KEY_USE_P2P_API_); + } +} + }()); -- cgit v1.1