Chromium Code Reviews

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

Issue 3436031: [Chrome OS] Refactor Canonicalize() method into base class to prepare for new Authenticator subclass (Closed)
Patch Set: aaaaand fix one more header Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/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 (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_AUTHENTICATOR_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
11 #include "chrome/browser/chrome_thread.h"
12 #include "chrome/browser/chromeos/login/login_status_consumer.h" 11 #include "chrome/browser/chromeos/login/login_status_consumer.h"
13 #include "chrome/common/net/gaia/gaia_auth_consumer.h" 12 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
14 13
15 class Profile; 14 class Profile;
16 15
17 namespace chromeos { 16 namespace chromeos {
18 17
19 // An interface for objects that will authenticate a Chromium OS user. 18 // An interface for objects that will authenticate a Chromium OS user.
20 // When authentication successfully completes, will call 19 // When authentication successfully completes, will call
21 // consumer_->OnLoginSuccess(|username|) on the UI thread. 20 // consumer_->OnLoginSuccess(|username|) on the UI thread.
22 // On failure, will call consumer_->OnLoginFailure() on the UI thread. 21 // On failure, will call consumer_->OnLoginFailure() on the UI thread.
23 // On password change detected, will call 22 // On password change detected, will call
24 // consumer_->OnPasswordChangeDetected() on the UI thread. 23 // consumer_->OnPasswordChangeDetected() on the UI thread.
25 class Authenticator : public base::RefCountedThreadSafe<Authenticator> { 24 class Authenticator : public base::RefCountedThreadSafe<Authenticator> {
26 public: 25 public:
27 explicit Authenticator(LoginStatusConsumer* consumer) 26 explicit Authenticator(LoginStatusConsumer* consumer);
28 : consumer_(consumer) { 27 virtual ~Authenticator();
29 }
30 virtual ~Authenticator() {}
31 28
32 // Given a |username| and |password|, this method attempts to authenticate 29 // Given a |username| and |password|, this method attempts to authenticate
33 // to login. 30 // to login.
34 // Optionally |login_token| and |login_captcha| could be provided. 31 // Optionally |login_token| and |login_captcha| could be provided.
35 // Returns true if we kick off the attempt successfully and false if we can't. 32 // Returns true if we kick off the attempt successfully and false if we can't.
36 // Must be called on the UI thread. 33 // Must be called on the UI thread.
37 virtual bool AuthenticateToLogin(Profile* profile, 34 virtual bool AuthenticateToLogin(Profile* profile,
38 const std::string& username, 35 const std::string& username,
39 const std::string& password, 36 const std::string& password,
40 const std::string& login_token, 37 const std::string& login_token,
(...skipping 26 matching lines...)
67 virtual void RecoverEncryptedData( 64 virtual void RecoverEncryptedData(
68 const std::string& old_password, 65 const std::string& old_password,
69 const GaiaAuthConsumer::ClientLoginResult& credentials) = 0; 66 const GaiaAuthConsumer::ClientLoginResult& credentials) = 0;
70 67
71 // Call this method to erase the user's encrypted data 68 // Call this method to erase the user's encrypted data
72 // and create a new cryptohome. |result| is the blob of auth 69 // and create a new cryptohome. |result| is the blob of auth
73 // data passed back through OnPasswordChangeDetected(). 70 // data passed back through OnPasswordChangeDetected().
74 virtual void ResyncEncryptedData( 71 virtual void ResyncEncryptedData(
75 const GaiaAuthConsumer::ClientLoginResult& credentials) = 0; 72 const GaiaAuthConsumer::ClientLoginResult& credentials) = 0;
76 73
74 // Perform basic canonicalization of |email_address|, taking into account
75 // that gmail does not consider '.' or caps inside a username to matter.
76 // For example, c.masone@gmail.com == cMaSone@gmail.com, per
77 // http://mail.google.com/support/bin/answer.py?hl=en&ctx=mail&answer=10313#
Zachary Kuznia 2010/09/28 04:15:03 Could you update this comment to note that anythin
Chris Masone 2010/09/28 04:33:17 Done.
78 static std::string Canonicalize(const std::string& email_address);
79
77 protected: 80 protected:
78 LoginStatusConsumer* consumer_; 81 LoginStatusConsumer* consumer_;
79 82
80 private: 83 private:
81 DISALLOW_COPY_AND_ASSIGN(Authenticator); 84 DISALLOW_COPY_AND_ASSIGN(Authenticator);
82 }; 85 };
83 86
84 } // namespace chromeos 87 } // namespace chromeos
85 88
86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ 89 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine