OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** | 10 /** |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 var that = this; | 183 var that = this; |
184 | 184 |
185 /** | 185 /** |
186 * @param {boolean} supported True if crash dump reporting is supported by | 186 * @param {boolean} supported True if crash dump reporting is supported by |
187 * the host. | 187 * the host. |
188 * @param {boolean} allowed True if crash dump reporting is allowed. | 188 * @param {boolean} allowed True if crash dump reporting is allowed. |
189 * @param {boolean} set_by_policy True if crash dump reporting is controlled | 189 * @param {boolean} set_by_policy True if crash dump reporting is controlled |
190 * by policy. | 190 * by policy. |
191 */ | 191 */ |
192 function onGetConsent(supported, allowed, set_by_policy) { | 192 function onGetConsent(supported, allowed, set_by_policy) { |
193 that.usageStats_.hidden = !supported; | 193 // Hide the usage stats check box if it is not supported or the policy |
| 194 // doesn't allow usage stats collection. |
| 195 var checkBoxLabel = that.usageStats_.querySelector('.checkbox-label'); |
| 196 that.usageStats_.hidden = !supported || (set_by_policy && !allowed); |
194 that.usageStatsCheckbox_.checked = allowed; | 197 that.usageStatsCheckbox_.checked = allowed; |
| 198 |
195 that.usageStatsCheckbox_.disabled = set_by_policy; | 199 that.usageStatsCheckbox_.disabled = set_by_policy; |
| 200 checkBoxLabel.classList.toggle('disabled', set_by_policy); |
| 201 |
| 202 if (set_by_policy) { |
| 203 that.usageStats_.title = l10n.getTranslationOrError( |
| 204 /*i18n-content*/ 'SETTING_MANAGED_BY_POLICY'); |
| 205 } else { |
| 206 that.usageStats_.title = ''; |
| 207 } |
196 } | 208 } |
197 | 209 |
198 /** @param {remoting.Error} error */ | 210 /** @param {remoting.Error} error */ |
199 function onError(error) { | 211 function onError(error) { |
200 console.error('Error getting consent status: ' + error); | 212 console.error('Error getting consent status: ' + error); |
201 } | 213 } |
202 | 214 |
203 this.usageStats_.hidden = false; | 215 this.usageStats_.hidden = true; |
204 this.usageStatsCheckbox_.checked = false; | 216 this.usageStatsCheckbox_.checked = false; |
205 | 217 |
206 // Prevent user from ticking the box until the current consent status is | 218 // Prevent user from ticking the box until the current consent status is |
207 // known. | 219 // known. |
208 this.usageStatsCheckbox_.disabled = true; | 220 this.usageStatsCheckbox_.disabled = true; |
209 | 221 |
210 this.hostController_.getConsent(onGetConsent, onError); | 222 this.hostController_.getConsent(onGetConsent, onError); |
211 | 223 |
212 var flow = [ | 224 var flow = [ |
213 remoting.HostSetupFlow.State.INSTALL_HOST, | 225 remoting.HostSetupFlow.State.INSTALL_HOST, |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 var c = pin.charAt(i); | 562 var c = pin.charAt(i); |
551 if ((c < '0') || (c > '9')) { | 563 if ((c < '0') || (c > '9')) { |
552 return false; | 564 return false; |
553 } | 565 } |
554 } | 566 } |
555 return true; | 567 return true; |
556 }; | 568 }; |
557 | 569 |
558 /** @type {remoting.HostSetupDialog} */ | 570 /** @type {remoting.HostSetupDialog} */ |
559 remoting.hostSetupDialog = null; | 571 remoting.hostSetupDialog = null; |
OLD | NEW |