}
CreateSettingsEntry();
- DCHECK(settings_ || proxy_settings_);
- bottom_row->AddChildView(settings_ ? settings_ : proxy_settings_);
+
+ // Both settings_ and proxy_settings_ can be NULL. This happens when
+ // we're logged in but showing settings page is not enabled.
+ // Example: supervised user creation flow where user session is active
+ // but all action happens on the login window.
+ // Allowing opening proxy settigns dialog will break assumption in
+ // SystemTrayDelegateChromeOS::ChangeProxySettings(), see CHECK.
+ if (settings_ || proxy_settings_)
+ bottom_row->AddChildView(settings_ ? settings_ : proxy_settings_);
AddChildView(bottom_row);
}
void NetworkStateListDetailedView::CreateSettingsEntry() {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ bool show_settings = ash::Shell::GetInstance()->
+ system_tray_delegate()->ShouldShowSettings();
if (login_ != user::LOGGED_IN_NONE) {
- // Settings, only if logged in.
- settings_ = new TrayPopupLabelButton(
- this, rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_NETWORK_SETTINGS));
- } else {
+ // Allow user access settings only if user is logged in
+ // and showing settings is allowed. There're situations (supervised user
+ // creation flow) when session is started but UI flow continues within
+ // login UI i.e. no browser window is yet avaialable.
+ if (show_settings) {
+ settings_ = new TrayPopupLabelButton(
+ this, rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_NETWORK_SETTINGS));
+ }
+ } else {
+ // Allow users to change proxy settings only when not logged in.
proxy_settings_ = new TrayPopupLabelButton(
this,
rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_NETWORK_PROXY_SETTINGS));