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

Side by Side Diff: chrome/browser/chromeos/login/auth_attempt_state.h

Issue 3407008: [Chrome OS] Infrastucture for doing offline/online login simultaneously (Closed)
Patch Set: re-upload (again) due to 500s Created 10 years, 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2010 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_AUTH_ATTEMPT_STATE_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ATTEMPT_STATE_H_
7 #pragma once
8
9 #include <string>
10
11 #include "chrome/browser/chromeos/login/login_status_consumer.h"
12 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
13
14 namespace chromeos {
15
16 // Tracks the state associated with a single attempt to log in to chromium os.
17 // Enforces that methods are only called on the IO thread.
18
19 class AuthAttemptState {
20 public:
21 AuthAttemptState(const std::string& username,
22 const std::string& password,
23 const std::string& ascii_hash,
24 const std::string& login_token,
25 const std::string& login_captcha);
26
27 virtual ~AuthAttemptState();
28
29 // Copy |credentials| and |outcome| into this object, so we can have
30 // a copy we're sure to own, and can make available on the IO thread.
31 // Must be called from the IO thread.
32 void RecordOnlineLoginStatus(
33 const GaiaAuthConsumer::ClientLoginResult& credentials,
34 const LoginFailure& outcome);
35
36 // Copy |offline_code| and |offline_outcome| into this object, so we can have
37 // a copy we're sure to own, and can make available on the IO thread.
38 // Must be called from the IO thread.
39 void RecordOfflineLoginStatus(bool offline_outcome, int offline_code);
40
41 // Blow away locally stored offline login status.
42 // Must be called from the IO thread.
43 void ResetOfflineLoginStatus();
44
45 virtual bool online_complete();
46 virtual const LoginFailure& online_outcome();
47 virtual const GaiaAuthConsumer::ClientLoginResult& credentials();
48
49 virtual bool offline_complete();
50 virtual bool offline_outcome();
51 virtual int offline_code();
52
53 // Saved so we can retry client login, and also so we know for whom login
54 // has succeeded, in the event of successful completion.
55 const std::string username;
56
57 // These fields are saved so we can retry client login.
58 const std::string password;
59 const std::string ascii_hash;
60 const std::string login_token;
61 const std::string login_captcha;
62
63 protected:
64 bool unlock_; // True if authenticating to unlock the computer.
65 bool try_again_; // True if we're willing to retry the login attempt.
66
67 // Status of our online login attempt.
68 bool online_complete_;
69 LoginFailure online_outcome_;
70 GaiaAuthConsumer::ClientLoginResult credentials_;
71
72 // Status of our offline login attempt/user homedir mount attempt.
73 bool offline_complete_;
74 bool offline_outcome_;
75 int offline_code_;
76
77 private:
78 DISALLOW_COPY_AND_ASSIGN(AuthAttemptState);
79 };
80
81 } // namespace chromeos
82
83 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ATTEMPT_STATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/mock_cryptohome_library.h ('k') | chrome/browser/chromeos/login/auth_attempt_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698