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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "google_apis/gaia/oauth2_token_service.h"
15 namespace extensions
{
17 // IdentitySigninFlow is a controller class to do a sign-in flow for an
18 // interactive Identity API call. The UI is launched through the LoginUIService.
19 // When the flow completes, the delegate is notified, and on success will
20 // be given an OAuth2 login refresh token.
21 class IdentitySigninFlow
: public OAuth2TokenService::Observer
{
26 virtual ~Delegate() {}
27 // Called when the flow has completed successfully.
28 virtual void SigninSuccess() = 0;
29 // Called when the flow has failed.
30 virtual void SigninFailed() = 0;
32 DISALLOW_COPY_AND_ASSIGN(Delegate
);
35 IdentitySigninFlow(Delegate
* delegate
,
37 virtual ~IdentitySigninFlow();
39 // Starts the flow. Should only be called once.
42 // OAuth2TokenService::Observer implementation:
43 virtual void OnRefreshTokenAvailable(const std::string
& account_id
) OVERRIDE
;
49 DISALLOW_COPY_AND_ASSIGN(IdentitySigninFlow
);
52 } // namespace extensions
54 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_