1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/chromeos/login/screens/error_screen_actor.h"
6
7namespace chromeos {
8
9namespace {
10
11const char kErrorReasonProxyAuthCancelled[] = "proxy auth cancelled";
12const char kErrorReasonProxyAuthSupplied[] = "proxy auth supplied";
13const char kErrorReasonProxyConnectionFailed[] = "proxy connection failed";
14const char kErrorReasonProxyConfigChanged[] = "proxy config changed";
15const char kErrorReasonLoadingTimeout[] = "loading timeout";
16const char kErrorReasonPortalDetected[] = "portal detected";
17const char kErrorReasonNetworkStateChanged[] = "network state changed";
18const char kErrorReasonUpdate[] = "update";
19const char kErrorReasonFrameError[] = "frame error";
20
21}  // namespace
22
23ErrorScreenActor::ErrorScreenActor()
24    : ui_state_(ErrorScreen::UI_STATE_UNKNOWN),
25      error_state_(ErrorScreen::ERROR_STATE_UNKNOWN),
26      guest_signin_allowed_(false),
27      offline_login_allowed_(false),
28      show_connecting_indicator_(false),
29      parent_screen_(OobeUI::SCREEN_UNKNOWN) {}
30
31ErrorScreenActor::~ErrorScreenActor() {}
32
33// static
34const char* ErrorScreenActor::ErrorReasonString(ErrorReason reason) {
35  switch (reason) {
36    case ErrorScreenActor::ERROR_REASON_PROXY_AUTH_CANCELLED:
37      return kErrorReasonProxyAuthCancelled;
38    case ErrorScreenActor::ERROR_REASON_PROXY_AUTH_SUPPLIED:
39      return kErrorReasonProxyAuthSupplied;
40    case ErrorScreenActor::ERROR_REASON_PROXY_CONNECTION_FAILED:
41      return kErrorReasonProxyConnectionFailed;
42    case ErrorScreenActor::ERROR_REASON_PROXY_CONFIG_CHANGED:
43      return kErrorReasonProxyConfigChanged;
44    case ErrorScreenActor::ERROR_REASON_LOADING_TIMEOUT:
45      return kErrorReasonLoadingTimeout;
46    case ErrorScreenActor::ERROR_REASON_PORTAL_DETECTED:
47      return kErrorReasonPortalDetected;
48    case ErrorScreenActor::ERROR_REASON_NETWORK_STATE_CHANGED:
49      return kErrorReasonNetworkStateChanged;
50    case ErrorScreenActor::ERROR_REASON_UPDATE:
51      return kErrorReasonUpdate;
52    case ErrorScreenActor::ERROR_REASON_FRAME_ERROR:
53      return kErrorReasonFrameError;
54    default:
55      NOTREACHED();
56      return NULL;
57  }
58}
59
60}  // namespace chromeos
61