Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 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_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "chrome/browser/signin/signin_tracker.h" | |
| 12 #include "content/public/browser/notification_observer.h" | |
| 13 #include "content/public/browser/notification_registrar.h" | |
| 14 | |
| 15 class GoogleServiceAuthError; | |
| 16 class Profile; | |
| 17 | |
| 18 namespace extensions { | |
| 19 | |
| 20 class IdentitySigninFlow : public SigninTracker::Observer, | |
| 21 public content::NotificationObserver { | |
| 22 public: | |
| 23 class Delegate { | |
| 24 public: | |
| 25 Delegate() {} | |
| 26 virtual ~Delegate() {} | |
| 27 // Called when the flow has completed successfully. | |
| 28 virtual void SigninSuccess(const std::string& token) = 0; | |
| 29 // Called when the flow has failed. | |
| 30 virtual void SigninFailed() = 0; | |
| 31 | |
| 32 DISALLOW_COPY_AND_ASSIGN(Delegate); | |
| 33 }; | |
| 34 | |
| 35 IdentitySigninFlow(Delegate* delegate, | |
| 36 Profile* profile); | |
| 37 virtual ~IdentitySigninFlow(); | |
| 38 | |
| 39 void Start(); | |
| 40 | |
| 41 // SigninTracker::Observer implementation. | |
|
Pete Williamson
2013/03/27 18:03:55
If we aren't using the signin tracker observer yet
Michael Courage
2013/03/27 18:40:11
Done.
| |
| 42 virtual void GaiaCredentialsValid() OVERRIDE {} | |
| 43 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; | |
| 44 virtual void SigninSuccess() OVERRIDE {} | |
| 45 | |
| 46 // content::NotificationObserver implementation. | |
| 47 virtual void Observe(int type, | |
| 48 const content::NotificationSource& source, | |
| 49 const content::NotificationDetails& details) OVERRIDE; | |
| 50 | |
| 51 private: | |
| 52 void ReportSigninSuccess(const std::string& token); | |
| 53 | |
| 54 Delegate* delegate_; | |
| 55 Profile* profile_; | |
| 56 // Used to listen to notifications from the TokenService. | |
| 57 content::NotificationRegistrar registrar_; | |
| 58 scoped_ptr<SigninTracker> signin_tracker_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(IdentitySigninFlow); | |
| 61 }; | |
| 62 | |
| 63 } // namespace extensions | |
| 64 | |
| 65 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_ | |
| OLD | NEW |