Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: chrome/browser/resources/options2/advanced_options.js

Issue 8937011: Revert "Options2: Pull the trigger." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 //
10 // AdvancedOptions class
11 // Encapsulated handling of advanced options page.
12 //
13 function AdvancedOptions() {
14 OptionsPage.call(this, 'advanced', templateData.advancedPageTabTitle,
15 'advancedPage');
16 }
17
18 cr.addSingletonGetter(AdvancedOptions);
19
20 AdvancedOptions.prototype = {
21 // Inherit AdvancedOptions from OptionsPage.
22 __proto__: options.OptionsPage.prototype,
23
24 /**
25 * Initializes the page.
26 */
27 initializePage: function() {
28 // Call base class implementation to starts preference initialization.
29 OptionsPage.prototype.initializePage.call(this);
30
31 // Set up click handlers for buttons.
32 $('privacyContentSettingsButton').onclick = function(event) {
33 OptionsPage.navigateToPage('content');
34 OptionsPage.showTab($('cookies-nav-tab'));
35 chrome.send('coreOptionsUserMetricsAction',
36 ['Options_ContentSettings']);
37 };
38 $('privacyClearDataButton').onclick = function(event) {
39 OptionsPage.navigateToPage('clearBrowserData');
40 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']);
41 };
42
43 // 'metricsReportingEnabled' element is only present on Chrome branded
44 // builds.
45 if ($('metricsReportingEnabled')) {
46 $('metricsReportingEnabled').onclick = function(event) {
47 chrome.send('metricsReportingCheckboxAction',
48 [String(event.target.checked)]);
49 };
50 }
51
52 if (!cr.isChromeOS) {
53 $('autoOpenFileTypesResetToDefault').onclick = function(event) {
54 chrome.send('autoOpenFileTypesAction');
55 };
56 }
57
58 $('fontSettingsCustomizeFontsButton').onclick = function(event) {
59 OptionsPage.navigateToPage('fonts');
60 chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']);
61 };
62 $('defaultFontSize').onchange = function(event) {
63 chrome.send('defaultFontSizeAction',
64 [String(event.target.options[event.target.selectedIndex].value)]);
65 };
66 $('defaultZoomFactor').onchange = function(event) {
67 chrome.send('defaultZoomFactorAction',
68 [String(event.target.options[event.target.selectedIndex].value)]);
69 };
70
71 $('language-button').onclick = function(event) {
72 OptionsPage.navigateToPage('languages');
73 chrome.send('coreOptionsUserMetricsAction',
74 ['Options_LanuageAndSpellCheckSettings']);
75 };
76
77 if (cr.isWindows || cr.isMac) {
78 $('certificatesManageButton').onclick = function(event) {
79 chrome.send('showManageSSLCertificates');
80 };
81 } else {
82 $('certificatesManageButton').onclick = function(event) {
83 OptionsPage.navigateToPage('certificates');
84 chrome.send('coreOptionsUserMetricsAction',
85 ['Options_ManageSSLCertificates']);
86 };
87 }
88
89 if (!cr.isChromeOS) {
90 $('proxiesConfigureButton').onclick = function(event) {
91 chrome.send('showNetworkProxySettings');
92 };
93 $('downloadLocationChangeButton').onclick = function(event) {
94 chrome.send('selectDownloadLocation');
95 };
96 // This text field is always disabled. Setting ".disabled = true" isn't
97 // enough, since a policy can disable it but shouldn't re-enable when
98 // it is removed.
99 $('downloadLocationPath').setDisabled('readonly', true);
100 }
101
102 $('sslCheckRevocation').onclick = function(event) {
103 chrome.send('checkRevocationCheckboxAction',
104 [String($('sslCheckRevocation').checked)]);
105 };
106
107 if ($('backgroundModeCheckbox')) {
108 $('backgroundModeCheckbox').onclick = function(event) {
109 chrome.send('backgroundModeAction',
110 [String($('backgroundModeCheckbox').checked)]);
111 };
112 }
113
114 // 'cloudPrintProxyEnabled' is true for Chrome branded builds on
115 // certain platforms, or could be enabled by a lab.
116 if (!cr.isChromeOS) {
117 $('cloudPrintProxySetupButton').onclick = function(event) {
118 if ($('cloudPrintProxyManageButton').style.display == 'none') {
119 // Disable the button, set it's text to the intermediate state.
120 $('cloudPrintProxySetupButton').textContent =
121 localStrings.getString('cloudPrintProxyEnablingButton');
122 $('cloudPrintProxySetupButton').disabled = true;
123 chrome.send('showCloudPrintSetupDialog');
124 } else {
125 chrome.send('disableCloudPrintProxy');
126 }
127 };
128 }
129 $('cloudPrintProxyManageButton').onclick = function(event) {
130 chrome.send('showCloudPrintManagePage');
131 };
132
133 }
134 };
135
136 //
137 // Chrome callbacks
138 //
139
140 // Set the checked state of the metrics reporting checkbox.
141 AdvancedOptions.SetMetricsReportingCheckboxState = function(
142 checked, disabled) {
143 $('metricsReportingEnabled').checked = checked;
144 $('metricsReportingEnabled').disabled = disabled;
145 if (disabled)
146 $('metricsReportingEnabledText').className = 'disable-services-span';
147 }
148
149 AdvancedOptions.SetMetricsReportingSettingVisibility = function(visible) {
150 if (visible) {
151 $('metricsReportingSetting').style.display = 'block';
152 } else {
153 $('metricsReportingSetting').style.display = 'none';
154 }
155 }
156
157 // Set the font size selected item.
158 AdvancedOptions.SetFontSize = function(font_size_value) {
159 var selectCtl = $('defaultFontSize');
160 for (var i = 0; i < selectCtl.options.length; i++) {
161 if (selectCtl.options[i].value == font_size_value) {
162 selectCtl.selectedIndex = i;
163 if ($('Custom'))
164 selectCtl.remove($('Custom').index);
165 return;
166 }
167 }
168
169 // Add/Select Custom Option in the font size label list.
170 if (!$('Custom')) {
171 var option = new Option(localStrings.getString('fontSizeLabelCustom'),
172 -1, false, true);
173 option.setAttribute("id", "Custom");
174 selectCtl.add(option);
175 }
176 $('Custom').selected = true;
177 };
178
179 /**
180 * Populate the page zoom selector with values received from the caller.
181 * @param {Array} items An array of items to populate the selector.
182 * each object is an array with three elements as follows:
183 * 0: The title of the item (string).
184 * 1: The value of the item (number).
185 * 2: Whether the item should be selected (boolean).
186 */
187 AdvancedOptions.SetupPageZoomSelector = function(items) {
188 var element = $('defaultZoomFactor');
189
190 // Remove any existing content.
191 element.textContent = '';
192
193 // Insert new child nodes into select element.
194 var value, title, selected;
195 for (var i = 0; i < items.length; i++) {
196 title = items[i][0];
197 value = items[i][1];
198 selected = items[i][2];
199 element.appendChild(new Option(title, value, false, selected));
200 }
201 };
202
203 // Set the enabled state for the autoOpenFileTypesResetToDefault button.
204 AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function(disabled) {
205 if (!cr.isChromeOS) {
206 $('autoOpenFileTypesResetToDefault').disabled = disabled;
207
208 if (disabled)
209 $('auto-open-file-types-label').classList.add('disabled');
210 else
211 $('auto-open-file-types-label').classList.remove('disabled');
212 }
213 };
214
215 // Set the enabled state for the proxy settings button.
216 AdvancedOptions.SetupProxySettingsSection = function(disabled, label) {
217 if (!cr.isChromeOS) {
218 $('proxiesConfigureButton').disabled = disabled;
219 $('proxiesLabel').textContent = label;
220 }
221 };
222
223 // Set the checked state for the sslCheckRevocation checkbox.
224 AdvancedOptions.SetCheckRevocationCheckboxState = function(
225 checked, disabled) {
226 $('sslCheckRevocation').checked = checked;
227 $('sslCheckRevocation').disabled = disabled;
228 };
229
230 // Set the checked state for the backgroundModeCheckbox element.
231 AdvancedOptions.SetBackgroundModeCheckboxState = function(checked) {
232 $('backgroundModeCheckbox').checked = checked;
233 };
234
235 // Set the Cloud Print proxy UI to enabled, disabled, or processing.
236 AdvancedOptions.SetupCloudPrintProxySection = function(
237 disabled, label, allowed) {
238 if (!cr.isChromeOS) {
239 $('cloudPrintProxyLabel').textContent = label;
240 if (disabled || !allowed) {
241 $('cloudPrintProxySetupButton').textContent =
242 localStrings.getString('cloudPrintProxyDisabledButton');
243 $('cloudPrintProxyManageButton').style.display = 'none';
244 } else {
245 $('cloudPrintProxySetupButton').textContent =
246 localStrings.getString('cloudPrintProxyEnabledButton');
247 $('cloudPrintProxyManageButton').style.display = 'inline';
248 }
249 $('cloudPrintProxySetupButton').disabled = !allowed;
250 }
251 };
252
253 AdvancedOptions.RemoveCloudPrintProxySection = function() {
254 if (!cr.isChromeOS) {
255 var proxySectionElm = $('cloud-print-proxy-section');
256 if (proxySectionElm)
257 proxySectionElm.parentNode.removeChild(proxySectionElm);
258 }
259 };
260
261 // Export
262 return {
263 AdvancedOptions: AdvancedOptions
264 };
265
266 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options2/advanced_options.html ('k') | chrome/browser/resources/options2/alert_overlay.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698