OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 var AddLanguageOverlay = options.AddLanguageOverlay; | 5 var AddLanguageOverlay = options.AddLanguageOverlay; |
6 var AdvancedOptions = options.AdvancedOptions; | 6 var AdvancedOptions = options.AdvancedOptions; |
7 var AlertOverlay = options.AlertOverlay; | 7 var AlertOverlay = options.AlertOverlay; |
8 var AutofillEditAddressOverlay = options.AutofillEditAddressOverlay; | 8 var AutofillEditAddressOverlay = options.AutofillEditAddressOverlay; |
9 var AutofillEditCreditCardOverlay = options.AutofillEditCreditCardOverlay; | 9 var AutofillEditCreditCardOverlay = options.AutofillEditCreditCardOverlay; |
10 var AutofillOptions = options.AutofillOptions; | 10 var AutofillOptions = options.AutofillOptions; |
11 var BrowserOptions = options.BrowserOptions; | 11 var BrowserOptions = options.BrowserOptions; |
12 var ClearBrowserDataOverlay = options.ClearBrowserDataOverlay; | 12 var ClearBrowserDataOverlay = options.ClearBrowserDataOverlay; |
13 var ContentSettings = options.ContentSettings; | 13 var ContentSettings = options.ContentSettings; |
14 var ContentSettingsExceptionsArea = | 14 var ContentSettingsExceptionsArea = |
15 options.contentSettings.ContentSettingsExceptionsArea; | 15 options.contentSettings.ContentSettingsExceptionsArea; |
16 var CookiesView = options.CookiesView; | 16 var CookiesView = options.CookiesView; |
17 var FontSettings = options.FontSettings; | 17 var FontSettings = options.FontSettings; |
| 18 var HandlerOptions = options.HandlerOptions; |
18 var ImportDataOverlay = options.ImportDataOverlay; | 19 var ImportDataOverlay = options.ImportDataOverlay; |
19 var InstantConfirmOverlay = options.InstantConfirmOverlay; | 20 var InstantConfirmOverlay = options.InstantConfirmOverlay; |
20 var LanguageOptions = options.LanguageOptions; | 21 var LanguageOptions = options.LanguageOptions; |
21 var OptionsPage = options.OptionsPage; | 22 var OptionsPage = options.OptionsPage; |
22 var PasswordManager = options.PasswordManager; | 23 var PasswordManager = options.PasswordManager; |
23 var PersonalOptions = options.PersonalOptions; | 24 var PersonalOptions = options.PersonalOptions; |
24 var Preferences = options.Preferences; | 25 var Preferences = options.Preferences; |
25 var ProxyOptions = options.ProxyOptions; | 26 var ProxyOptions = options.ProxyOptions; |
26 var SearchEngineManager = options.SearchEngineManager; | 27 var SearchEngineManager = options.SearchEngineManager; |
27 var SearchPage = options.SearchPage; | 28 var SearchPage = options.SearchPage; |
28 var SyncSetupOverlay = options.SyncSetupOverlay; | 29 var SyncSetupOverlay = options.SyncSetupOverlay; |
29 | 30 |
30 /** | 31 /** |
31 * DOMContentLoaded handler, sets up the page. | 32 * DOMContentLoaded handler, sets up the page. |
32 */ | 33 */ |
33 function load() { | 34 function load() { |
34 // Decorate the existing elements in the document. | 35 // Decorate the existing elements in the document. |
35 cr.ui.decorate('input[pref][type=checkbox]', options.PrefCheckbox); | 36 cr.ui.decorate('input[pref][type=checkbox]', options.PrefCheckbox); |
36 cr.ui.decorate('input[pref][type=number]', options.PrefNumber); | 37 cr.ui.decorate('input[pref][type=number]', options.PrefNumber); |
37 cr.ui.decorate('input[pref][type=radio]', options.PrefRadio); | 38 cr.ui.decorate('input[pref][type=radio]', options.PrefRadio); |
38 cr.ui.decorate('input[pref][type=range]', options.PrefRange); | 39 cr.ui.decorate('input[pref][type=range]', options.PrefRange); |
39 cr.ui.decorate('select[pref]', options.PrefSelect); | 40 cr.ui.decorate('select[pref]', options.PrefSelect); |
40 cr.ui.decorate('input[pref][type=text]', options.PrefTextField); | 41 cr.ui.decorate('input[pref][type=text]', options.PrefTextField); |
41 cr.ui.decorate('input[pref][type=url]', options.PrefTextField); | 42 cr.ui.decorate('input[pref][type=url]', options.PrefTextField); |
42 cr.ui.decorate('#content-settings-page input[type=radio]', | 43 cr.ui.decorate('#content-settings-page input[type=radio] [name]', |
43 options.ContentSettingsRadio); | 44 options.ContentSettingsRadio); |
| 45 cr.ui.decorate('#handlers-section input[type=radio]', |
| 46 options.HandlersEnabledRadio); |
44 | 47 |
45 var menuOffPattern = /(^\?|&)menu=off($|&)/; | 48 var menuOffPattern = /(^\?|&)menu=off($|&)/; |
46 var menuDisabled = menuOffPattern.test(window.location.search); | 49 var menuDisabled = menuOffPattern.test(window.location.search); |
47 // document.documentElement.setAttribute('hide-menu', menuDisabled); | 50 // document.documentElement.setAttribute('hide-menu', menuDisabled); |
48 // We can't use an attribute on the html element because of webkit bug | 51 // We can't use an attribute on the html element because of webkit bug |
49 // 12519. Instead, we add a class. | 52 // 12519. Instead, we add a class. |
50 if (menuDisabled) | 53 if (menuDisabled) |
51 document.documentElement.classList.add('hide-menu'); | 54 document.documentElement.classList.add('hide-menu'); |
52 | 55 |
53 localStrings = new LocalStrings(); | 56 localStrings = new LocalStrings(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 OptionsPage.register(AdvancedOptions.getInstance()); | 100 OptionsPage.register(AdvancedOptions.getInstance()); |
98 OptionsPage.registerSubPage(ContentSettings.getInstance(), | 101 OptionsPage.registerSubPage(ContentSettings.getInstance(), |
99 AdvancedOptions.getInstance(), | 102 AdvancedOptions.getInstance(), |
100 [$('privacyContentSettingsButton')]); | 103 [$('privacyContentSettingsButton')]); |
101 OptionsPage.registerSubPage(ContentSettingsExceptionsArea.getInstance(), | 104 OptionsPage.registerSubPage(ContentSettingsExceptionsArea.getInstance(), |
102 ContentSettings.getInstance()); | 105 ContentSettings.getInstance()); |
103 OptionsPage.registerSubPage(CookiesView.getInstance(), | 106 OptionsPage.registerSubPage(CookiesView.getInstance(), |
104 ContentSettings.getInstance(), | 107 ContentSettings.getInstance(), |
105 [$('privacyContentSettingsButton'), | 108 [$('privacyContentSettingsButton'), |
106 $('show-cookies-button')]); | 109 $('show-cookies-button')]); |
| 110 // If HandlerOptions is null it means it got compiled out. |
| 111 if (HandlerOptions) { |
| 112 OptionsPage.registerSubPage(HandlerOptions.getInstance(), |
| 113 ContentSettings.getInstance(), |
| 114 [$('manage-handlers-button')]); |
| 115 } |
107 OptionsPage.registerSubPage(FontSettings.getInstance(), | 116 OptionsPage.registerSubPage(FontSettings.getInstance(), |
108 AdvancedOptions.getInstance(), | 117 AdvancedOptions.getInstance(), |
109 [$('fontSettingsCustomizeFontsButton')]); | 118 [$('fontSettingsCustomizeFontsButton')]); |
110 if (!cr.isChromeOS) { | 119 if (!cr.isChromeOS) { |
111 OptionsPage.registerSubPage(LanguageOptions.getInstance(), | 120 OptionsPage.registerSubPage(LanguageOptions.getInstance(), |
112 AdvancedOptions.getInstance(), | 121 AdvancedOptions.getInstance(), |
113 [$('language-button')]); | 122 [$('language-button')]); |
114 } | 123 } |
115 if (!cr.isWindows && !cr.isMac) { | 124 if (!cr.isWindows && !cr.isMac) { |
116 OptionsPage.registerSubPage(CertificateManager.getInstance(), | 125 OptionsPage.registerSubPage(CertificateManager.getInstance(), |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 215 |
207 document.addEventListener('DOMContentLoaded', load); | 216 document.addEventListener('DOMContentLoaded', load); |
208 | 217 |
209 window.onpopstate = function(e) { | 218 window.onpopstate = function(e) { |
210 options.OptionsPage.setState(e.state); | 219 options.OptionsPage.setState(e.state); |
211 }; | 220 }; |
212 | 221 |
213 window.onbeforeunload = function() { | 222 window.onbeforeunload = function() { |
214 options.OptionsPage.willClose(); | 223 options.OptionsPage.willClose(); |
215 }; | 224 }; |
OLD | NEW |