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

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

Issue 402403004: Refactoring : Move OnlineAttempt to chromeos/login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yet another merge with ToT Created 6 years, 4 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
« no previous file with comments | « chromeos/login/auth/online_attempt.cc ('k') | chromeos/login/auth/online_attempt_host.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 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 CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ 6 #define 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 "chromeos/chromeos_export.h"
13 #include "chromeos/login/auth/auth_attempt_state_resolver.h" 14 #include "chromeos/login/auth/auth_attempt_state_resolver.h"
14 #include "chromeos/login/auth/user_context.h" 15 #include "chromeos/login/auth/user_context.h"
15 16
16 namespace content { 17 namespace net {
17 class BrowserContext; 18 class URLRequestContextGetter;
18 } 19 }
19 20
20 namespace chromeos { 21 namespace chromeos {
21 22
22 class AuthAttemptState; 23 class AuthAttemptState;
23 class OnlineAttempt; 24 class OnlineAttempt;
24 class UserContext; 25 class UserContext;
25 26
26 // Helper class which hosts OnlineAttempt for online credentials checking. 27 // Helper class which hosts OnlineAttempt for online credentials checking.
27 class OnlineAttemptHost : public AuthAttemptStateResolver { 28 class CHROMEOS_EXPORT OnlineAttemptHost : public AuthAttemptStateResolver {
28 public: 29 public:
29 class Delegate { 30 class Delegate {
30 public: 31 public:
31 // Called after user_context were checked online. 32 // Called after user_context were checked online.
32 virtual void OnChecked(const std::string& username, bool success) = 0; 33 virtual void OnChecked(const std::string& username, bool success) = 0;
33 }; 34 };
34 35
35 explicit OnlineAttemptHost(Delegate *delegate); 36 explicit OnlineAttemptHost(Delegate* delegate);
36 virtual ~OnlineAttemptHost(); 37 virtual ~OnlineAttemptHost();
37 38
38 // Performs an online check of the credentials in |user_context| and invokes 39 // Performs an online check of the credentials in |request_context| and
40 // invokes
39 // the delegate's OnChecked() with the result. Note that only one check can be 41 // the delegate's OnChecked() with the result. Note that only one check can be
40 // in progress at any given time. If this method is invoked with a different 42 // in progress at any given time. If this method is invoked with a different
41 // |user_context| than a check currently in progress, the current check will 43 // |user_context| than a check currently in progress, the current check will
42 // be silently aborted. 44 // be silently aborted.
43 void Check(content::BrowserContext* auth_context, 45 void Check(net::URLRequestContextGetter* request_context,
44 const UserContext& user_context); 46 const UserContext& user_context);
45 47
46 // Resets the checking process. 48 // Resets the checking process.
47 void Reset(); 49 void Reset();
48 50
49 // AuthAttemptStateResolver overrides. 51 // AuthAttemptStateResolver overrides.
50 // Executed on IO thread. 52 // Executed on IO thread.
51 virtual void Resolve() OVERRIDE; 53 virtual void Resolve() OVERRIDE;
52 54
53 // Does an actual resolve on UI thread. 55 // Does an actual resolve on UI thread.
54 void ResolveOnUIThread(bool success); 56 void ResolveOnUIThread(bool success);
55 57
56 private: 58 private:
59 scoped_refptr<base::MessageLoopProxy> message_loop_;
57 Delegate* delegate_; 60 Delegate* delegate_;
58 UserContext current_attempt_user_context_; 61 UserContext current_attempt_user_context_;
59 scoped_ptr<OnlineAttempt> online_attempt_; 62 scoped_ptr<OnlineAttempt> online_attempt_;
60 scoped_ptr<AuthAttemptState> state_; 63 scoped_ptr<AuthAttemptState> state_;
61 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_; 64 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_;
62 65
63 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost); 66 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost);
64 }; 67 };
65 68
66 } // namespace chromeos 69 } // namespace chromeos
67 70
68 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ 71 #endif // CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_
69
OLDNEW
« no previous file with comments | « chromeos/login/auth/online_attempt.cc ('k') | chromeos/login/auth/online_attempt_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698