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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 $('proxiesConfigureButton').onclick = function(event) { | 463 $('proxiesConfigureButton').onclick = function(event) { |
464 chrome.send('showNetworkProxySettings'); | 464 chrome.send('showNetworkProxySettings'); |
465 }; | 465 }; |
466 } | 466 } |
467 | 467 |
468 // Device control section. | 468 // Device control section. |
469 if (cr.isChromeOS && | 469 if (cr.isChromeOS && |
470 UIAccountTweaks.currentUserIsOwner() && | 470 UIAccountTweaks.currentUserIsOwner() && |
471 loadTimeData.getBoolean('consumerManagementEnabled')) { | 471 loadTimeData.getBoolean('consumerManagementEnabled')) { |
472 $('device-control-section').hidden = false; | 472 $('device-control-section').hidden = false; |
473 | 473 $('consumer-management-button').onclick = function(event) { |
474 var isEnrolled = loadTimeData.getBoolean('consumerManagementEnrolled'); | 474 PageManager.showPageByName('consumer-management-overlay'); |
475 $('consumer-management-enroll').hidden = isEnrolled; | |
476 $('consumer-management-unenroll').hidden = !isEnrolled; | |
477 | |
478 $('consumer-management-section').onclick = function(event) { | |
479 // If either button is clicked. | |
480 if (event.target.tagName == 'BUTTON') | |
481 PageManager.showPageByName('consumer-management-overlay'); | |
482 }; | 475 }; |
483 } | 476 } |
484 | 477 |
485 // Easy Unlock section. | 478 // Easy Unlock section. |
486 if (loadTimeData.getBoolean('easyUnlockAllowed')) { | 479 if (loadTimeData.getBoolean('easyUnlockAllowed')) { |
487 $('easy-unlock-section').hidden = false; | 480 $('easy-unlock-section').hidden = false; |
488 $('easy-unlock-setup-button').onclick = function(event) { | 481 $('easy-unlock-setup-button').onclick = function(event) { |
489 chrome.send('launchEasyUnlockSetup'); | 482 chrome.send('launchEasyUnlockSetup'); |
490 }; | 483 }; |
491 $('easy-unlock-turn-off-button').onclick = function(event) { | 484 $('easy-unlock-turn-off-button').onclick = function(event) { |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 | 1950 |
1958 if (cr.isChromeOS) { | 1951 if (cr.isChromeOS) { |
1959 /** | 1952 /** |
1960 * Returns username (canonical email) of the user logged in (ChromeOS only). | 1953 * Returns username (canonical email) of the user logged in (ChromeOS only). |
1961 * @return {string} user email. | 1954 * @return {string} user email. |
1962 */ | 1955 */ |
1963 // TODO(jhawkins): Investigate the use case for this method. | 1956 // TODO(jhawkins): Investigate the use case for this method. |
1964 BrowserOptions.getLoggedInUsername = function() { | 1957 BrowserOptions.getLoggedInUsername = function() { |
1965 return BrowserOptions.getInstance().username_; | 1958 return BrowserOptions.getInstance().username_; |
1966 }; | 1959 }; |
| 1960 |
| 1961 /** |
| 1962 * Shows different button text for each consumer management enrollment |
| 1963 * status. |
| 1964 * @enum {string} status Consumer management service status string. |
| 1965 */ |
| 1966 BrowserOptions.setConsumerManagementStatus = function(status) { |
| 1967 var button = $('consumer-management-button'); |
| 1968 if (status == 'StatusUnknown') { |
| 1969 button.hidden = true; |
| 1970 return; |
| 1971 } |
| 1972 |
| 1973 button.hidden = false; |
| 1974 var strId; |
| 1975 switch (status) { |
| 1976 case ConsumerManagementOverlay.Status.STATUS_UNENROLLED: |
| 1977 strId = 'consumerManagementEnrollButton'; |
| 1978 button.disabled = false; |
| 1979 ConsumerManagementOverlay.setStatus(status); |
| 1980 break; |
| 1981 case ConsumerManagementOverlay.Status.STATUS_ENROLLING: |
| 1982 strId = 'consumerManagementEnrollingButton'; |
| 1983 button.disabled = true; |
| 1984 break; |
| 1985 case ConsumerManagementOverlay.Status.STATUS_ENROLLED: |
| 1986 strId = 'consumerManagementUnenrollButton'; |
| 1987 button.disabled = false; |
| 1988 ConsumerManagementOverlay.setStatus(status); |
| 1989 break; |
| 1990 case ConsumerManagementOverlay.Status.STATUS_UNENROLLING: |
| 1991 strId = 'consumerManagementUnenrollingButton'; |
| 1992 button.disabled = true; |
| 1993 break; |
| 1994 } |
| 1995 button.textContent = loadTimeData.getString(strId); |
| 1996 }; |
1967 } | 1997 } |
1968 | 1998 |
1969 // Export | 1999 // Export |
1970 return { | 2000 return { |
1971 BrowserOptions: BrowserOptions | 2001 BrowserOptions: BrowserOptions |
1972 }; | 2002 }; |
1973 }); | 2003 }); |
OLD | NEW |