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
3 // found in the LICENSE file.
5 cr.define('options', function() {
6 var Page = cr.ui.pageManager.Page;
7 var PageManager = cr.ui.pageManager.PageManager;
10 * ConsumerManagementOverlay class
11 * Dialog that allows users to enroll/unenroll consumer management service.
13 * @extends {cr.ui.pageManager.Page}
15 function ConsumerManagementOverlay() {
16 Page.call(this, 'consumer-management-overlay',
17 loadTimeData.getString('consumerManagementOverlayTabTitle'),
18 'consumer-management-overlay');
20 $('consumer-management-overlay-enroll').onclick = function(event) {
21 chrome.send('enrollConsumerManagement');
22 PageManager.closeOverlay();
24 $('consumer-management-overlay-unenroll').onclick = function(event) {
25 chrome.send('unenrollConsumerManagement');
26 PageManager.closeOverlay();
28 $('consumer-management-overlay-enroll-cancel').onclick = function(event) {
29 PageManager.closeOverlay();
31 $('consumer-management-overlay-unenroll-cancel').onclick = function(event) {
32 PageManager.closeOverlay();
36 cr.addSingletonGetter(ConsumerManagementOverlay);
38 ConsumerManagementOverlay.prototype = {
39 __proto__: Page.prototype,
43 * Consumer management status.
44 * See chrome/browser/chromeos/policy/consumer_management_service.h.
47 ConsumerManagementOverlay.Status = {
48 STATUS_UNKNOWN: 'StatusUnknown',
49 STATUS_ENROLLED: 'StatusEnrolled',
50 STATUS_ENROLLING: 'StatusEnrolling',
51 STATUS_UNENROLLED: 'StatusUnenrolled',
52 STATUS_UNENROLLING: 'StatusUnenrolling'
56 * Shows enrollment or unenrollment content based on the status.
57 * @enum {string} status Consumer management service status string.
59 ConsumerManagementOverlay.setStatus = function(status) {
60 // Status should only be enrolled or unenrolled.
61 assert(status == this.Status.STATUS_ENROLLED ||
62 status == this.Status.STATUS_UNENROLLED);
63 var enrolled = status == this.Status.STATUS_ENROLLED;
64 $('enroll-content').hidden = enrolled;
65 $('unenroll-content').hidden = !enrolled;
70 ConsumerManagementOverlay: ConsumerManagementOverlay