| 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 "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" |
| 13 |
| 14 class Profile; |
| 15 |
| 16 namespace extensions { |
| 17 |
| 18 class IdentitySigninFlow : public content::NotificationObserver { |
| 19 public: |
| 20 class Delegate { |
| 21 public: |
| 22 Delegate() {} |
| 23 virtual ~Delegate() {} |
| 24 // Called when the flow has completed successfully. |
| 25 virtual void SigninSuccess(const std::string& token) = 0; |
| 26 // Called when the flow has failed. |
| 27 virtual void SigninFailed() = 0; |
| 28 |
| 29 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 30 }; |
| 31 |
| 32 IdentitySigninFlow(Delegate* delegate, |
| 33 Profile* profile); |
| 34 virtual ~IdentitySigninFlow(); |
| 35 |
| 36 // Starts the flow. Should only be called once. |
| 37 void Start(); |
| 38 |
| 39 // content::NotificationObserver implementation. |
| 40 virtual void Observe(int type, |
| 41 const content::NotificationSource& source, |
| 42 const content::NotificationDetails& details) OVERRIDE; |
| 43 |
| 44 private: |
| 45 void ReportSigninSuccess(const std::string& token); |
| 46 |
| 47 Delegate* delegate_; |
| 48 Profile* profile_; |
| 49 // Used to listen to notifications from the TokenService. |
| 50 content::NotificationRegistrar registrar_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(IdentitySigninFlow); |
| 53 }; |
| 54 |
| 55 } // namespace extensions |
| 56 |
| 57 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_ |
| OLD | NEW |