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

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

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 #include "chrome/browser/chromeos/login/auth_attempt_state.h"
6
7 #include <string>
8
9 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
11 #include "cros/chromeos_cryptohome.h"
12
13 namespace chromeos {
14
15 AuthAttemptState::AuthAttemptState(const std::string& username,
16 const std::string& password,
17 const std::string& ascii_hash,
18 const std::string& login_token,
19 const std::string& login_captcha)
20 : username(username),
21 password(password),
22 ascii_hash(ascii_hash),
23 login_token(login_token),
24 login_captcha(login_captcha),
25 online_complete_(false),
26 online_outcome_(LoginFailure::NONE),
27 offline_complete_(false),
28 offline_outcome_(false),
29 offline_code_(kCryptohomeMountErrorNone) {
30 }
31
32 AuthAttemptState::~AuthAttemptState() {}
33
34 void AuthAttemptState::RecordOnlineLoginStatus(
35 const GaiaAuthConsumer::ClientLoginResult& credentials,
36 const LoginFailure& outcome) {
37 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
38 online_complete_ = true;
39 online_outcome_ = outcome;
40 credentials_ = credentials;
41 }
42
43 void AuthAttemptState::RecordOfflineLoginStatus(bool offline_outcome,
44 int offline_code) {
45 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
46 offline_complete_ = true;
47 offline_outcome_ = offline_outcome;
48 offline_code_ = offline_code;
49 }
50
51 void AuthAttemptState::ResetOfflineLoginStatus() {
52 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
53 offline_complete_ = false;
54 offline_outcome_ = false;
55 offline_code_ = kCryptohomeMountErrorNone;
56 }
57
58 bool AuthAttemptState::online_complete() {
59 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
60 return online_complete_;
61 }
62
63 const LoginFailure& AuthAttemptState::online_outcome() {
64 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
65 return online_outcome_;
66 }
67
68 const GaiaAuthConsumer::ClientLoginResult& AuthAttemptState::credentials() {
69 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
70 return credentials_;
71 }
72
73 bool AuthAttemptState::offline_complete() {
74 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
75 return offline_complete_;
76 }
77
78 bool AuthAttemptState::offline_outcome() {
79 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
80 return offline_outcome_;
81 }
82
83 int AuthAttemptState::offline_code() {
84 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
85 return offline_code_;
86 }
87
88 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/auth_attempt_state.h ('k') | chrome/browser/chromeos/login/auth_attempt_state_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698