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

Side by Side Diff: chrome/browser/resources/options/browser_options.js

Issue 493613002: Add an enrolling state for consumer management section in settings page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dn
Patch Set: Created 6 years, 4 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
OLDNEW
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 cr.define('options', function() { 5 cr.define('options', function() {
6 var OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 var Page = cr.ui.pageManager.Page; 7 var Page = cr.ui.pageManager.Page;
8 var PageManager = cr.ui.pageManager.PageManager; 8 var PageManager = cr.ui.pageManager.PageManager;
9 var ArrayDataModel = cr.ui.ArrayDataModel; 9 var ArrayDataModel = cr.ui.ArrayDataModel;
10 var RepeatingButton = cr.ui.RepeatingButton; 10 var RepeatingButton = cr.ui.RepeatingButton;
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 $('proxiesConfigureButton').onclick = function(event) { 476 $('proxiesConfigureButton').onclick = function(event) {
477 chrome.send('showNetworkProxySettings'); 477 chrome.send('showNetworkProxySettings');
478 }; 478 };
479 } 479 }
480 480
481 // Device control section. 481 // Device control section.
482 if (cr.isChromeOS && 482 if (cr.isChromeOS &&
483 UIAccountTweaks.currentUserIsOwner() && 483 UIAccountTweaks.currentUserIsOwner() &&
484 loadTimeData.getBoolean('consumerManagementEnabled')) { 484 loadTimeData.getBoolean('consumerManagementEnabled')) {
485 $('device-control-section').hidden = false; 485 $('device-control-section').hidden = false;
486 486 $('consumer-management-button').onclick = function(event) {
487 var isEnrolled = loadTimeData.getBoolean('consumerManagementEnrolled'); 487 PageManager.showPageByName('consumer-management-overlay');
488 $('consumer-management-enroll').hidden = isEnrolled;
489 $('consumer-management-unenroll').hidden = !isEnrolled;
490
491 $('consumer-management-section').onclick = function(event) {
492 // If either button is clicked.
493 if (event.target.tagName == 'BUTTON')
494 PageManager.showPageByName('consumer-management-overlay');
495 }; 488 };
496 } 489 }
497 490
498 // Easy Unlock section. 491 // Easy Unlock section.
499 if (loadTimeData.getBoolean('easyUnlockAllowed')) { 492 if (loadTimeData.getBoolean('easyUnlockAllowed')) {
500 $('easy-unlock-section').hidden = false; 493 $('easy-unlock-section').hidden = false;
501 $('easy-unlock-setup-button').onclick = function(event) { 494 $('easy-unlock-setup-button').onclick = function(event) {
502 chrome.send('launchEasyUnlockSetup'); 495 chrome.send('launchEasyUnlockSetup');
503 }; 496 };
504 $('easy-unlock-turn-off-button').onclick = function(event) { 497 $('easy-unlock-turn-off-button').onclick = function(event) {
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 1966
1974 if (cr.isChromeOS) { 1967 if (cr.isChromeOS) {
1975 /** 1968 /**
1976 * Returns username (canonical email) of the user logged in (ChromeOS only). 1969 * Returns username (canonical email) of the user logged in (ChromeOS only).
1977 * @return {string} user email. 1970 * @return {string} user email.
1978 */ 1971 */
1979 // TODO(jhawkins): Investigate the use case for this method. 1972 // TODO(jhawkins): Investigate the use case for this method.
1980 BrowserOptions.getLoggedInUsername = function() { 1973 BrowserOptions.getLoggedInUsername = function() {
1981 return BrowserOptions.getInstance().username_; 1974 return BrowserOptions.getInstance().username_;
1982 }; 1975 };
1976
1977 /**
1978 * Shows different button text for each consumer management enrollment
1979 * status.
1980 * @param {string} status consumer management service status string.
bartfab (slow) 2014/08/21 11:39:35 Nit: s/consumer/Consumer/
davidyu 2014/08/22 05:14:13 Done.
1981 */
1982 BrowserOptions.setConsumerManagementStatus = function(status) {
1983 var button = $('consumer-management-button');
1984 if (status == 'STATUS_UNKNOWN') {
1985 button.hidden = true;
1986 return;
1987 }
1988
1989 button.hidden = false;
1990 if (status == 'STATUS_UNENROLLED') {
1991 button.textContent =
1992 loadTimeData.getString('consumerManagementEnrollButton');
1993 button.disabled = false;
1994 ConsumerManagementOverlay.setStatus(status);
1995 } else if (status == 'STATUS_ENROLLING') {
1996 button.textContent =
1997 loadTimeData.getString('consumerManagementEnrollingButton');
1998 button.disabled = true;
1999 } else if (status == 'STATUS_ENROLLED') {
2000 button.textContent =
2001 loadTimeData.getString('consumerManagementUnenrollButton');
2002 button.disabled = false;
2003 ConsumerManagementOverlay.setStatus(status);
2004 } else if (status == 'STATUS_UNENROLLING') {
2005 button.textContent =
2006 loadTimeData.getString('consumerManagementUnenrollingButton');
2007 button.disabled = true;
2008 }
2009 };
1983 } 2010 }
1984 2011
1985 // Export 2012 // Export
1986 return { 2013 return {
1987 BrowserOptions: BrowserOptions 2014 BrowserOptions: BrowserOptions
1988 }; 2015 };
1989 }); 2016 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698