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
3 // found in the LICENSE file.
5 cr.define('options', function() {
6 /** @const */ var FocusOutlineManager = cr.ui.FocusOutlineManager;
10 * This is the absolute difference maintained between standard and
11 * fixed-width font sizes. Refer http://crbug.com/91922.
14 SIZE_DIFFERENCE_FIXED_STANDARD: 3,
17 * Initializes the complete options page. This will cause all C++ handlers
18 * to be invoked to do final setup.
20 initialize: function() {
21 chrome.send('coreOptionsInitialize');
25 * Shows the tab contents for the given navigation tab.
26 * @param {Node} tab The tab that the user clicked.
28 showTab: function(tab) {
29 // Search parents until we find a tab, or the nav bar itself. This allows
30 // tabs to have child nodes, e.g. labels in separately-styled spans.
31 while (tab && tab.classList &&
32 !tab.classList.contains('subpages-nav-tabs') &&
33 !tab.classList.contains('tab')) {
36 if (!tab || !tab.classList || !tab.classList.contains('tab'))
39 // Find tab bar of the tab.
41 while (tabBar && tabBar.classList &&
42 !tabBar.classList.contains('subpages-nav-tabs')) {
43 tabBar = tabBar.parentNode;
45 if (!tabBar || !tabBar.classList)
48 if (tabBar.activeNavTab != null) {
49 tabBar.activeNavTab.classList.remove('active-tab');
50 $(tabBar.activeNavTab.getAttribute('tab-contents')).classList.
51 remove('active-tab-contents');
54 tab.classList.add('active-tab');
55 $(tab.getAttribute('tab-contents')).classList.add('active-tab-contents');
56 tabBar.activeNavTab = tab;
60 * Shows or hides options for clearing Flash LSOs.
61 * @param {boolean} enabled Whether plugin data can be cleared.
63 setClearPluginLSODataEnabled: function(enabled) {
65 document.documentElement.setAttribute(
66 'flashPluginSupportsClearSiteData', '');
68 document.documentElement.removeAttribute(
69 'flashPluginSupportsClearSiteData');
71 if (navigator.plugins['Shockwave Flash'])
72 document.documentElement.setAttribute('hasFlashPlugin', '');
76 * Shows or hides Pepper Flash settings.
77 * @param {boolean} enabled Whether Pepper Flash settings should be enabled.
79 setPepperFlashSettingsEnabled: function(enabled) {
81 document.documentElement.setAttribute(
82 'enablePepperFlashSettings', '');
84 document.documentElement.removeAttribute(
85 'enablePepperFlashSettings');
90 * Sets whether Settings is shown as a standalone page in a window for the
91 * app launcher settings "app".
92 * @param {boolean} isSettingsApp Whether this page is shown standalone.
94 setIsSettingsApp: function(isSettingsApp) {
95 document.documentElement.classList.toggle('settings-app', isSettingsApp);
99 * Returns true if Settings is shown as an "app" (in a window by itself)
100 * for the app launcher settings "app".
101 * @return {boolean} Whether this page is shown standalone.
103 isSettingsApp: function() {
104 return document.documentElement.classList.contains('settings-app');
110 OptionsPage: OptionsPage