screen_observer.h revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
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#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_OBSERVER_H_
6#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_OBSERVER_H_
7
8#include <string>
9
10namespace chromeos {
11
12class ErrorScreen;
13class WizardScreen;
14
15// Interface that handles notifications received from any of login wizard
16// screens.
17class ScreenObserver {
18 public:
19  // Each login screen or a view shown within login wizard view is itself a
20  // state. Upon exit each view returns one of the results by calling
21  // OnExit() method. Depending on the result and the current view or state
22  // login wizard decides what is the next view to show. There must be an
23  // exit code for each way to exit the screen for each screen.
24  enum ExitCodes {
25    // "Continue" was pressed on network screen and network is online.
26    NETWORK_CONNECTED,
27    // Connection failed while trying to load a WebPageScreen.
28    CONNECTION_FAILED,
29    UPDATE_INSTALLED,
30    UPDATE_NOUPDATE,
31    UPDATE_ERROR_CHECKING_FOR_UPDATE,
32    UPDATE_ERROR_UPDATING,
33    USER_IMAGE_SELECTED,
34    EULA_ACCEPTED,
35    EULA_BACK,
36    ENTERPRISE_ENROLLMENT_COMPLETED,
37    ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED,
38    RESET_CANCELED,
39    TERMS_OF_SERVICE_DECLINED,
40    TERMS_OF_SERVICE_ACCEPTED,
41    WRONG_HWID_WARNING_SKIPPED,
42    EXIT_CODES_COUNT  // not a real code, must be the last
43  };
44
45  // Method called by a screen when user's done with it.
46  virtual void OnExit(ExitCodes exit_code) = 0;
47
48  // Forces current screen showing.
49  virtual void ShowCurrentScreen() = 0;
50
51  // Notify about new user names and password. It is used to autologin
52  // just created user without asking the same info once again.
53  virtual void OnSetUserNamePassword(const std::string& username,
54                                     const std::string& password) = 0;
55
56  // Whether usage statistics reporting is enabled on EULA screen.
57  virtual void SetUsageStatisticsReporting(bool val) = 0;
58  virtual bool GetUsageStatisticsReporting() const = 0;
59
60  virtual ErrorScreen* GetErrorScreen() = 0;
61  virtual void ShowErrorScreen() = 0;
62  virtual void HideErrorScreen(WizardScreen* parent_screen) = 0;
63
64 protected:
65  virtual ~ScreenObserver() {}
66};
67
68}  // namespace chromeos
69
70#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SCREEN_OBSERVER_H_
71