#include "chrome/browser/chromeos/login/screens/error_screen.h"
#include "base/command_line.h"
+#include "chrome/browser/chromeos/login/auth/chrome_login_performer.h"
#include "chrome/browser/chromeos/login/chrome_restart_request.h"
#include "chrome/browser/chromeos/login/screens/error_screen_actor.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
-namespace {
-void* const kCanaryConstant = (void*)0xbaddecafbaddecafLLU;
-}
-
namespace chromeos {
-ErrorScreen::ErrorScreen(ScreenObserver* screen_observer,
+ErrorScreen::ErrorScreen(BaseScreenDelegate* base_screen_delegate,
ErrorScreenActor* actor)
- : WizardScreen(screen_observer),
- canary_1_(kCanaryConstant),
+ : BaseScreen(base_screen_delegate),
actor_(actor),
- canary_2_(kCanaryConstant),
parent_screen_(OobeDisplay::SCREEN_UNKNOWN),
weak_factory_(this) {
CHECK(actor_);
}
ErrorScreen::~ErrorScreen() {
- CHECK(this);
- CHECK(canary_1_ == kCanaryConstant);
- CHECK(canary_2_ == kCanaryConstant);
- CHECK(actor_);
- actor_->SetDelegate(NULL);
+ if (actor_)
+ actor_->SetDelegate(NULL);
}
void ErrorScreen::PrepareToShow() {
}
void ErrorScreen::Show() {
- DCHECK(actor_);
- actor_->Show(parent_screen(), NULL);
+ if (actor_)
+ actor_->Show(parent_screen(), NULL);
}
void ErrorScreen::Hide() {
- DCHECK(actor_);
- actor_->Hide();
+ if (actor_)
+ actor_->Hide();
}
std::string ErrorScreen::GetName() const {
weak_factory_.GetWeakPtr()));
}
+void ErrorScreen::OnActorDestroyed() {
+ actor_ = nullptr;
+}
+
void ErrorScreen::OnAuthFailure(const AuthFailure& error) {
// The only condition leading here is guest mount failure, which should not
// happen in practice. For now, just log an error so this situation is visible
}
void ErrorScreen::FixCaptivePortal() {
- DCHECK(actor_);
- actor_->FixCaptivePortal();
+ if (actor_)
+ actor_->FixCaptivePortal();
}
void ErrorScreen::ShowCaptivePortal() {
- DCHECK(actor_);
- actor_->ShowCaptivePortal();
+ if (actor_)
+ actor_->ShowCaptivePortal();
}
void ErrorScreen::HideCaptivePortal() {
- DCHECK(actor_);
- actor_->HideCaptivePortal();
+ if (actor_)
+ actor_->HideCaptivePortal();
}
void ErrorScreen::SetUIState(UIState ui_state) {
- DCHECK(actor_);
- actor_->SetUIState(ui_state);
+ if (actor_)
+ actor_->SetUIState(ui_state);
}
ErrorScreen::UIState ErrorScreen::GetUIState() const {
- DCHECK(actor_);
- return actor_->ui_state();
+ return actor_ ? actor_->ui_state() : UI_STATE_UNKNOWN;
}
void ErrorScreen::SetErrorState(ErrorState error_state,
const std::string& network) {
+ if (actor_)
+ actor_->SetErrorState(error_state, network);
+}
+
+ErrorScreen::ErrorState ErrorScreen::GetErrorState() const {
DCHECK(actor_);
- actor_->SetErrorState(error_state, network);
+ return actor_->error_state();
}
void ErrorScreen::AllowGuestSignin(bool allow) {
- DCHECK(actor_);
- actor_->AllowGuestSignin(allow);
+ if (actor_)
+ actor_->AllowGuestSignin(allow);
}
void ErrorScreen::ShowConnectingIndicator(bool show) {
- DCHECK(actor_);
- actor_->ShowConnectingIndicator(show);
+ if (actor_)
+ actor_->ShowConnectingIndicator(show);
}
void ErrorScreen::StartGuestSessionAfterOwnershipCheck(
if (guest_login_performer_)
return;
- guest_login_performer_.reset(new LoginPerformer(this));
+ guest_login_performer_.reset(new ChromeLoginPerformer(this));
guest_login_performer_->LoginOffTheRecord();
}