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

Side by Side Diff: chrome/browser/chromeos/login/auth/online_attempt_host.h

Issue 296773002: Add a Key class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_AUTH_ONLINE_ATTEMPT_HOST_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h" 13 #include "chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h"
14 #include "chrome/browser/chromeos/login/auth/user_context.h"
14 15
15 namespace content { 16 namespace content {
16 class BrowserContext; 17 class BrowserContext;
17 } 18 }
18 19
19 namespace chromeos { 20 namespace chromeos {
20 21
21 class AuthAttemptState; 22 class AuthAttemptState;
22 class OnlineAttempt; 23 class OnlineAttempt;
23 class UserContext; 24 class UserContext;
24 25
25 // Helper class which hosts OnlineAttempt for online credentials checking. 26 // Helper class which hosts OnlineAttempt for online credentials checking.
26 class OnlineAttemptHost : public AuthAttemptStateResolver { 27 class OnlineAttemptHost : public AuthAttemptStateResolver {
27 public: 28 public:
28 class Delegate { 29 class Delegate {
29 public: 30 public:
30 // Called after user_context were checked online. 31 // Called after user_context were checked online.
31 virtual void OnChecked(const std::string &username, bool success) = 0; 32 virtual void OnChecked(const std::string& username, bool success) = 0;
32 }; 33 };
33 34
34 explicit OnlineAttemptHost(Delegate *delegate); 35 explicit OnlineAttemptHost(Delegate *delegate);
35 virtual ~OnlineAttemptHost(); 36 virtual ~OnlineAttemptHost();
36 37
37 // Checks user credentials using an online attempt. Calls callback with the 38 // Performs an online check of the credentials in |user_context| and invokes
38 // check result (whether authentication was successful). Note, only one 39 // the delegate's OnChecked() with the result. Note that only one check can be
39 // checking at a time (the newest call stops the old one, if called with 40 // in progress at any given time. If this method is invoked with a different
40 // another username and password combination). 41 // |user_context| than a check currently in progress, the current check will
42 // be silently aborted.
41 void Check(content::BrowserContext* auth_context, 43 void Check(content::BrowserContext* auth_context,
42 const UserContext& user_context); 44 const UserContext& user_context);
43 45
44 // Resets the checking process. 46 // Resets the checking process.
45 void Reset(); 47 void Reset();
46 48
47 // AuthAttemptStateResolver overrides. 49 // AuthAttemptStateResolver overrides.
48 // Executed on IO thread. 50 // Executed on IO thread.
49 virtual void Resolve() OVERRIDE; 51 virtual void Resolve() OVERRIDE;
50 52
51 // Does an actual resolve on UI thread. 53 // Does an actual resolve on UI thread.
52 void ResolveOnUIThread(bool success); 54 void ResolveOnUIThread(bool success);
53 55
54 private: 56 private:
55 Delegate* delegate_; 57 Delegate* delegate_;
56 std::string current_attempt_hash_; 58 UserContext current_attempt_user_context_;
57 std::string current_username_;
58 scoped_ptr<OnlineAttempt> online_attempt_; 59 scoped_ptr<OnlineAttempt> online_attempt_;
59 scoped_ptr<AuthAttemptState> state_; 60 scoped_ptr<AuthAttemptState> state_;
60 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_; 61 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_;
61 62
62 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost); 63 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost);
63 }; 64 };
64 65
65 } // namespace chromeos 66 } // namespace chromeos
66 67
67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ 68 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_
68 69
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/auth/online_attempt.cc ('k') | chrome/browser/chromeos/login/auth/online_attempt_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698