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.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_LOGIN_FLOW_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_LOGIN_FLOW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/strings/string16.h"
12 #include "chrome/browser/chromeos/login/user_flow.h"
13 #include "chromeos/login/auth/extended_authenticator.h"
14 #include "chromeos/login/auth/user_context.h"
18 // UserFlow implementation for signing in supervised user.
19 class SupervisedUserLoginFlow
20 : public ExtendedUserFlow
,
21 public ExtendedAuthenticator::NewAuthStatusConsumer
{
23 explicit SupervisedUserLoginFlow(const std::string
& user_id
);
24 ~SupervisedUserLoginFlow() override
;
26 // ExtendedUserFlow overrides.
27 void AppendAdditionalCommandLineSwitches() override
;
28 bool CanLockScreen() override
;
29 bool ShouldLaunchBrowser() override
;
30 bool ShouldSkipPostLoginScreens() override
;
31 bool SupportsEarlyRestartToApplyFlags() override
;
32 bool HandleLoginFailure(const AuthFailure
& failure
) override
;
33 void HandleLoginSuccess(const UserContext
& context
) override
;
34 bool HandlePasswordChangeDetected() override
;
35 void LaunchExtraSteps(Profile
* profile
) override
;
37 // ExtendedAuthenticator::NewAuthStatusConsumer overrides.
38 void OnAuthenticationFailure(ExtendedAuthenticator::AuthState state
) override
;
44 void OnSyncSetupDataLoaded(const std::string
& token
);
45 void ConfigureSync(const std::string
& token
);
46 void OnPasswordChangeDataLoaded(const base::DictionaryValue
* password_data
);
47 void OnPasswordChangeDataLoadFailed();
48 void OnNewKeyAdded(scoped_ptr
<base::DictionaryValue
> password_data
);
49 void OnOldKeyRemoved();
50 void OnPasswordUpdated(scoped_ptr
<base::DictionaryValue
> password_data
);
52 scoped_refptr
<ExtendedAuthenticator
> authenticator_
;
57 base::WeakPtrFactory
<SupervisedUserLoginFlow
> weak_factory_
;
59 DISALLOW_COPY_AND_ASSIGN(SupervisedUserLoginFlow
);
62 } // namespace chromeos
64 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_LOGIN_FLOW_H_