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

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

Issue 9466005: Make sure the device recovers from policy loss in the consumer case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "chrome/common/net/gaia/gaia_auth_consumer.h" 12 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
13 #include "chrome/common/net/gaia/google_service_auth_error.h" 13 #include "chrome/common/net/gaia/google_service_auth_error.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 class LoginFailure { 18 class LoginFailure {
19 public: 19 public:
20 enum FailureReason { 20 enum FailureReason {
21 NONE, 21 NONE,
22 COULD_NOT_MOUNT_CRYPTOHOME, 22 COULD_NOT_MOUNT_CRYPTOHOME,
23 COULD_NOT_MOUNT_TMPFS, 23 COULD_NOT_MOUNT_TMPFS,
24 COULD_NOT_UNMOUNT_CRYPTOHOME, 24 COULD_NOT_UNMOUNT_CRYPTOHOME,
25 DATA_REMOVAL_FAILED, // Could not destroy your old data 25 DATA_REMOVAL_FAILED, // Could not destroy your old data
26 LOGIN_TIMED_OUT, 26 LOGIN_TIMED_OUT,
27 UNLOCK_FAILED, 27 UNLOCK_FAILED,
28 NETWORK_AUTH_FAILED, // Could not authenticate against Google 28 NETWORK_AUTH_FAILED, // Could not authenticate against Google
29 OWNER_REQUIRED, // Only the device owner can log-in.
29 NUM_FAILURE_REASONS, // This has to be the last item. 30 NUM_FAILURE_REASONS, // This has to be the last item.
30 }; 31 };
31 32
32 explicit LoginFailure(FailureReason reason) 33 explicit LoginFailure(FailureReason reason)
33 : reason_(reason), 34 : reason_(reason),
34 error_(GoogleServiceAuthError::NONE) { 35 error_(GoogleServiceAuthError::NONE) {
35 DCHECK(reason != NETWORK_AUTH_FAILED); 36 DCHECK(reason != NETWORK_AUTH_FAILED);
36 } 37 }
37 38
38 inline bool operator==(const LoginFailure &b) const { 39 inline bool operator==(const LoginFailure &b) const {
(...skipping 27 matching lines...) Expand all
66 return "Could not mount tmpfs."; 67 return "Could not mount tmpfs.";
67 case LOGIN_TIMED_OUT: 68 case LOGIN_TIMED_OUT:
68 return "Login timed out. Please try again."; 69 return "Login timed out. Please try again.";
69 case UNLOCK_FAILED: 70 case UNLOCK_FAILED:
70 return "Unlock failed."; 71 return "Unlock failed.";
71 case NETWORK_AUTH_FAILED: 72 case NETWORK_AUTH_FAILED:
72 if (error_.state() == GoogleServiceAuthError::CONNECTION_FAILED) { 73 if (error_.state() == GoogleServiceAuthError::CONNECTION_FAILED) {
73 return net::ErrorToString(error_.network_error()); 74 return net::ErrorToString(error_.network_error());
74 } 75 }
75 return "Google authentication failed."; 76 return "Google authentication failed.";
77 case OWNER_REQUIRED:
78 return "Login is restricted to the owner's account only.";
76 default: 79 default:
77 NOTREACHED(); 80 NOTREACHED();
78 return std::string(); 81 return std::string();
79 } 82 }
80 } 83 }
81 84
82 const GoogleServiceAuthError& error() const { return error_; } 85 const GoogleServiceAuthError& error() const { return error_; }
83 const FailureReason& reason() const { return reason_; } 86 const FailureReason& reason() const { return reason_; }
84 87
85 private: 88 private:
(...skipping 27 matching lines...) Expand all
113 // The current guest login attempt has succeeded. 116 // The current guest login attempt has succeeded.
114 virtual void OnOffTheRecordLoginSuccess() {} 117 virtual void OnOffTheRecordLoginSuccess() {}
115 // The same password didn't work both online and offline. 118 // The same password didn't work both online and offline.
116 virtual void OnPasswordChangeDetected( 119 virtual void OnPasswordChangeDetected(
117 const GaiaAuthConsumer::ClientLoginResult& credentials); 120 const GaiaAuthConsumer::ClientLoginResult& credentials);
118 }; 121 };
119 122
120 } // namespace chromeos 123 } // namespace chromeos
121 124
122 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_STATUS_CONSUMER_H_ 125 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_STATUS_CONSUMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698