Chromad: Show proper offline login when offline.

Shows offline Gaia to sign in as an existing user when there is no
network for Active Directory devices.

BUG=chromium:864987
TEST=manual

Change-Id: I0f80915788c96b6fd88e766dbe6526802ffe98e5
Reviewed-on: https://chromium-review.googlesource.com/1141867
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: Alexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576196}
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index c6be7b7..bce2904 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -110,12 +110,12 @@
 }
 
 GaiaScreenMode GetGaiaScreenMode(const std::string& email, bool use_offline) {
-  if (GetDeviceMode() == policy::DEVICE_MODE_ENTERPRISE_AD)
-    return GAIA_SCREEN_MODE_AD;
-
   if (use_offline)
     return GAIA_SCREEN_MODE_OFFLINE;
 
+  if (GetDeviceMode() == policy::DEVICE_MODE_ENTERPRISE_AD)
+    return GAIA_SCREEN_MODE_AD;
+
   int authentication_behavior = 0;
   CrosSettings::Get()->GetInteger(kLoginAuthenticationBehavior,
                                   &authentication_behavior);