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

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

Issue 9464053: Hide/Disable several (meaningless) options in Settings uber-page for Guest. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Nit fixes + merge with TOT + gray out labels for disabled elements Created 8 years, 9 months 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
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 pref, 92 pref,
93 self.onHomePagePrefChanged_.bind(self)); 93 self.onHomePagePrefChanged_.bind(self));
94 }); 94 });
95 95
96 $('themes-gallery').onclick = function(event) { 96 $('themes-gallery').onclick = function(event) {
97 window.open(localStrings.getString('themesGalleryURL')); 97 window.open(localStrings.getString('themesGalleryURL'));
98 }; 98 };
99 $('themes-reset').onclick = function(event) { 99 $('themes-reset').onclick = function(event) {
100 chrome.send('themesReset'); 100 chrome.send('themesReset');
101 }; 101 };
102 if (cr.isChromeOS) {
103 // Appearance section.
104 if (AccountsOptions.loggedInAsGuest()) {
105 AccountsOptions.disableElementsForGuest(
106 $('home-page-select-container'));
107 AccountsOptions.disableElementsForGuest(
108 $('bookmarkbar-show-on-all-tabs-group'));
109 // Search section
110 AccountsOptions.disableElementsForGuest($('instant-setting'));
111 }
112 }
102 113
103 // Device section (ChromeOS only). 114 // Device section (ChromeOS only).
104 if (cr.isChromeOS) { 115 if (cr.isChromeOS) {
105 $('keyboard-settings-button').onclick = function(evt) { 116 $('keyboard-settings-button').onclick = function(evt) {
106 OptionsPage.navigateToPage('keyboard-overlay'); 117 OptionsPage.navigateToPage('keyboard-overlay');
107 }; 118 };
108 $('pointer-settings-button').onclick = function(evt) { 119 $('pointer-settings-button').onclick = function(evt) {
109 OptionsPage.navigateToPage('pointer-overlay'); 120 OptionsPage.navigateToPage('pointer-overlay');
110 }; 121 };
111 this.initBrightnessButton_('brightness-decrease-button', 122 this.initBrightnessButton_('brightness-decrease-button',
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (selectedProfile) 187 if (selectedProfile)
177 ManageProfileOverlay.showManageDialog(selectedProfile); 188 ManageProfileOverlay.showManageDialog(selectedProfile);
178 }; 189 };
179 $('profiles-delete').onclick = function(event) { 190 $('profiles-delete').onclick = function(event) {
180 var selectedProfile = self.getSelectedProfileItem_(); 191 var selectedProfile = self.getSelectedProfileItem_();
181 if (selectedProfile) 192 if (selectedProfile)
182 ManageProfileOverlay.showDeleteDialog(selectedProfile); 193 ManageProfileOverlay.showDeleteDialog(selectedProfile);
183 }; 194 };
184 195
185 if (cr.isChromeOS) { 196 if (cr.isChromeOS) {
197 if (AccountsOptions.loggedInAsGuest()) {
198 // Disable the screen lock checkbox in guest mode.
199 AccountsOptions.disableElementsForGuest($('enable-screen-lock'));
200
201 // Hide the startup and users sections in Guest mode.
202 $('startup-section').hidden = true;
203 $('users-section').hidden = true;
204 } else {
205 $('account-picture-wrapper').onclick = function(event) {
206 OptionsPage.navigateToPage('changePicture');
207 };
208 }
209
186 // Username (canonical email) of the currently logged in user or 210 // Username (canonical email) of the currently logged in user or
187 // |kGuestUser| if a guest session is active. 211 // |kGuestUser| if a guest session is active.
188 this.username_ = localStrings.getString('username'); 212 this.username_ = localStrings.getString('username');
189 213
190 this.updateAccountPicture_(); 214 this.updateAccountPicture_();
191 215
192 if (cr.commandLine && cr.commandLine.options['--bwsi']) {
193 // Disable the screen lock checkbox in guest mode.
194 $('enable-screen-lock').disabled = true;
195
196 // Hide the startup section in Guest mode.
197 $('startup-section').hidden = true;
198 } else {
199 $('account-picture-wrapper').onclick = function(event) {
200 OptionsPage.navigateToPage('changePicture');
201 };
202 }
203
204 $('manage-accounts-button').onclick = function(event) { 216 $('manage-accounts-button').onclick = function(event) {
205 OptionsPage.navigateToPage('accounts'); 217 OptionsPage.navigateToPage('accounts');
206 chrome.send('coreOptionsUserMetricsAction', 218 chrome.send('coreOptionsUserMetricsAction',
207 ['Options_ManageAccounts']); 219 ['Options_ManageAccounts']);
208 }; 220 };
209 } else { 221 } else {
210 $('import-data').onclick = function(event) { 222 $('import-data').onclick = function(event) {
211 // Make sure that any previous import success message is hidden, and 223 // Make sure that any previous import success message is hidden, and
212 // we're showing the UI to import further data. 224 // we're showing the UI to import further data.
213 $('import-data-configure').hidden = false; 225 $('import-data-configure').hidden = false;
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 BrowserOptions.getLoggedInUsername = function() { 776 BrowserOptions.getLoggedInUsername = function() {
765 return BrowserOptions.getInstance().username_; 777 return BrowserOptions.getInstance().username_;
766 }; 778 };
767 } 779 }
768 780
769 // Export 781 // Export
770 return { 782 return {
771 BrowserOptions: BrowserOptions 783 BrowserOptions: BrowserOptions
772 }; 784 };
773 }); 785 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698