Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / ash / system / chromeos / network / network_state_list_detailed_view.cc
index a6bb3aa..4495b57 100644 (file)
@@ -407,8 +407,15 @@ void NetworkStateListDetailedView::CreateNetworkExtra() {
   }
 
   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);
 }
@@ -731,11 +738,19 @@ void NetworkStateListDetailedView::UpdateNetworkExtra() {
 
 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));