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 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 $('proxiesConfigureButton').onclick = function(event) { | 471 $('proxiesConfigureButton').onclick = function(event) { |
472 chrome.send('showNetworkProxySettings'); | 472 chrome.send('showNetworkProxySettings'); |
473 }; | 473 }; |
474 } | 474 } |
475 | 475 |
476 // Device control section. | 476 // Device control section. |
477 if (cr.isChromeOS && | 477 if (cr.isChromeOS && |
478 UIAccountTweaks.currentUserIsOwner() && | 478 UIAccountTweaks.currentUserIsOwner() && |
479 loadTimeData.getBoolean('consumerManagementEnabled')) { | 479 loadTimeData.getBoolean('consumerManagementEnabled')) { |
480 $('device-control-section').hidden = false; | 480 $('device-control-section').hidden = false; |
481 | 481 $('consumer-management-button').onclick = function(event) { |
482 var isEnrolled = loadTimeData.getBoolean('consumerManagementEnrolled'); | 482 PageManager.showPageByName('consumer-management-overlay'); |
483 $('consumer-management-enroll').hidden = isEnrolled; | |
484 $('consumer-management-unenroll').hidden = !isEnrolled; | |
485 | |
486 $('consumer-management-section').onclick = function(event) { | |
487 // If either button is clicked. | |
488 if (event.target.tagName == 'BUTTON') | |
489 PageManager.showPageByName('consumer-management-overlay'); | |
490 }; | 483 }; |
491 } | 484 } |
492 | 485 |
493 // Easy Unlock section. | 486 // Easy Unlock section. |
494 if (loadTimeData.getBoolean('easyUnlockAllowed')) { | 487 if (loadTimeData.getBoolean('easyUnlockAllowed')) { |
495 $('easy-unlock-section').hidden = false; | 488 $('easy-unlock-section').hidden = false; |
496 $('easy-unlock-setup-button').onclick = function(event) { | 489 $('easy-unlock-setup-button').onclick = function(event) { |
497 chrome.send('launchEasyUnlockSetup'); | 490 chrome.send('launchEasyUnlockSetup'); |
498 }; | 491 }; |
499 $('easy-unlock-turn-off-button').onclick = function(event) { | 492 $('easy-unlock-turn-off-button').onclick = function(event) { |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1966 | 1959 |
1967 if (cr.isChromeOS) { | 1960 if (cr.isChromeOS) { |
1968 /** | 1961 /** |
1969 * Returns username (canonical email) of the user logged in (ChromeOS only). | 1962 * Returns username (canonical email) of the user logged in (ChromeOS only). |
1970 * @return {string} user email. | 1963 * @return {string} user email. |
1971 */ | 1964 */ |
1972 // TODO(jhawkins): Investigate the use case for this method. | 1965 // TODO(jhawkins): Investigate the use case for this method. |
1973 BrowserOptions.getLoggedInUsername = function() { | 1966 BrowserOptions.getLoggedInUsername = function() { |
1974 return BrowserOptions.getInstance().username_; | 1967 return BrowserOptions.getInstance().username_; |
1975 }; | 1968 }; |
1969 | |
1970 /** | |
1971 * Shows different button text for each consumer management enrollment | |
1972 * status. | |
1973 * @enum {string} status Consumer management service status string. | |
1974 */ | |
1975 BrowserOptions.setConsumerManagementStatus = function(status) { | |
Dan Beam
2014/09/05 19:26:49
nit: consider a switch() (which works on strings i
davidyu
2014/09/09 03:35:00
Done.
| |
1976 var button = $('consumer-management-button'); | |
1977 if (status == 'StatusUnknown') { | |
1978 button.hidden = true; | |
1979 return; | |
1980 } | |
1981 | |
1982 button.hidden = false; | |
1983 var strId; | |
1984 if (status == ConsumerManagementOverlay.Status.STATUS_UNENROLLED) { | |
1985 strId = 'consumerManagementEnrollButton'; | |
1986 button.disabled = false; | |
1987 ConsumerManagementOverlay.setStatus(status); | |
1988 } else if (status == ConsumerManagementOverlay.Status.STATUS_ENROLLING) { | |
1989 strId = 'consumerManagementEnrollingButton'; | |
1990 button.disabled = true; | |
1991 } else if (status == ConsumerManagementOverlay.Status.STATUS_ENROLLED) { | |
1992 strId = 'consumerManagementUnenrollButton'; | |
1993 button.disabled = false; | |
1994 ConsumerManagementOverlay.setStatus(status); | |
1995 } else if (status == | |
1996 ConsumerManagementOverlay.Status.STATUS_UNENROLLING) { | |
1997 strId = 'consumerManagementUnenrollingButton'; | |
1998 button.disabled = true; | |
1999 } | |
2000 button.textContent = loadTimeData.getString(strId); | |
2001 }; | |
1976 } | 2002 } |
1977 | 2003 |
1978 // Export | 2004 // Export |
1979 return { | 2005 return { |
1980 BrowserOptions: BrowserOptions | 2006 BrowserOptions: BrowserOptions |
1981 }; | 2007 }; |
1982 }); | 2008 }); |
OLD | NEW |