diff options
Diffstat (limited to 'chrome')
4 files changed, 40 insertions, 18 deletions
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js index c7c3b79..cba46e8 100644 --- a/chrome/browser/resources/options/browser_options.js +++ b/chrome/browser/resources/options/browser_options.js @@ -84,22 +84,27 @@ cr.define('options', function() { window.addEventListener('message', this.handleWindowMessage_.bind(this)); - $('advanced-settings-expander').onclick = function() { - self.toggleSectionWithAnimation_( - $('advanced-settings'), - $('advanced-settings-container')); - - // If the link was focused (i.e., it was activated using the keyboard) - // and it was used to show the section (rather than hiding it), focus - // the first element in the container. - if (document.activeElement === $('advanced-settings-expander') && - $('advanced-settings').style.height === '') { - var focusElement = $('advanced-settings-container').querySelector( - 'button, input, list, select, a[href]'); - if (focusElement) - focusElement.focus(); - } - }; + if (loadTimeData.getBoolean('allowAdvancedSettings')) { + $('advanced-settings-expander').onclick = function() { + self.toggleSectionWithAnimation_( + $('advanced-settings'), + $('advanced-settings-container')); + + // If the link was focused (i.e., it was activated using the keyboard) + // and it was used to show the section (rather than hiding it), focus + // the first element in the container. + if (document.activeElement === $('advanced-settings-expander') && + $('advanced-settings').style.height === '') { + var focusElement = $('advanced-settings-container').querySelector( + 'button, input, list, select, a[href]'); + if (focusElement) + focusElement.focus(); + } + }; + } else { + $('advanced-settings-expander').hidden = true; + $('advanced-settings').hidden = true; + } $('advanced-settings').addEventListener('webkitTransitionEnd', this.updateAdvancedSettingsExpander_.bind(this)); @@ -702,7 +707,10 @@ cr.define('options', function() { scrollToSection_: function(section) { var advancedSettings = $('advanced-settings'); var container = $('advanced-settings-container'); - if (advancedSettings.hidden && section.parentNode == container) { + var expander = $('advanced-settings-expander'); + if (!expander.hidden && + advancedSettings.hidden && + section.parentNode == container) { this.showSection_($('advanced-settings'), $('advanced-settings-container'), /* animate */ false); diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index 223136a..71a5265 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -1051,7 +1051,8 @@ void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability( // Bookmark manager and settings page/subpages are forced to open in normal // mode. For this reason we disable these commands when incognito is forced. const bool command_enabled = - incognito_availability != IncognitoModePrefs::FORCED; + incognito_availability != IncognitoModePrefs::FORCED && + !profile->IsGuestSession(); command_updater->UpdateCommandEnabled( IDC_SHOW_BOOKMARK_MANAGER, browser_defaults::bookmarks_enabled && command_enabled); diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 741b42b..0cd0d5a 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -622,6 +622,7 @@ void BrowserOptionsHandler::RegisterCloudPrintValues( #endif values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); + values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); } #endif // defined(ENABLE_FULL_PRINTING) @@ -998,6 +999,15 @@ bool BrowserOptionsHandler::ShouldShowMultiProfilesUserList() { #endif } +bool BrowserOptionsHandler::ShouldAllowAdvancedSettings() { +#if defined(OS_CHROMEOS) + // ChromeOS handles guest-mode restrictions in a different manner. + return true; +#else + return !Profile::FromWebUI(web_ui())->IsGuestSession(); +#endif +} + void BrowserOptionsHandler::UpdateDefaultBrowserState() { #if defined(OS_MACOSX) ShellIntegration::DefaultWebClientState state = diff --git a/chrome/browser/ui/webui/options/browser_options_handler.h b/chrome/browser/ui/webui/options/browser_options_handler.h index 00685d4..3483f64 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.h +++ b/chrome/browser/ui/webui/options/browser_options_handler.h @@ -155,6 +155,9 @@ class BrowserOptionsHandler // Returns if profiles list should be shown on settings page. bool ShouldShowMultiProfilesUserList(); + // Returns if access to advanced settings should be allowed. + bool ShouldAllowAdvancedSettings(); + // Gets the current default browser state, and asynchronously reports it to // the WebUI page. void UpdateDefaultBrowserState(); |