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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1971 | 1964 |
1972 if (cr.isChromeOS) { | 1965 if (cr.isChromeOS) { |
1973 /** | 1966 /** |
1974 * Returns username (canonical email) of the user logged in (ChromeOS only). | 1967 * Returns username (canonical email) of the user logged in (ChromeOS only). |
1975 * @return {string} user email. | 1968 * @return {string} user email. |
1976 */ | 1969 */ |
1977 // TODO(jhawkins): Investigate the use case for this method. | 1970 // TODO(jhawkins): Investigate the use case for this method. |
1978 BrowserOptions.getLoggedInUsername = function() { | 1971 BrowserOptions.getLoggedInUsername = function() { |
1979 return BrowserOptions.getInstance().username_; | 1972 return BrowserOptions.getInstance().username_; |
1980 }; | 1973 }; |
1974 | |
1975 /** | |
1976 * Shows different button text for each consumer management enrollment | |
1977 * status. | |
1978 * @param {string} status Consumer management service status string. | |
Dan Beam
2014/09/04 23:12:37
can this be an @enum {string} instead?
davidyu
2014/09/05 06:14:11
Done.
| |
1979 */ | |
1980 BrowserOptions.setConsumerManagementStatus = function(status) { | |
1981 var button = $('consumer-management-button'); | |
1982 if (status == 'StatusUnknown') { | |
1983 button.hidden = true; | |
1984 return; | |
1985 } | |
1986 | |
1987 button.hidden = false; | |
Dan Beam
2014/09/04 23:12:37
var strId;
davidyu
2014/09/05 06:14:11
Done.
| |
1988 if (status == 'StatusUnenrolled') { | |
1989 button.textContent = | |
1990 loadTimeData.getString('consumerManagementEnrollButton'); | |
Dan Beam
2014/09/04 23:12:37
strId = 'consumerManagementEnrollButton';
davidyu
2014/09/05 06:14:11
Done.
| |
1991 button.disabled = false; | |
1992 ConsumerManagementOverlay.setStatus(status); | |
1993 } else if (status == 'StatusEnrolling') { | |
1994 button.textContent = | |
1995 loadTimeData.getString('consumerManagementEnrollingButton'); | |
1996 button.disabled = true; | |
1997 } else if (status == 'StatusEnrolled') { | |
1998 button.textContent = | |
1999 loadTimeData.getString('consumerManagementUnenrollButton'); | |
2000 button.disabled = false; | |
2001 ConsumerManagementOverlay.setStatus(status); | |
2002 } else if (status == 'StatusUnenrolling') { | |
2003 button.textContent = | |
2004 loadTimeData.getString('consumerManagementUnenrollingButton'); | |
2005 button.disabled = true; | |
2006 } | |
Dan Beam
2014/09/04 23:12:37
button.textContent = loadTimeData.getString(strId)
davidyu
2014/09/05 06:14:11
Done.
| |
2007 }; | |
1981 } | 2008 } |
1982 | 2009 |
1983 // Export | 2010 // Export |
1984 return { | 2011 return { |
1985 BrowserOptions: BrowserOptions | 2012 BrowserOptions: BrowserOptions |
1986 }; | 2013 }; |
1987 }); | 2014 }); |
OLD | NEW |