cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chromeos / login / auth / extended_authenticator_impl.h
blob519c1febc9780bcb4b610fb40a98df533058cac0
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 CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_IMPL_H_
6 #define CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_IMPL_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "chromeos/chromeos_export.h"
15 #include "chromeos/login/auth/extended_authenticator.h"
16 #include "third_party/cros_system_api/dbus/service_constants.h"
18 namespace chromeos {
20 class AuthStatusConsumer;
21 class UserContext;
23 // Implements ExtendedAuthenticator.
24 class CHROMEOS_EXPORT ExtendedAuthenticatorImpl : public ExtendedAuthenticator {
25 public:
26 explicit ExtendedAuthenticatorImpl(NewAuthStatusConsumer* consumer);
27 explicit ExtendedAuthenticatorImpl(AuthStatusConsumer* consumer);
29 // ExtendedAuthenticator:
30 void SetConsumer(AuthStatusConsumer* consumer) override;
31 void AuthenticateToMount(const UserContext& context,
32 const ResultCallback& success_callback) override;
33 void AuthenticateToCheck(const UserContext& context,
34 const base::Closure& success_callback) override;
35 void CreateMount(const std::string& user_id,
36 const std::vector<cryptohome::KeyDefinition>& keys,
37 const ResultCallback& success_callback) override;
38 void AddKey(const UserContext& context,
39 const cryptohome::KeyDefinition& key,
40 bool replace_existing,
41 const base::Closure& success_callback) override;
42 void UpdateKeyAuthorized(const UserContext& context,
43 const cryptohome::KeyDefinition& key,
44 const std::string& signature,
45 const base::Closure& success_callback) override;
46 void RemoveKey(const UserContext& context,
47 const std::string& key_to_remove,
48 const base::Closure& success_callback) override;
49 void TransformKeyIfNeeded(const UserContext& user_context,
50 const ContextCallback& callback) override;
52 private:
53 ~ExtendedAuthenticatorImpl() override;
55 // Callback for system salt getter.
56 void OnSaltObtained(const std::string& system_salt);
58 // Performs actual operation with fully configured |context|.
59 void DoAuthenticateToMount(const ResultCallback& success_callback,
60 const UserContext& context);
61 void DoAuthenticateToCheck(const base::Closure& success_callback,
62 const UserContext& context);
63 void DoAddKey(const cryptohome::KeyDefinition& key,
64 bool replace_existing,
65 const base::Closure& success_callback,
66 const UserContext& context);
67 void DoUpdateKeyAuthorized(const cryptohome::KeyDefinition& key,
68 const std::string& signature,
69 const base::Closure& success_callback,
70 const UserContext& context);
71 void DoRemoveKey(const std::string& key_to_remove,
72 const base::Closure& success_callback,
73 const UserContext& context);
75 // Inner operation callbacks.
76 void OnMountComplete(const std::string& time_marker,
77 const UserContext& context,
78 const ResultCallback& success_callback,
79 bool success,
80 cryptohome::MountError return_code,
81 const std::string& mount_hash);
82 void OnOperationComplete(const std::string& time_marker,
83 const UserContext& context,
84 const base::Closure& success_callback,
85 bool success,
86 cryptohome::MountError return_code);
88 bool salt_obtained_;
89 std::string system_salt_;
90 std::vector<base::Closure> system_salt_callbacks_;
92 NewAuthStatusConsumer* consumer_;
93 AuthStatusConsumer* old_consumer_;
95 DISALLOW_COPY_AND_ASSIGN(ExtendedAuthenticatorImpl);
98 } // namespace chromeos
100 #endif // CHROMEOS_LOGIN_AUTH_EXTENDED_AUTHENTICATOR_IMPL_H_