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

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

Issue 11649055: OAuth2 sign-in flow for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 (c) 2012 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.
xiyuan 2013/01/07 23:07:55 nit: insert an empty line
zel 2013/01/08 02:05:41 Done.
4 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_H_
5 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_H_
6
7 #include <string>
8
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/chromeos/login/oauth2_login_verifier.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14
15 class GaiaAuthFetcher;
16 class GoogleServiceAuthError;
17 class Profile;
18
19 namespace chromeos {
20
21 // Observes token change events in TokenService and coordinates appropriate
22 // response from ChromeOS login flow.
23 class LoginManager : public base::SupportsWeakPtr<LoginManager>,
xiyuan 2013/01/07 23:07:55 It seems we never get a weak ptr of the LoginManag
zel 2013/01/08 02:05:41 Done.
zel 2013/01/08 02:05:41 I've called it TokenServiceObserver originally, bu
24 public content::NotificationObserver,
25 public OAuth2LoginVerifier::Delegate {
26 public:
27 class Delegate {
28 public:
29 virtual ~Delegate() {}
30 // Reports when tokens are loaded from the database.
xiyuan 2013/01/07 23:07:55 nit: alignment
zel 2013/01/08 02:05:41 Done.
31 virtual void OnOAuth2RefreshTokenLoaded(
32 Profile* profile,
33 const std::string& oauth2_refresh_token) = 0;
34 // Reports when key auth-related tokens failed to be fetched.
35 virtual void OnOAuth2RefreshTokenFetchFailed(
36 Profile* profile, const std::string& service) = 0;
37 // Reports when GAIA cookies have been successfully restored in the cookie
38 // jar of the |profile| (through /MergeSession GAIA call).
39 virtual void OnCookiesRestoreSuccess(Profile* profile) = 0;
40 // Reports when GAIA cookies have been successfully restored in the cookie
41 // jar of the |profile| (through /MergeSession GAIA call).
42 virtual void OnCookiesRestoreFailure(Profile* profile) = 0;
43 };
44
45 LoginManager(Delegate* delegate, Profile* user_profile);
46
47 private:
48 // content::NotificationObserver overrides.
49 void Observe(int type,
50 const content::NotificationSource& source,
51 const content::NotificationDetails& details) OVERRIDE;
52
53 // OAuth2LoginVerifier::Delegate overrides.
54 virtual void OnOAuth2LoginVerifierSuccess(const std::string& sid,
55 const std::string& lsid,
56 const std::string& auth) OVERRIDE;
57 virtual void OnOAuth2LoginVerifierFaulure() OVERRIDE;
58
59 // Reports when all tokens are loaded.
60 void ReportTokenLoaded();
61 // Issue GAIA cookie recovery (MergeSession) from |uber_token_|.
62 void RestoreSessionCookies();
63 // Checks GAIA error and figures out of the request should be reattempted
xiyuan 2013/01/07 23:07:55 nit: Checks GAIA error and figures out whether the
zel 2013/01/08 02:05:41 Done.
64 //
65 bool RetryOnError(const GoogleServiceAuthError& error);
66
67 Delegate* delegate_;
68 Profile* user_profile_;
69 // Keeps the track if we have already reported OAuth2 token being loaded
70 // by TokenService.
71 bool loading_reported_;
72 int restore_attempt_count_;
73 content::NotificationRegistrar registrar_;
74 scoped_ptr<OAuth2LoginVerifier> login_verifier_;
75 std::string refresh_token_;
76 };
77
78 } // namespace chromeos
79
80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698