summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/login/screens/screen_observer.h
blob: d6974e903db20ed7b3def22f9a9130e888cf731a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_OBSERVER_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_OBSERVER_H_

#include <string>

namespace chromeos {

class ErrorScreen;
class WizardScreen;

// Interface that handles notifications received from any of login wizard
// screens.
class ScreenObserver {
 public:
  // Each login screen or a view shown within login wizard view is itself a
  // state. Upon exit each view returns one of the results by calling
  // OnExit() method. Depending on the result and the current view or state
  // login wizard decides what is the next view to show. There must be an
  // exit code for each way to exit the screen for each screen.
  enum ExitCodes {
    // "Continue" was pressed on network screen and network is online.
    NETWORK_CONNECTED,
    HID_DETECTION_COMPLETED,
    // Connection failed while trying to load a WebPageScreen.
    CONNECTION_FAILED,
    UPDATE_INSTALLED,
    UPDATE_NOUPDATE,
    UPDATE_ERROR_CHECKING_FOR_UPDATE,
    UPDATE_ERROR_UPDATING,
    USER_IMAGE_SELECTED,
    EULA_ACCEPTED,
    EULA_BACK,
    ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED,
    ENTERPRISE_ENROLLMENT_COMPLETED,
    ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED,
    ENTERPRISE_ENROLLMENT_BACK,
    RESET_CANCELED,
    KIOSK_AUTOLAUNCH_CANCELED,
    KIOSK_AUTOLAUNCH_CONFIRMED,
    KIOSK_ENABLE_COMPLETED,
    TERMS_OF_SERVICE_DECLINED,
    TERMS_OF_SERVICE_ACCEPTED,
    WRONG_HWID_WARNING_SKIPPED,
    EXIT_CODES_COUNT  // not a real code, must be the last
  };

  // Method called by a screen when user's done with it.
  virtual void OnExit(ExitCodes exit_code) = 0;

  // Forces current screen showing.
  virtual void ShowCurrentScreen() = 0;

  // Notify about new user names and password. It is used to autologin
  // just created user without asking the same info once again.
  virtual void OnSetUserNamePassword(const std::string& username,
                                     const std::string& password) = 0;

  // Whether usage statistics reporting is enabled on EULA screen.
  virtual void SetUsageStatisticsReporting(bool val) = 0;
  virtual bool GetUsageStatisticsReporting() const = 0;

  virtual ErrorScreen* GetErrorScreen() = 0;
  virtual void ShowErrorScreen() = 0;
  virtual void HideErrorScreen(WizardScreen* parent_screen) = 0;

 protected:
  virtual ~ScreenObserver() {}
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_OBSERVER_H_