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

Side by Side Diff: chrome/browser/chromeos/login/login_status_consumer.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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_STATUS_CONSUMER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_STATUS_CONSUMER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_STATUS_CONSUMER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_STATUS_CONSUMER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include "chrome/common/net/gaia/gaia_auth_consumer.h" 10 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
11 #include "chrome/common/net/gaia/google_service_auth_error.h" 11 #include "chrome/common/net/gaia/google_service_auth_error.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 class LoginFailure { 16 class LoginFailure {
17 public: 17 public:
18 enum FailureReason { 18 enum FailureReason {
19 NONE,
19 COULD_NOT_MOUNT_CRYPTOHOME, 20 COULD_NOT_MOUNT_CRYPTOHOME,
20 COULD_NOT_MOUNT_TMPFS, 21 COULD_NOT_MOUNT_TMPFS,
21 DATA_REMOVAL_FAILED, // Could not destroy your old data 22 DATA_REMOVAL_FAILED, // Could not destroy your old data
22 LOGIN_TIMED_OUT, 23 LOGIN_TIMED_OUT,
23 UNLOCK_FAILED, 24 UNLOCK_FAILED,
24 NETWORK_AUTH_FAILED, // Could not authenticate against Google 25 NETWORK_AUTH_FAILED, // Could not authenticate against Google
25 }; 26 };
26 27
27 explicit LoginFailure(FailureReason reason) 28 explicit LoginFailure(FailureReason reason)
28 : reason_(reason), 29 : reason_(reason),
29 error_(GoogleServiceAuthError::NONE) { 30 error_(GoogleServiceAuthError::NONE) {
30 DCHECK(reason != NETWORK_AUTH_FAILED); 31 DCHECK(reason != NETWORK_AUTH_FAILED);
31 } 32 }
32 33
33 inline bool operator==(const LoginFailure &b) const { 34 inline bool operator==(const LoginFailure &b) const {
34 if (reason_ != b.reason_) { 35 if (reason_ != b.reason_) {
35 return false; 36 return false;
36 } 37 }
37 if (reason_ == NETWORK_AUTH_FAILED) { 38 if (reason_ == NETWORK_AUTH_FAILED) {
38 return error_ == b.error_; 39 return error_ == b.error_;
39 } 40 }
40 return true; 41 return true;
41 } 42 }
42 43
43 static LoginFailure FromNetworkAuthFailure( 44 static LoginFailure FromNetworkAuthFailure(
44 const GoogleServiceAuthError& error) { 45 const GoogleServiceAuthError& error) {
45 return LoginFailure(NETWORK_AUTH_FAILED, error); 46 return LoginFailure(NETWORK_AUTH_FAILED, error);
46 } 47 }
47 48
49 static LoginFailure None() {
50 return LoginFailure(NONE);
51 }
52
48 const std::string GetErrorString() const { 53 const std::string GetErrorString() const {
49 switch (reason_) { 54 switch (reason_) {
50 case DATA_REMOVAL_FAILED: 55 case DATA_REMOVAL_FAILED:
51 return "Could not destroy your old data."; 56 return "Could not destroy your old data.";
52 case COULD_NOT_MOUNT_CRYPTOHOME: 57 case COULD_NOT_MOUNT_CRYPTOHOME:
53 return "Could not mount cryptohome."; 58 return "Could not mount cryptohome.";
54 case COULD_NOT_MOUNT_TMPFS: 59 case COULD_NOT_MOUNT_TMPFS:
55 return "Could not mount tmpfs."; 60 return "Could not mount tmpfs.";
56 case LOGIN_TIMED_OUT: 61 case LOGIN_TIMED_OUT:
57 return "Login timed out. Please try again."; 62 return "Login timed out. Please try again.";
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 virtual void OnOffTheRecordLoginSuccess() {} 98 virtual void OnOffTheRecordLoginSuccess() {}
94 virtual void OnPasswordChangeDetected( 99 virtual void OnPasswordChangeDetected(
95 const GaiaAuthConsumer::ClientLoginResult& credentials) { 100 const GaiaAuthConsumer::ClientLoginResult& credentials) {
96 NOTREACHED(); 101 NOTREACHED();
97 }; 102 };
98 }; 103 };
99 104
100 } // namespace chromeos 105 } // namespace chromeos
101 106
102 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_STATUS_CONSUMER_H_ 107 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_STATUS_CONSUMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698