OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 | 6 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 | 8 |
9 // State variables. | 9 // State variables. |
10 var syncEnabled = false; | 10 var syncEnabled = false; |
(...skipping 22 matching lines...) Expand all Loading... | |
33 var self = this; | 33 var self = this; |
34 $('customize-sync').onclick = function(event) { | 34 $('customize-sync').onclick = function(event) { |
35 OptionsPage.showPageByName('sync'); | 35 OptionsPage.showPageByName('sync'); |
36 }; | 36 }; |
37 $('start-stop-sync').onclick = function(event) { | 37 $('start-stop-sync').onclick = function(event) { |
38 if (self.syncSetupCompleted) | 38 if (self.syncSetupCompleted) |
39 self.showStopSyncingOverlay_(); | 39 self.showStopSyncingOverlay_(); |
40 else | 40 else |
41 self.showSyncLoginDialog_(); | 41 self.showSyncLoginDialog_(); |
42 }; | 42 }; |
43 $('privacy-dashboard-link').onclick = function(event) { | |
44 chrome.send('openPrivacyDashboardTabAndActivate'); | |
45 }; | |
46 | |
47 $('showpasswords').onclick = function(event) { | 43 $('showpasswords').onclick = function(event) { |
48 PasswordsExceptions.load(); | 44 PasswordsExceptions.load(); |
49 OptionsPage.showPageByName('passwordsExceptions'); | 45 OptionsPage.showPageByName('passwordsExceptions'); |
50 OptionsPage.showTab($('passwords-nav-tab')); | 46 OptionsPage.showTab($('passwords-nav-tab')); |
51 chrome.send('coreOptionsUserMetricsAction', | 47 chrome.send('coreOptionsUserMetricsAction', |
52 ['Options_ShowPasswordsExceptions']); | 48 ['Options_ShowPasswordsExceptions']); |
53 }; | 49 }; |
54 | |
55 $('autofill_options').onclick = function(event) { | 50 $('autofill_options').onclick = function(event) { |
56 OptionsPage.showPageByName('autoFillOptions'); | 51 OptionsPage.showPageByName('autoFillOptions'); |
57 chrome.send('coreOptionsUserMetricsAction', | 52 chrome.send('coreOptionsUserMetricsAction', |
58 ['Options_ShowAutoFillSettings']); | 53 ['Options_ShowAutoFillSettings']); |
59 }; | 54 }; |
60 | 55 |
61 if (!cr.isChromeOS) { | 56 if (!cr.isChromeOS) { |
62 $('import_data').onclick = function(event) { | 57 $('import_data').onclick = function(event) { |
63 OptionsPage.showOverlay('importDataOverlay'); | 58 OptionsPage.showOverlay('importDataOverlay'); |
64 chrome.send('coreOptionsUserMetricsAction', ['Import_ShowDlg']); | 59 chrome.send('coreOptionsUserMetricsAction', ['Import_ShowDlg']); |
65 }; | 60 }; |
66 } | 61 } |
67 | 62 |
68 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { | 63 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { |
69 $('themes_GTK_button').onclick = function(event) { | 64 $('themes_GTK_button').onclick = function(event) { |
70 chrome.send('themesSetGTK'); | 65 chrome.send('themesSetGTK'); |
71 }; | 66 }; |
72 | |
73 $('themes_set_classic').onclick = function(event) { | 67 $('themes_set_classic').onclick = function(event) { |
74 chrome.send('themesReset'); | 68 chrome.send('themesReset'); |
75 }; | 69 }; |
76 $('themes-gallery').onclick = function(event) { | |
77 chrome.send('themesGallery'); | |
78 } | |
79 } | 70 } |
80 | 71 |
81 if (cr.isMac || cr.isWindows || cr.isChromeOS) { | 72 if (cr.isMac || cr.isWindows || cr.isChromeOS) { |
82 $('themes_reset').onclick = function(event) { | 73 $('themes_reset').onclick = function(event) { |
83 chrome.send('themesReset'); | 74 chrome.send('themesReset'); |
84 }; | 75 }; |
85 $('themes-gallery').onclick = function(event) { | |
86 chrome.send('themesGallery'); | |
87 } | |
88 } | 76 } |
89 | 77 |
90 if (cr.isChromeOS) { | 78 if (cr.isChromeOS) { |
91 chrome.send('loadAccountPicture'); | 79 chrome.send('loadAccountPicture'); |
92 } | 80 } |
81 | |
82 self.requestThemesGalleryURL_(); | |
93 }, | 83 }, |
94 | 84 |
95 showStopSyncingOverlay_: function(event) { | 85 showStopSyncingOverlay_: function(event) { |
96 AlertOverlay.show( | 86 AlertOverlay.show( |
97 localStrings.getString('stop_syncing_title'), | 87 localStrings.getString('stop_syncing_title'), |
98 localStrings.getString('stop_syncing_explanation'), | 88 localStrings.getString('stop_syncing_explanation'), |
99 localStrings.getString('stop_syncing_confirm_button_label'), | 89 localStrings.getString('stop_syncing_confirm_button_label'), |
100 undefined, | 90 undefined, |
101 function() { chrome.send('stopSyncing'); }); | 91 function() { chrome.send('stopSyncing'); }); |
102 }, | 92 }, |
103 | 93 |
104 showSyncLoginDialog_: function(event) { | 94 showSyncLoginDialog_: function(event) { |
105 chrome.send('showSyncLoginDialog'); | 95 chrome.send('showSyncLoginDialog'); |
106 }, | 96 }, |
107 | 97 |
98 requestThemesGalleryURL_: function() { | |
99 chrome.send('getThemesGalleryURL'); | |
100 }, | |
101 | |
108 setElementVisible_: function(element, visible) { | 102 setElementVisible_: function(element, visible) { |
109 element.style.display = visible ? 'inline' : 'none'; | 103 element.style.display = visible ? 'inline' : 'none'; |
110 }, | 104 }, |
111 | 105 |
112 setElementClassSyncError_: function(element, visible) { | 106 setElementClassSyncError_: function(element, visible) { |
113 visible ? element.classList.add('sync-error') : | 107 visible ? element.classList.add('sync-error') : |
114 element.classList.remove('sync-error'); | 108 element.classList.remove('sync-error'); |
115 }, | 109 }, |
116 | 110 |
117 setSyncEnabled_: function(enabled) { | 111 setSyncEnabled_: function(enabled) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { | 172 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { |
179 $('themes_GTK_button').disabled = !enabled; | 173 $('themes_GTK_button').disabled = !enabled; |
180 } | 174 } |
181 }, | 175 }, |
182 | 176 |
183 setClassicThemeButtonEnabled_: function(enabled) { | 177 setClassicThemeButtonEnabled_: function(enabled) { |
184 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { | 178 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { |
185 $('themes_set_classic').disabled = !enabled; | 179 $('themes_set_classic').disabled = !enabled; |
186 } | 180 } |
187 }, | 181 }, |
182 | |
183 setThemesGalleryURL_: function(url) { | |
184 $('themes-gallery').href = url; | |
185 $('themes-gallery').target = '_blank'; // Open in a new tab. | |
arv (Not doing code reviews)
2010/11/12 01:17:25
Can you link to a webkit bug here?
James Hawkins
2010/11/12 23:47:20
I've actually removed this piece of code. Do you w
| |
186 }, | |
188 }; | 187 }; |
189 | 188 |
190 // Forward public APIs to private implementations. | 189 // Forward public APIs to private implementations. |
191 [ | 190 [ |
192 'setSyncEnabled', | 191 'setSyncEnabled', |
193 'setSyncSetupCompleted', | 192 'setSyncSetupCompleted', |
194 'setAccountPicture', | 193 'setAccountPicture', |
195 'setSyncStatus', | 194 'setSyncStatus', |
196 'setSyncStatusErrorVisible', | 195 'setSyncStatusErrorVisible', |
197 'setSyncActionLinkErrorVisible', | 196 'setSyncActionLinkErrorVisible', |
198 'setSyncActionLinkEnabled', | 197 'setSyncActionLinkEnabled', |
199 'setSyncActionLinkLabel', | 198 'setSyncActionLinkLabel', |
200 'setStartStopButtonVisible', | 199 'setStartStopButtonVisible', |
201 'setStartStopButtonEnabled', | 200 'setStartStopButtonEnabled', |
202 'setStartStopButtonLabel', | 201 'setStartStopButtonLabel', |
203 'setCustomizeButtonVisible', | 202 'setCustomizeButtonVisible', |
204 'setCustomizeButtonEnabled', | 203 'setCustomizeButtonEnabled', |
205 'setCustomizeButtonLabel', | 204 'setCustomizeButtonLabel', |
206 'setGtkThemeButtonEnabled', | 205 'setGtkThemeButtonEnabled', |
207 'setClassicThemeButtonEnabled', | 206 'setClassicThemeButtonEnabled', |
207 'setThemesGalleryURL', | |
208 ].forEach(function(name) { | 208 ].forEach(function(name) { |
209 PersonalOptions[name] = function(value) { | 209 PersonalOptions[name] = function(value) { |
210 PersonalOptions.getInstance()[name + '_'](value); | 210 PersonalOptions.getInstance()[name + '_'](value); |
211 }; | 211 }; |
212 }); | 212 }); |
213 | 213 |
214 // Export | 214 // Export |
215 return { | 215 return { |
216 PersonalOptions: PersonalOptions | 216 PersonalOptions: PersonalOptions |
217 }; | 217 }; |
218 | 218 |
219 }); | 219 }); |
OLD | NEW |