OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 | 7 |
8 /** | 8 /** |
9 * ConsumerManagementOverlay class | 9 * ConsumerManagementOverlay class |
10 * Dialog that allows users to enroll/unenroll consumer management service. | 10 * Dialog that allows users to enroll/unenroll consumer management service. |
11 * @extends {SettingsDialog} | 11 * @extends {SettingsDialog} |
12 * @constructor | 12 * @constructor |
13 */ | 13 */ |
14 function ConsumerManagementOverlay() { | 14 function ConsumerManagementOverlay() { |
15 OptionsPage.call( | 15 OptionsPage.call( |
16 this, 'consumer-management-overlay', | 16 this, 'consumer-management-overlay', |
17 loadTimeData.getString('consumerManagementOverlayTabTitle'), | 17 loadTimeData.getString('consumerManagementOverlayTabTitle'), |
18 'consumer-management-overlay'); | 18 'consumer-management-overlay'); |
19 | 19 |
20 var isEnrolled = loadTimeData.getBoolean('consumerManagementEnrolled'); | |
21 $('unenroll-content').hidden = !($('enroll-content').hidden = isEnrolled); | |
bartfab (slow)
2014/07/23 19:27:13
This line is doing too much at once. Especially th
davidyu
2014/07/24 04:28:30
I was asked to write it this way by the previous r
| |
22 | |
20 $('consumer-management-overlay-enroll').onclick = function(event) { | 23 $('consumer-management-overlay-enroll').onclick = function(event) { |
21 chrome.send('enrollConsumerManagement'); | 24 chrome.send('enrollConsumerManagement'); |
22 OptionsPage.closeOverlay(); | 25 OptionsPage.closeOverlay(); |
23 }; | 26 }; |
24 $('consumer-management-overlay-unenroll').onclick = function(event) { | 27 $('consumer-management-overlay-unenroll').onclick = function(event) { |
25 chrome.send('unenrollConsumerManagement'); | 28 chrome.send('unenrollConsumerManagement'); |
26 OptionsPage.closeOverlay(); | 29 OptionsPage.closeOverlay(); |
27 }; | 30 }; |
28 $('consumer-management-overlay-enroll-cancel').onclick = function(event) { | 31 $('consumer-management-overlay-enroll-cancel').onclick = function(event) { |
29 OptionsPage.closeOverlay(); | 32 OptionsPage.closeOverlay(); |
30 }; | 33 }; |
31 $('consumer-management-overlay-unenroll-cancel').onclick = function(event) { | 34 $('consumer-management-overlay-unenroll-cancel').onclick = function(event) { |
32 OptionsPage.closeOverlay(); | 35 OptionsPage.closeOverlay(); |
33 }; | 36 }; |
34 } | 37 } |
35 | 38 |
36 cr.addSingletonGetter(ConsumerManagementOverlay); | 39 cr.addSingletonGetter(ConsumerManagementOverlay); |
37 | 40 |
38 ConsumerManagementOverlay.prototype = { | 41 ConsumerManagementOverlay.prototype = { |
39 __proto__: OptionsPage.prototype, | 42 __proto__: OptionsPage.prototype, |
40 }; | 43 }; |
41 | 44 |
42 /** | |
43 * Shows enrollment or unenrollment content based on the enrollment status. | |
44 * @param {boolean} isEnrolled Whether the device is enrolled. | |
45 */ | |
46 ConsumerManagementOverlay.setEnrollmentStatus = function(isEnrolled) { | |
47 $('unenroll-content').hidden = !($('enroll-content').hidden = isEnrolled); | |
48 }; | |
49 | |
50 // Export | 45 // Export |
51 return { | 46 return { |
52 ConsumerManagementOverlay: ConsumerManagementOverlay | 47 ConsumerManagementOverlay: ConsumerManagementOverlay |
53 }; | 48 }; |
54 }); | 49 }); |
OLD | NEW |