Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chromeos/login/auth/authenticator.h

Issue 614973002: Extract LoginPerformer to chromeos/auth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/login/auth/authenticator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_ 5 #ifndef CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_
6 #define CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_ 6 #define CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "chromeos/chromeos_export.h" 12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/login/auth/auth_status_consumer.h" 13 #include "chromeos/login/auth/auth_status_consumer.h"
14 #include "google_apis/gaia/gaia_auth_consumer.h" 14 #include "google_apis/gaia/gaia_auth_consumer.h"
15 15
16 class Profile; 16 namespace content {
17 class BrowserContext;
18 }
17 19
18 namespace chromeos { 20 namespace chromeos {
19 21
20 class UserContext; 22 class UserContext;
21 23
22 // An interface for objects that will authenticate a Chromium OS user. 24 // An interface for objects that will authenticate a Chromium OS user.
23 // Callbacks will be called on the UI thread: 25 // Callbacks will be called on the UI thread:
24 // 1. On successful authentication, will call consumer_->OnAuthSuccess(). 26 // 1. On successful authentication, will call consumer_->OnAuthSuccess().
25 // 2. On failure, will call consumer_->OnAuthFailure(). 27 // 2. On failure, will call consumer_->OnAuthFailure().
26 // 3. On password change, will call consumer_->OnPasswordChangeDetected(). 28 // 3. On password change, will call consumer_->OnPasswordChangeDetected().
27 class CHROMEOS_EXPORT Authenticator 29 class CHROMEOS_EXPORT Authenticator
28 : public base::RefCountedThreadSafe<Authenticator> { 30 : public base::RefCountedThreadSafe<Authenticator> {
29 public: 31 public:
30 explicit Authenticator(AuthStatusConsumer* consumer); 32 explicit Authenticator(AuthStatusConsumer* consumer);
31 33
32 // Given externally authenticated username and password (part of 34 // Given externally authenticated username and password (part of
33 // |user_context|), this method attempts to complete authentication process. 35 // |user_context|), this method attempts to complete authentication process.
34 virtual void CompleteLogin(Profile* profile, 36 virtual void CompleteLogin(content::BrowserContext* browser_context,
35 const UserContext& user_context) = 0; 37 const UserContext& user_context) = 0;
36 38
37 // Given a user credentials in |user_context|, 39 // Given a user credentials in |user_context|,
38 // this method attempts to authenticate to login. 40 // this method attempts to authenticate to login.
39 // Must be called on the UI thread. 41 // Must be called on the UI thread.
40 virtual void AuthenticateToLogin(Profile* profile, 42 virtual void AuthenticateToLogin(content::BrowserContext* browser_context,
41 const UserContext& user_context) = 0; 43 const UserContext& user_context) = 0;
42 44
43 // Given a user credentials in |user_context|, this method attempts to 45 // Given a user credentials in |user_context|, this method attempts to
44 // authenticate to unlock the computer. 46 // authenticate to unlock the computer.
45 // Must be called on the UI thread. 47 // Must be called on the UI thread.
46 virtual void AuthenticateToUnlock(const UserContext& user_context) = 0; 48 virtual void AuthenticateToUnlock(const UserContext& user_context) = 0;
47 49
48 // Initiates supervised user login. 50 // Initiates supervised user login.
49 virtual void LoginAsSupervisedUser(const UserContext& user_context) = 0; 51 virtual void LoginAsSupervisedUser(const UserContext& user_context) = 0;
50 52
(...skipping 28 matching lines...) Expand all
79 // occurred. 81 // occurred.
80 // Call this method to migrate the user's encrypted data 82 // Call this method to migrate the user's encrypted data
81 // forward to use his new password. |old_password| is the password 83 // forward to use his new password. |old_password| is the password
82 // his data was last encrypted with. 84 // his data was last encrypted with.
83 virtual void RecoverEncryptedData(const std::string& old_password) = 0; 85 virtual void RecoverEncryptedData(const std::string& old_password) = 0;
84 86
85 // Call this method to erase the user's encrypted data 87 // Call this method to erase the user's encrypted data
86 // and create a new cryptohome. 88 // and create a new cryptohome.
87 virtual void ResyncEncryptedData() = 0; 89 virtual void ResyncEncryptedData() = 0;
88 90
89 // Profile (usually off the record ) that was used to perform the last 91 // BrowserContext (usually off the record) that was used to perform the last
90 // authentication process. 92 // authentication process.
91 Profile* authentication_profile() { return authentication_profile_; } 93 content::BrowserContext* authentication_context() {
94 return authentication_context_;
95 }
92 96
93 // Sets consumer explicitly. 97 // Sets consumer explicitly.
94 void SetConsumer(AuthStatusConsumer* consumer); 98 void SetConsumer(AuthStatusConsumer* consumer);
95 99
96 protected: 100 protected:
97 virtual ~Authenticator(); 101 virtual ~Authenticator();
98 102
99 AuthStatusConsumer* consumer_; 103 AuthStatusConsumer* consumer_;
100 Profile* authentication_profile_; 104 content::BrowserContext* authentication_context_;
101 105
102 private: 106 private:
103 friend class base::RefCountedThreadSafe<Authenticator>; 107 friend class base::RefCountedThreadSafe<Authenticator>;
104 108
105 DISALLOW_COPY_AND_ASSIGN(Authenticator); 109 DISALLOW_COPY_AND_ASSIGN(Authenticator);
106 }; 110 };
107 111
108 } // namespace chromeos 112 } // namespace chromeos
109 113
110 #endif // CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_ 114 #endif // CHROMEOS_LOGIN_AUTH_AUTHENTICATOR_H_
OLDNEW
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/login/auth/authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698