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

Side by Side Diff: chrome/browser/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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chromeos/login/auth/auth_attempt_state_resolver.h"
14 #include "chromeos/login/auth/user_context.h"
15
16 namespace content {
17 class BrowserContext;
18 }
19
20 namespace chromeos {
21
22 class AuthAttemptState;
23 class OnlineAttempt;
24 class UserContext;
25
26 // Helper class which hosts OnlineAttempt for online credentials checking.
27 class OnlineAttemptHost : public AuthAttemptStateResolver {
28 public:
29 class Delegate {
30 public:
31 // Called after user_context were checked online.
32 virtual void OnChecked(const std::string& username, bool success) = 0;
33 };
34
35 explicit OnlineAttemptHost(Delegate *delegate);
36 virtual ~OnlineAttemptHost();
37
38 // 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
40 // 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
42 // be silently aborted.
43 void Check(content::BrowserContext* auth_context,
44 const UserContext& user_context);
45
46 // Resets the checking process.
47 void Reset();
48
49 // AuthAttemptStateResolver overrides.
50 // Executed on IO thread.
51 virtual void Resolve() OVERRIDE;
52
53 // Does an actual resolve on UI thread.
54 void ResolveOnUIThread(bool success);
55
56 private:
57 Delegate* delegate_;
58 UserContext current_attempt_user_context_;
59 scoped_ptr<OnlineAttempt> online_attempt_;
60 scoped_ptr<AuthAttemptState> state_;
61 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost);
64 };
65
66 } // namespace chromeos
67
68 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_
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