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 $('enroll-content').hidden = isEnrolled; |
| 22 $('unenroll-content').hidden = !isEnrolled; |
| 23 |
20 $('consumer-management-overlay-enroll').onclick = function(event) { | 24 $('consumer-management-overlay-enroll').onclick = function(event) { |
21 chrome.send('enrollConsumerManagement'); | 25 chrome.send('enrollConsumerManagement'); |
22 OptionsPage.closeOverlay(); | 26 OptionsPage.closeOverlay(); |
23 }; | 27 }; |
24 $('consumer-management-overlay-unenroll').onclick = function(event) { | 28 $('consumer-management-overlay-unenroll').onclick = function(event) { |
25 chrome.send('unenrollConsumerManagement'); | 29 chrome.send('unenrollConsumerManagement'); |
26 OptionsPage.closeOverlay(); | 30 OptionsPage.closeOverlay(); |
27 }; | 31 }; |
28 $('consumer-management-overlay-enroll-cancel').onclick = function(event) { | 32 $('consumer-management-overlay-enroll-cancel').onclick = function(event) { |
29 OptionsPage.closeOverlay(); | 33 OptionsPage.closeOverlay(); |
30 }; | 34 }; |
31 $('consumer-management-overlay-unenroll-cancel').onclick = function(event) { | 35 $('consumer-management-overlay-unenroll-cancel').onclick = function(event) { |
32 OptionsPage.closeOverlay(); | 36 OptionsPage.closeOverlay(); |
33 }; | 37 }; |
34 } | 38 } |
35 | 39 |
36 cr.addSingletonGetter(ConsumerManagementOverlay); | 40 cr.addSingletonGetter(ConsumerManagementOverlay); |
37 | 41 |
38 ConsumerManagementOverlay.prototype = { | 42 ConsumerManagementOverlay.prototype = { |
39 __proto__: OptionsPage.prototype, | 43 __proto__: OptionsPage.prototype, |
40 }; | 44 }; |
41 | 45 |
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 | 46 // Export |
51 return { | 47 return { |
52 ConsumerManagementOverlay: ConsumerManagementOverlay | 48 ConsumerManagementOverlay: ConsumerManagementOverlay |
53 }; | 49 }; |
54 }); | 50 }); |
OLD | NEW |