Revert 285173 "Removed InProcessBrowserTest::CleanUpOnMainThread()"
[chromium-blink-merge.git] / chrome / browser / extensions / api / identity / identity_signin_flow.h
blob207e6b5e2e57da61c09a34483a958e9c1caebeef
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_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "google_apis/gaia/oauth2_token_service.h"
13 class Profile;
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 {
22 public:
23 class Delegate {
24 public:
25 Delegate() {}
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,
36 Profile* profile);
37 virtual ~IdentitySigninFlow();
39 // Starts the flow. Should only be called once.
40 void Start();
42 // OAuth2TokenService::Observer implementation:
43 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE;
45 private:
46 Delegate* delegate_;
47 Profile* profile_;
49 DISALLOW_COPY_AND_ASSIGN(IdentitySigninFlow);
52 } // namespace extensions
54 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_