summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 20:21:53 +0000
committerjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 20:21:53 +0000
commit33ec7a474999d43731d2d4c980cfd8febc5a79f0 (patch)
tree8ebe52abad70314bc3f14b2b93d6ee462969f86a /remoting
parent5dd62bb920b3836652a55c4cfe38d478a1521417 (diff)
downloadchromium_src-33ec7a474999d43731d2d4c980cfd8febc5a79f0.zip
chromium_src-33ec7a474999d43731d2d4c980cfd8febc5a79f0.tar.gz
chromium_src-33ec7a474999d43731d2d4c980cfd8febc5a79f0.tar.bz2
Remember last-used mode.
BUG=None TEST=Manual Review URL: http://codereview.chromium.org/7003016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85030 0039d316-1c4b-4281-b951-d872f2087c98
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']);
}