1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
cr.define('options', function() {
var OptionsPage = options.OptionsPage;
//
// AdvancedOptions class
// Encapsulated handling of advanced options page.
//
function AdvancedOptions() {
OptionsPage.call(this, 'advanced', templateData.advancedPage,
'advancedPage');
}
cr.addSingletonGetter(AdvancedOptions);
AdvancedOptions.prototype = {
// Inherit AdvancedOptions from OptionsPage.
__proto__: options.OptionsPage.prototype,
// Initialize AdvancedOptions page.
initializePage: function() {
// Call base class implementation to starts preference initialization.
OptionsPage.prototype.initializePage.call(this);
// Setup click handlers for buttons.
$('privacyContentSettingsButton').onclick = function(event) {
OptionsPage.showPageByName('content');
OptionsPage.showTab($('cookies-nav-tab'));
chrome.send('coreOptionsUserMetricsAction',
['Options_ContentSettings']);
};
$('privacyClearDataButton').onclick = function(event) {
OptionsPage.showOverlay('clearBrowserDataOverlay');
chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']);
};
$('autoOpenFileTypesResetToDefault').onclick = function(event) {
chrome.send('autoOpenFileTypesAction');
};
$('fontSettingsConfigureFontsOnlyButton').onclick = function(event) {
OptionsPage.showPageByName('fontSettings');
chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']);
};
if (!cr.isChromeOS) {
$('optionsReset').onclick = function(event) {
AlertOverlay.show(undefined,
localStrings.getString('optionsResetMessage'),
localStrings.getString('optionsResetOkLabel'),
localStrings.getString('optionsResetCancelLabel'),
function() { chrome.send('resetToDefaults'); });
}
$('proxiesConfigureButton').onclick = function(event) {
chrome.send('showNetworkProxySettings');
};
$('certificatesManageButton').onclick = function(event) {
chrome.send('showManageSSLCertificates');
};
$('downloadLocationBrowseButton').onclick = function(event) {
chrome.send('selectDownloadLocation');
};
// Remove Windows-style accelerators from the Browse button label.
// TODO(csilv): Remove this after the accelerator has been removed from
// the localized strings file, pending removal of old options window.
$('downloadLocationBrowseButton').textContent =
localStrings.getStringWithoutAccelerator(
'downloadLocationBrowseButton');
} else {
$('proxiesConfigureButton').onclick = function(event) {
OptionsPage.showPageByName('proxy');
chrome.send('coreOptionsUserMetricsAction',
['Options_ShowProxySettings']);
};
}
if (cr.isWindows) {
$('sslCheckRevocation').onclick = function(event) {
chrome.send('checkRevocationCheckboxAction',
[String($('sslCheckRevocation').checked)]);
};
$('sslUseSSL2').onclick = function(event) {
chrome.send('useSSL2CheckboxAction',
[String($('sslUseSSL2').checked)]);
};
$('gearSettingsConfigureGearsButton').onclick = function(event) {
chrome.send('showGearsSettings');
};
}
}
};
//
// Chrome callbacks
//
// Set the download path.
AdvancedOptions.SetDownloadLocationPath = function(path) {
if (!cr.isChromeOS)
$('downloadLocationPath').value = path;
};
// Set the enabled state for the autoOpenFileTypesResetToDefault button.
AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute = function(disabled) {
$('autoOpenFileTypesResetToDefault').disabled = disabled;
};
// Set the enabled state for the proxy settings button.
AdvancedOptions.SetupProxySettingsSection = function(disabled, label) {
$('proxiesConfigureButton').disabled = disabled;
$('proxiesLabel').textContent = label;
};
// Set the checked state for the sslCheckRevocation checkbox.
AdvancedOptions.SetCheckRevocationCheckboxState = function(checked) {
$('sslCheckRevocation').checked = checked;
};
// Set the checked state for the sslUseSSL2 checkbox.
AdvancedOptions.SetUseSSL2CheckboxState = function(checked) {
$('sslUseSSL2').checked = checked;
};
// Export
return {
AdvancedOptions: AdvancedOptions
};
});
|