Chromium Code Reviews| Index: chrome/browser/extensions/api/identity/identity_signin_flow.h |
| diff --git a/chrome/browser/extensions/api/identity/identity_signin_flow.h b/chrome/browser/extensions/api/identity/identity_signin_flow.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6d903447ebe9a36fd56d10bcd37e53db2e552173 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/identity/identity_signin_flow.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/signin/signin_tracker.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| + |
| +class GoogleServiceAuthError; |
| +class Profile; |
| + |
| +namespace extensions { |
| + |
| +class IdentitySigninFlow : public SigninTracker::Observer, |
| + public content::NotificationObserver { |
| + public: |
| + class Delegate { |
| + public: |
| + Delegate() {} |
| + virtual ~Delegate() {} |
| + // Called when the flow has completed successfully. |
| + virtual void SigninSuccess(const std::string& token) = 0; |
| + // Called when the flow has failed. |
| + virtual void SigninFailed() = 0; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(Delegate); |
| + }; |
| + |
| + IdentitySigninFlow(Delegate* delegate, |
| + Profile* profile); |
| + virtual ~IdentitySigninFlow(); |
| + |
| + void Start(); |
| + |
| + // 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.
|
| + virtual void GaiaCredentialsValid() OVERRIDE {} |
| + virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; |
| + virtual void SigninSuccess() OVERRIDE {} |
| + |
| + // content::NotificationObserver implementation. |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + private: |
| + void ReportSigninSuccess(const std::string& token); |
| + |
| + Delegate* delegate_; |
| + Profile* profile_; |
| + // Used to listen to notifications from the TokenService. |
| + content::NotificationRegistrar registrar_; |
| + scoped_ptr<SigninTracker> signin_tracker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(IdentitySigninFlow); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_ |