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

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: Got rid of BrowserContext 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
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 content {
17 class BrowserContext; 18 class BrowserContext;
Nikita (slow) 2014/07/24 15:25:59 not needed.
Denis Kuznetsov (DE-MUC) 2014/07/24 15:48:52 Done.
18 } 19 }
19 20
21 namespace net {
22 class URLRequestContextGetter;
23 }
24
20 namespace chromeos { 25 namespace chromeos {
21 26
22 class AuthAttemptState; 27 class AuthAttemptState;
23 class OnlineAttempt; 28 class OnlineAttempt;
24 class UserContext; 29 class UserContext;
25 30
26 // Helper class which hosts OnlineAttempt for online credentials checking. 31 // Helper class which hosts OnlineAttempt for online credentials checking.
27 class OnlineAttemptHost : public AuthAttemptStateResolver { 32 class CHROMEOS_EXPORT OnlineAttemptHost : public AuthAttemptStateResolver {
28 public: 33 public:
29 class Delegate { 34 class Delegate {
30 public: 35 public:
31 // Called after user_context were checked online. 36 // Called after user_context were checked online.
32 virtual void OnChecked(const std::string& username, bool success) = 0; 37 virtual void OnChecked(const std::string& username, bool success) = 0;
33 }; 38 };
34 39
35 explicit OnlineAttemptHost(Delegate *delegate); 40 explicit OnlineAttemptHost(Delegate* delegate);
36 virtual ~OnlineAttemptHost(); 41 virtual ~OnlineAttemptHost();
37 42
38 // Performs an online check of the credentials in |user_context| and invokes 43 // Performs an online check of the credentials in |user_context| and invokes
39 // the delegate's OnChecked() with the result. Note that only one check can be 44 // 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 45 // 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 46 // |user_context| than a check currently in progress, the current check will
42 // be silently aborted. 47 // be silently aborted.
43 void Check(content::BrowserContext* auth_context, 48 void Check(net::URLRequestContextGetter* request_context,
44 const UserContext& user_context); 49 const UserContext& user_context);
45 50
46 // Resets the checking process. 51 // Resets the checking process.
47 void Reset(); 52 void Reset();
48 53
49 // AuthAttemptStateResolver overrides. 54 // AuthAttemptStateResolver overrides.
50 // Executed on IO thread. 55 // Executed on IO thread.
51 virtual void Resolve() OVERRIDE; 56 virtual void Resolve() OVERRIDE;
52 57
53 // Does an actual resolve on UI thread. 58 // Does an actual resolve on UI thread.
54 void ResolveOnUIThread(bool success); 59 void ResolveOnUIThread(bool success);
55 60
56 private: 61 private:
62 scoped_refptr<base::MessageLoopProxy> message_loop_;
57 Delegate* delegate_; 63 Delegate* delegate_;
58 UserContext current_attempt_user_context_; 64 UserContext current_attempt_user_context_;
59 scoped_ptr<OnlineAttempt> online_attempt_; 65 scoped_ptr<OnlineAttempt> online_attempt_;
60 scoped_ptr<AuthAttemptState> state_; 66 scoped_ptr<AuthAttemptState> state_;
61 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_; 67 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_;
62 68
63 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost); 69 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost);
64 }; 70 };
65 71
66 } // namespace chromeos 72 } // namespace chromeos
67 73
68 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ 74 #endif // CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_
69
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698