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

Unified Diff: chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc

Issue 79113002: kiosk: Network connectivity test during launch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc
index 5542049a2d0610a9441a217acae684a7e4523f2c..e95fa2e18fd0fb4dd04aea1dd5f1ddffe5577b8f 100644
--- a/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.cc
@@ -5,7 +5,10 @@
#include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handler.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
+#include "chrome/browser/chromeos/login/screens/error_screen_actor.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
+#include "chromeos/network/network_state.h"
+#include "chromeos/network/network_state_handler.h"
#include "grit/browser_resources.h"
#include "grit/chrome_unscaled_resources.h"
#include "grit/chromium_strings.h"
@@ -18,18 +21,34 @@ namespace {
const char kJsScreenPath[] = "login.AppLaunchSplashScreen";
+// Returns network name by service path.
+std::string GetNetworkName(const std::string& service_path) {
+ const chromeos::NetworkState* network =
+ chromeos::NetworkHandler::Get()->network_state_handler()->GetNetworkState(
+ service_path);
+ if (!network)
+ return std::string();
+ return network->name();
+}
+
} // namespace
namespace chromeos {
-AppLaunchSplashScreenHandler::AppLaunchSplashScreenHandler()
+AppLaunchSplashScreenHandler::AppLaunchSplashScreenHandler(
+ const scoped_refptr<NetworkStateInformer>& network_state_informer,
+ ErrorScreenActor* error_screen_actor)
: BaseScreenHandler(kJsScreenPath),
delegate_(NULL),
show_on_init_(false),
- state_(APP_LAUNCH_STATE_LOADING_AUTH_FILE) {
+ state_(APP_LAUNCH_STATE_LOADING_AUTH_FILE),
+ network_state_informer_(network_state_informer),
+ error_screen_actor_(error_screen_actor) {
+ network_state_informer_->AddObserver(this);
}
AppLaunchSplashScreenHandler::~AppLaunchSplashScreenHandler() {
+ network_state_informer_->RemoveObserver(this);
}
void AppLaunchSplashScreenHandler::DeclareLocalizedValues(
@@ -103,6 +122,7 @@ void AppLaunchSplashScreenHandler::UpdateAppLaunchState(AppLaunchState state) {
SetLaunchText(
l10n_util::GetStringUTF8(GetProgressMessageFromState(state_)));
}
+ UpdateState(ErrorScreenActor::ERROR_REASON_UPDATE);
}
void AppLaunchSplashScreenHandler::SetDelegate(
@@ -110,6 +130,71 @@ void AppLaunchSplashScreenHandler::SetDelegate(
delegate_ = delegate;
}
+void AppLaunchSplashScreenHandler::ShowNetworkConfigureUI() {
+ NetworkStateInformer::State state = network_state_informer_->state();
+ if (state == NetworkStateInformer::ONLINE) {
+ delegate_->OnNetworkStateChanged(true);
+ return;
+ }
+
+ const std::string network_path = network_state_informer_->network_path();
+ const std::string network_name = GetNetworkName(network_path);
+
+ error_screen_actor_->SetUIState(ErrorScreen::UI_STATE_KIOSK_MODE);
+ error_screen_actor_->AllowGuestSignin(false);
+ error_screen_actor_->AllowOfflineLogin(false);
+
+ switch (state) {
+ case NetworkStateInformer::CAPTIVE_PORTAL: {
+ error_screen_actor_->SetErrorState(
+ ErrorScreen::ERROR_STATE_PORTAL, network_name);
+ error_screen_actor_->FixCaptivePortal();
+
+ break;
+ }
+ case NetworkStateInformer::PROXY_AUTH_REQUIRED: {
+ error_screen_actor_->SetErrorState(
+ ErrorScreen::ERROR_STATE_PROXY, network_name);
+ break;
+ }
+ case NetworkStateInformer::OFFLINE: {
+ error_screen_actor_->SetErrorState(
+ ErrorScreen::ERROR_STATE_OFFLINE, network_name);
+ break;
+ }
+ default:
+ error_screen_actor_->SetErrorState(
+ ErrorScreen::ERROR_STATE_OFFLINE, network_name);
+ NOTREACHED();
+ break;
+ };
+
+ OobeUI::Screen screen = OobeUI::SCREEN_UNKNOWN;
+ OobeUI* oobe_ui = static_cast<OobeUI*>(web_ui()->GetController());
+ if (oobe_ui)
+ screen = oobe_ui->current_screen();
+
+ if (screen != OobeUI::SCREEN_ERROR_MESSAGE)
+ error_screen_actor_->Show(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH, NULL);
+}
+
+void AppLaunchSplashScreenHandler::OnNetworkReady() {
+ // Purposely leave blank because the online case is handled in UpdateState
+ // call below.
+}
+
+void AppLaunchSplashScreenHandler::UpdateState(
+ ErrorScreenActor::ErrorReason reason) {
+ if (!delegate_ ||
+ (state_ != APP_LAUNCH_STATE_PREPARING_NETWORK &&
+ state_ != APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT)) {
+ return;
+ }
+
+ NetworkStateInformer::State state = network_state_informer_->state();
+ delegate_->OnNetworkStateChanged(state == NetworkStateInformer::ONLINE);
+}
+
void AppLaunchSplashScreenHandler::PopulateAppInfo(
base::DictionaryValue* out_info) {
KioskAppManager::App app;

Powered by Google App Engine
This is Rietveld 408576698