| 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 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 * state. |
| 1980 * @param {string} state can be "enrolled", "unenrolled", "enrolling", or |
| 1981 * "unenrolling". |
| 1982 */ |
| 1983 BrowserOptions.setConsumerManagementEnrollmentState = function(state) { |
| 1984 var button = $('consumer-management-button'); |
| 1985 if (state == 'unenrolled') { |
| 1986 button.textContent = |
| 1987 loadTimeData.getString('consumerManagementEnrollButton'); |
| 1988 button.disabled = false; |
| 1989 } else if (state == 'enrolling') { |
| 1990 button.textContent = |
| 1991 loadTimeData.getString('consumerManagementEnrollingButton'); |
| 1992 button.disabled = true; |
| 1993 } else if (state == 'enrolled') { |
| 1994 button.textContent = |
| 1995 loadTimeData.getString('consumerManagementUnenrollButton'); |
| 1996 button.disabled = false; |
| 1997 } else if (state == 'unenrolling') { |
| 1998 button.textContent = |
| 1999 loadTimeData.getString('consumerManagementUnenrollingButton'); |
| 2000 button.disabled = true; |
| 2001 } |
| 2002 ConsumerManagementOverlay.setEnrollmentState(state); |
| 2003 }; |
| 1983 } | 2004 } |
| 1984 | 2005 |
| 1985 // Export | 2006 // Export |
| 1986 return { | 2007 return { |
| 1987 BrowserOptions: BrowserOptions | 2008 BrowserOptions: BrowserOptions |
| 1988 }; | 2009 }; |
| 1989 }); | 2010 }); |
| OLD | NEW |