Home | History | Annotate | Download | only in login
      1 // Copyright (c) 2011 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_SCREEN_OBSERVER_H_
      6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_OBSERVER_H_
      7 #pragma once
      8 
      9 #include <string>
     10 
     11 namespace chromeos {
     12 
     13 // Interface that handles notifications received from any of login wizard
     14 // screens.
     15 class ScreenObserver {
     16  public:
     17   // Each login screen or a view shown within login wizard view is itself a
     18   // state. Upon exit each view returns one of the results by calling
     19   // OnExit() method. Depending on the result and the current view or state
     20   // login wizard decides what is the next view to show. There must be an
     21   // exit code for each way to exit the screen for each screen.
     22   enum ExitCodes {
     23     NETWORK_CONNECTED,
     24     NETWORK_OFFLINE,
     25     ACCOUNT_CREATE_BACK,
     26     ACCOUNT_CREATED,
     27     CONNECTION_FAILED,
     28     UPDATE_INSTALLED,
     29     UPDATE_NOUPDATE,
     30     UPDATE_ERROR_CHECKING_FOR_UPDATE,
     31     UPDATE_ERROR_UPDATING,
     32     USER_IMAGE_SELECTED,
     33     USER_IMAGE_SKIPPED,
     34     EULA_ACCEPTED,
     35     EULA_BACK,
     36     REGISTRATION_SUCCESS,
     37     REGISTRATION_SKIPPED,
     38     ENTERPRISE_ENROLLMENT_CANCELLED,
     39     ENTERPRISE_ENROLLMENT_COMPLETED,
     40     EXIT_CODES_COUNT  // not a real code, must be the last
     41   };
     42 
     43   // Method called by a screen when user's done with it.
     44   virtual void OnExit(ExitCodes exit_code) = 0;
     45 
     46   // Notify about new user names and password. It is used to autologin
     47   // just created user without asking the same info once again.
     48   virtual void OnSetUserNamePassword(const std::string& username,
     49                                      const std::string& password) = 0;
     50 
     51   // Set/get usage statistics reporting checkbox status on EULA screen.
     52   virtual void set_usage_statistics_reporting(bool val) = 0;
     53   virtual bool usage_statistics_reporting() const = 0;
     54 
     55  protected:
     56   virtual ~ScreenObserver() {}
     57 };
     58 
     59 }  // namespace chromeos
     60 
     61 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_OBSERVER_H_
     62