summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
Diffstat (limited to 'remoting')
-rw-r--r--remoting/webapp/me2mom/background.html5
-rw-r--r--remoting/webapp/me2mom/choice.html4
-rw-r--r--remoting/webapp/me2mom/remoting.js7
3 files changed, 11 insertions, 5 deletions
diff --git a/remoting/webapp/me2mom/background.html b/remoting/webapp/me2mom/background.html
index 216f22e..d55dc79 100644
--- a/remoting/webapp/me2mom/background.html
+++ b/remoting/webapp/me2mom/background.html
@@ -9,8 +9,9 @@ found in the LICENSE file.
function setItem(key, value) {
window.localStorage.setItem(key, value);
}
- function getItem(key) {
- return window.localStorage.getItem(key);
+ function getItem(key, defaultValue) {
+ var result = window.localStorage.getItem(key);
+ return (result != null) ? result : defaultValue;
}
function clearAll() {
window.localStorage.clear();
diff --git a/remoting/webapp/me2mom/choice.html b/remoting/webapp/me2mom/choice.html
index 9d550a3..d55298f 100644
--- a/remoting/webapp/me2mom/choice.html
+++ b/remoting/webapp/me2mom/choice.html
@@ -41,7 +41,7 @@ found in the LICENSE file.
<p>
<a class="switch_mode"
href="#c"
- onclick="setGlobalMode('client');">
+ onclick="setGlobalModePersistent('client');">
I want to connect to another computer instead...
</a>
</p>
@@ -99,7 +99,7 @@ found in the LICENSE file.
</form>
<a class="switch_mode"
href="#h"
- onclick="setGlobalMode('host');">
+ onclick="setGlobalModePersistent('host');">
I want to share this computer instead...
</a>
</div>
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js
index 72a3b70..78c4267 100644
--- a/remoting/webapp/me2mom/remoting.js
+++ b/remoting/webapp/me2mom/remoting.js
@@ -28,7 +28,7 @@ function init() {
initAuthPanel_();
setHostMode('unshared');
setClientMode('unconnected');
- setGlobalMode('host'); // TODO(jamiewalch): Make the initial mode sticky.
+ setGlobalMode(chromoting.getItem('startup-mode', 'host'));
}
// Show the div with id |mode| and hide those with other ids in |modes|.
@@ -47,6 +47,11 @@ function setGlobalMode(mode) {
setMode_(mode, ['host', 'client', 'session']);
}
+function setGlobalModePersistent(mode) {
+ setGlobalMode(mode);
+ chromoting.setItem('startup-mode', mode);
+}
+
function setHostMode(mode) {
setMode_(mode, ['unshared', 'ready_to_share', 'shared']);
}