OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; |
9 | 9 |
10 // | 10 // |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // Appearance section. | 80 // Appearance section. |
81 $('change-home-page').onclick = function(event) { | 81 $('change-home-page').onclick = function(event) { |
82 OptionsPage.navigateToPage('homePageOverlay'); | 82 OptionsPage.navigateToPage('homePageOverlay'); |
83 }; | 83 }; |
84 $('themes-gallery').onclick = function(event) { | 84 $('themes-gallery').onclick = function(event) { |
85 window.open(localStrings.getString('themesGalleryURL')); | 85 window.open(localStrings.getString('themesGalleryURL')); |
86 }; | 86 }; |
87 $('themes-reset').onclick = function(event) { | 87 $('themes-reset').onclick = function(event) { |
88 chrome.send('themesReset'); | 88 chrome.send('themesReset'); |
89 }; | 89 }; |
90 if (cr.isChromeOS) { | |
91 if (AccountsOptions.loggedInAsGuest()) { | |
92 AccountsOptions.disableElementsForGuest( | |
93 $('toolbar-show-home-button-group')); | |
94 AccountsOptions.disableElementsForGuest( | |
95 $('bookmarkbar-show-on-all-tabs-group')); | |
96 } | |
97 } | |
90 | 98 |
91 // Device section (ChromeOS only). | 99 // Device section (ChromeOS only). |
92 if (cr.isChromeOS) { | 100 if (cr.isChromeOS) { |
93 $('keyboard-settings-button').onclick = function(evt) { | 101 $('keyboard-settings-button').onclick = function(evt) { |
94 OptionsPage.navigateToPage('keyboard-overlay'); | 102 OptionsPage.navigateToPage('keyboard-overlay'); |
95 }; | 103 }; |
96 $('pointer-settings-button').onclick = function(evt) { | 104 $('pointer-settings-button').onclick = function(evt) { |
97 OptionsPage.navigateToPage('pointer-overlay'); | 105 OptionsPage.navigateToPage('pointer-overlay'); |
98 }; | 106 }; |
99 this.initBrightnessButton_('brightness-decrease-button', | 107 this.initBrightnessButton_('brightness-decrease-button', |
100 'decreaseScreenBrightness'); | 108 'decreaseScreenBrightness'); |
101 this.initBrightnessButton_('brightness-increase-button', | 109 this.initBrightnessButton_('brightness-increase-button', |
102 'increaseScreenBrightness'); | 110 'increaseScreenBrightness'); |
103 } | 111 } |
104 | 112 |
105 // Search section. | 113 // Search section. |
114 if (cr.isChromeOS) { | |
115 if (AccountsOptions.loggedInAsGuest()) | |
James Hawkins
2012/02/28 20:03:35
Move this 'if' logic up.
Denis Kuznetsov (DE-MUC)
2012/02/29 08:41:43
Done.
| |
116 AccountsOptions.disableElementsForGuest($('instant-setting')); | |
117 } | |
118 | |
106 $('manage-default-search-engines').onclick = function(event) { | 119 $('manage-default-search-engines').onclick = function(event) { |
107 OptionsPage.navigateToPage('searchEngines'); | 120 OptionsPage.navigateToPage('searchEngines'); |
108 chrome.send('coreOptionsUserMetricsAction', | 121 chrome.send('coreOptionsUserMetricsAction', |
109 ['Options_ManageSearchEngines']); | 122 ['Options_ManageSearchEngines']); |
110 }; | 123 }; |
111 $('default-search-engine').addEventListener('change', | 124 $('default-search-engine').addEventListener('change', |
112 this.setDefaultSearchEngine_); | 125 this.setDefaultSearchEngine_); |
113 $('instant-enabled-control').customChangeHandler = function(event) { | 126 $('instant-enabled-control').customChangeHandler = function(event) { |
114 if (this.checked) { | 127 if (this.checked) { |
115 if (self.instantConfirmDialogShown_) | 128 if (self.instantConfirmDialogShown_) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 if (selectedProfile) | 178 if (selectedProfile) |
166 ManageProfileOverlay.showManageDialog(selectedProfile); | 179 ManageProfileOverlay.showManageDialog(selectedProfile); |
167 }; | 180 }; |
168 $('profiles-delete').onclick = function(event) { | 181 $('profiles-delete').onclick = function(event) { |
169 var selectedProfile = self.getSelectedProfileItem_(); | 182 var selectedProfile = self.getSelectedProfileItem_(); |
170 if (selectedProfile) | 183 if (selectedProfile) |
171 ManageProfileOverlay.showDeleteDialog(selectedProfile); | 184 ManageProfileOverlay.showDeleteDialog(selectedProfile); |
172 }; | 185 }; |
173 | 186 |
174 if (cr.isChromeOS) { | 187 if (cr.isChromeOS) { |
188 if (AccountsOptions.loggedInAsGuest()) | |
189 $('users-section').hidden = true; | |
190 | |
175 // Username (canonical email) of the currently logged in user or | 191 // Username (canonical email) of the currently logged in user or |
176 // |kGuestUser| if a guest session is active. | 192 // |kGuestUser| if a guest session is active. |
177 this.username_ = localStrings.getString('username'); | 193 this.username_ = localStrings.getString('username'); |
178 | 194 |
179 $('account-picture-wrapper').onclick = function(event) { | 195 $('account-picture-wrapper').onclick = function(event) { |
180 OptionsPage.navigateToPage('changePicture'); | 196 OptionsPage.navigateToPage('changePicture'); |
181 }; | 197 }; |
182 this.updateAccountPicture_(); | 198 this.updateAccountPicture_(); |
183 | 199 |
184 if (cr.commandLine && cr.commandLine.options['--bwsi']) { | 200 if (AccountsOptions.loggedInAsGuest()) { |
James Hawkins
2012/02/28 20:03:35
Move this block up to the top.
Denis Kuznetsov (DE-MUC)
2012/02/29 08:41:43
Done.
| |
185 // Disable the screen lock checkbox and change-picture-button in | 201 // Disable the screen lock checkbox in guest mode. |
186 // guest mode. | 202 AccountsOptions.disableElementsForGuest($('enable-screen-lock')); |
187 $('enable-screen-lock').disabled = true; | |
188 $('change-picture-button').disabled = true; | |
189 | 203 |
190 // Hide the startup section in Guest mode. | 204 // Hide the startup section in Guest mode. |
191 $('startup-section').hidden = true; | 205 $('startup-section').hidden = true; |
192 } | 206 } |
193 | 207 |
194 $('manage-accounts-button').onclick = function(event) { | 208 $('manage-accounts-button').onclick = function(event) { |
195 OptionsPage.navigateToPage('accounts'); | 209 OptionsPage.navigateToPage('accounts'); |
196 chrome.send('coreOptionsUserMetricsAction', | 210 chrome.send('coreOptionsUserMetricsAction', |
197 ['Options_ManageAccounts']); | 211 ['Options_ManageAccounts']); |
198 }; | 212 }; |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 BrowserOptions.getLoggedInUsername = function() { | 693 BrowserOptions.getLoggedInUsername = function() { |
680 return BrowserOptions.getInstance().username_; | 694 return BrowserOptions.getInstance().username_; |
681 }; | 695 }; |
682 } | 696 } |
683 | 697 |
684 // Export | 698 // Export |
685 return { | 699 return { |
686 BrowserOptions: BrowserOptions | 700 BrowserOptions: BrowserOptions |
687 }; | 701 }; |
688 }); | 702 }); |
OLD | NEW |