1// Copyright 2014 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_SUPERVISED_SUPERVISED_USER_CREATION_FLOW_H_
6#define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_FLOW_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "base/strings/string16.h"
11#include "chrome/browser/chromeos/login/user_flow.h"
12#include "components/user_manager/user.h"
13
14class Profile;
15
16namespace chromeos {
17
18// UserFlow implementation for creating new supervised user.
19class SupervisedUserCreationFlow : public ExtendedUserFlow {
20 public:
21  explicit SupervisedUserCreationFlow(const std::string& manager_id);
22  virtual ~SupervisedUserCreationFlow();
23
24  virtual bool CanLockScreen() OVERRIDE;
25  virtual bool ShouldShowSettings() OVERRIDE;
26  virtual bool ShouldLaunchBrowser() OVERRIDE;
27  virtual bool ShouldSkipPostLoginScreens() OVERRIDE;
28  virtual bool SupportsEarlyRestartToApplyFlags() OVERRIDE;
29  virtual bool HandleLoginFailure(const AuthFailure& failure) OVERRIDE;
30  virtual void HandleLoginSuccess(const UserContext& context) OVERRIDE;
31  virtual bool HandlePasswordChangeDetected() OVERRIDE;
32  virtual void HandleOAuthTokenStatusChange(
33      user_manager::User::OAuthTokenStatus status) OVERRIDE;
34  virtual void LaunchExtraSteps(Profile* profile) OVERRIDE;
35 private:
36  // Display name for user being created.
37  base::string16 name_;
38  // Password for user being created.
39  std::string password_;
40
41  // Indicates if manager OAuth2 token has been validated.
42  bool token_validated_;
43
44  // Indicates if manager was successfully authenticated against
45  // local cryptohome.
46  bool logged_in_;
47
48  // Indicates that cryptohome is mounted and OAuth2 token is validated.
49  // Used to avoid multiple notifications.
50  bool session_started_;
51
52  Profile* manager_profile_;
53
54  DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationFlow);
55};
56
57}  // namespace chromeos
58
59#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_FLOW_H_
60