1 // Copyright (c) 2016 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_OOBE_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OOBE_SCREEN_H_
7 
8 #include <iosfwd>
9 #include <string>
10 
11 namespace chromeos {
12 
13 // Lists the priority of the OOBE screens with the highest priority at the top
14 // and the lowest priority at the bottom. This is used to check if screen
15 // transition is allowed as only higher or equal priority screen replaces the
16 // current screen.
17 enum OobeScreenPriority {
18   SCREEN_DEVICE_DISABLED = 1,
19   SCREEN_RESET,
20   SCREEN_HARDWARE_ERROR,
21   SCREEN_DEVICE_DEVELOPER_MODIFICATION,
22   SCREEN_UPDATE_REQUIRED,
23   DEFAULT
24 };
25 
26 struct StaticOobeScreenId;
27 
28 // Identifiers an OOBE screen.
29 struct OobeScreenId {
30   // Create an identifier from a string.
31   explicit OobeScreenId(const std::string& id);
32   // Create an identifier from a statically created identifier. This is implicit
33   // to make StaticOobeScreenId act more like OobeScreenId.
34   OobeScreenId(const StaticOobeScreenId& id);
35 
36   // Name of the screen.
37   std::string name;
38 
39   bool operator==(const OobeScreenId& rhs) const;
40   bool operator!=(const OobeScreenId& rhs) const;
41   bool operator<(const OobeScreenId& rhs) const;
42   friend std::ostream& operator<<(std::ostream& stream, const OobeScreenId& id);
43 };
44 
45 // A static identifier. An OOBE screen often statically expresses its ID in
46 // code. Chrome-style bans static destructors so use a const char* to point to
47 // the data in the binary instead of std::string.
48 struct StaticOobeScreenId {
49   const char* name;
50 
51   OobeScreenId AsId() const;
52 };
53 
54 struct OobeScreen {
55   constexpr static StaticOobeScreenId SCREEN_ACCOUNT_PICKER{"account-picker"};
56 
57   constexpr static StaticOobeScreenId
58       SCREEN_CREATE_SUPERVISED_USER_FLOW_DEPRECATED{"supervised-user-creation"};
59   constexpr static StaticOobeScreenId SCREEN_CONFIRM_PASSWORD{
60       "saml-confirm-password"};
61 
62   constexpr static StaticOobeScreenId SCREEN_UNKNOWN{"unknown"};
63 };
64 
65 }  // namespace chromeos
66 
67 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_OOBE_SCREEN_H_
68