Home | History | Annotate | Download | only in chromeos
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 cr.define('options', function() {
      6 
      7   var OptionsPage = options.OptionsPage;
      8   /////////////////////////////////////////////////////////////////////////////
      9   // SystemOptions class:
     10 
     11   /**
     12    * Encapsulated handling of ChromeOS system options page.
     13    * @constructor
     14    */
     15 
     16   function SystemOptions() {
     17     OptionsPage.call(this, 'system', templateData.systemPageTabTitle,
     18                      'systemPage');
     19   }
     20 
     21   cr.addSingletonGetter(SystemOptions);
     22 
     23   // Inherit SystemOptions from OptionsPage.
     24   SystemOptions.prototype = {
     25     __proto__: options.OptionsPage.prototype,
     26 
     27     /**
     28      * Initializes SystemOptions page.
     29      * Calls base class implementation to starts preference initialization.
     30      */
     31     initializePage: function() {
     32       OptionsPage.prototype.initializePage.call(this);
     33       var timezone = $('timezone-select');
     34       if (timezone) {
     35         // Disable the timezone setting for non-owners, as this is a
     36         // system wide setting.
     37         if (!AccountsOptions.currentUserIsOwner())
     38           timezone.disabled = true;
     39       }
     40 
     41       $('language-button').onclick = function(event) {
     42         OptionsPage.navigateToPage('language');
     43       };
     44       $('modifier-keys-button').onclick = function(event) {
     45         OptionsPage.navigateToPage('languageCustomizeModifierKeysOverlay');
     46       };
     47       $('accesibility-check').onchange = function(event) {
     48         chrome.send('accessibilityChange',
     49                     [String($('accesibility-check').checked)]);
     50       };
     51     }
     52   };
     53 
     54   //
     55   // Chrome callbacks
     56   //
     57 
     58   /**
     59    * Set the initial state of the accessibility checkbox.
     60    */
     61   SystemOptions.SetAccessibilityCheckboxState = function(checked) {
     62     $('accesibility-check').checked = checked;
     63   };
     64 
     65   // Export
     66   return {
     67     SystemOptions: SystemOptions
     68   };
     69 
     70 });
     71