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

Side by Side Diff: remoting/webapp/crd/js/local_host_section.js

Issue 978863002: Better UI when the machine is shared under a different account (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback 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 unified diff | Download patch
« no previous file with comments | « remoting/webapp/crd/html/ui_me2me.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var remoting = remoting || {}; 5 var remoting = remoting || {};
6 6
7 (function() { 7 (function() {
8 8
9 'use strict'; 9 'use strict';
10 10
(...skipping 18 matching lines...) Expand all
29 /** @private */ 29 /** @private */
30 this.hostTableEntry_ = new remoting.HostTableEntry( 30 this.hostTableEntry_ = new remoting.HostTableEntry(
31 parseInt(chrome.runtime.getManifest().version, 10), 31 parseInt(chrome.runtime.getManifest().version, 10),
32 remoting.connectMe2Me, 32 remoting.connectMe2Me,
33 this.rename_.bind(this)); 33 this.rename_.bind(this));
34 hostContainer.appendChild(this.hostTableEntry_.element()); 34 hostContainer.appendChild(this.hostTableEntry_.element());
35 this.hostTableEntry_.element().id = 'local-host-connect-button'; 35 this.hostTableEntry_.element().id = 'local-host-connect-button';
36 36
37 var startButton = rootElement.querySelector('.start-daemon'); 37 var startButton = rootElement.querySelector('.start-daemon');
38 var stopButton = rootElement.querySelector('.stop-daemon'); 38 var stopButton = rootElement.querySelector('.stop-daemon');
39 var stopLocalDaemonButton = rootElement.querySelector('.stop-local-daemon');
39 var changePINButton = rootElement.querySelector('.change-daemon-pin'); 40 var changePINButton = rootElement.querySelector('.change-daemon-pin');
40 41
41 /** @private */ 42 /** @private */
42 this.eventHooks_ = new base.Disposables( 43 this.eventHooks_ = new base.Disposables(
43 new base.DomEventHook(startButton, 'click', 44 new base.DomEventHook(startButton, 'click',
44 controller.start.bind(controller), false), 45 controller.start.bind(controller), false),
45 new base.DomEventHook(stopButton, 'click', 46 new base.DomEventHook(stopButton, 'click',
46 controller.stop.bind(controller), false), 47 controller.stop.bind(controller), false),
48 new base.DomEventHook(stopLocalDaemonButton, 'click',
49 controller.stop.bind(controller), false),
47 new base.DomEventHook(changePINButton, 'click', 50 new base.DomEventHook(changePINButton, 'click',
48 controller.changePIN.bind(controller), false)); 51 controller.changePIN.bind(controller), false));
49 /** @private */ 52 /** @private */
50 this.hasError_ = false; 53 this.hasError_ = false;
51 }; 54 };
52 55
53 remoting.LocalHostSection.prototype.dispose = function() { 56 remoting.LocalHostSection.prototype.dispose = function() {
54 base.dispose(this.eventHooks_); 57 base.dispose(this.eventHooks_);
55 this.eventHooks_ = null; 58 this.eventHooks_ = null;
56 }; 59 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return this.isEnabled_() || !this.hasError_; 107 return this.isEnabled_() || !this.hasError_;
105 }; 108 };
106 109
107 /** @private */ 110 /** @private */
108 remoting.LocalHostSection.prototype.updateUI_ = function() { 111 remoting.LocalHostSection.prototype.updateUI_ = function() {
109 this.hostTableEntry_.setHost(this.host_); 112 this.hostTableEntry_.setHost(this.host_);
110 113
111 // Disable elements. 114 // Disable elements.
112 var enabled = this.isEnabled_(); 115 var enabled = this.isEnabled_();
113 var canChangeLocalHostState = this.canChangeState(); 116 var canChangeLocalHostState = this.canChangeState();
114 remoting.updateModalUi(enabled ? 'enabled' : 'disabled', 'data-daemon-state'); 117 var daemonState = '';
118 if (!enabled) {
119 daemonState = 'disabled';
120 } else if (this.host_ !== null) {
121 daemonState = 'enabled';
122 } else {
123 daemonState = 'enabled-other-account';
124 }
125 remoting.updateModalUi(daemonState, 'data-daemon-state');
115 this.rootElement_.hidden = !canChangeLocalHostState; 126 this.rootElement_.hidden = !canChangeLocalHostState;
116 }; 127 };
117 128
118 remoting.LocalHostSection.prototype.rename_ = function() { 129 remoting.LocalHostSection.prototype.rename_ = function() {
119 return this.controller_.rename(this.hostTableEntry_); 130 return this.controller_.rename(this.hostTableEntry_);
120 }; 131 };
121 132
122 /** 133 /**
123 * @constructor 134 * @constructor
124 * @param {remoting.HostList} hostList 135 * @param {remoting.HostList} hostList
(...skipping 17 matching lines...) Expand all
142 this.setupDialog_.showForPin(); 153 this.setupDialog_.showForPin();
143 }; 154 };
144 155
145 /** @param {remoting.HostTableEntry} host */ 156 /** @param {remoting.HostTableEntry} host */
146 remoting.LocalHostSection.Controller.prototype.rename = function(host) { 157 remoting.LocalHostSection.Controller.prototype.rename = function(host) {
147 this.hostList_.renameHost(host); 158 this.hostList_.renameHost(host);
148 }; 159 };
149 160
150 }()); 161 }());
151 162
OLDNEW
« no previous file with comments | « remoting/webapp/crd/html/ui_me2me.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698