Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / signin / signin_oauth_helper.h
blobc75823585fbf6fe31bc00ae90da044141dfa413a
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_SIGNIN_SIGNIN_OAUTH_HELPER_H_
6 #define CHROME_BROWSER_SIGNIN_SIGNIN_OAUTH_HELPER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "google_apis/gaia/gaia_auth_consumer.h"
11 class GaiaAuthFetcher;
12 class Profile;
14 // Helper class for the sign in process. Currently it provides a single helper
15 // method for secondary account authentication by exchanging oauth code for
16 // tokens and user info, and upon success adding the user to
17 // |ProfileOauth2TokenService|. The class will delete itself upon completion.
18 // TODO(guohui): refactor the class to consolidate duplicate code paths in
19 // OneClickSigninHelper, SigninManager and this class.
20 class SigninOAuthHelper : public GaiaAuthConsumer {
21 public:
22 explicit SigninOAuthHelper(Profile* profile);
23 virtual ~SigninOAuthHelper();
25 void StartAddingAccount(const std::string& oauth_code);
27 // Overridden from GaiaAuthConsumer.
28 virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) OVERRIDE;
29 virtual void OnClientOAuthFailure(
30 const GoogleServiceAuthError& error) OVERRIDE;
31 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE;
32 virtual void OnClientLoginFailure(
33 const GoogleServiceAuthError& error) OVERRIDE;
34 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE;
35 virtual void OnGetUserInfoFailure(
36 const GoogleServiceAuthError& error) OVERRIDE;
38 private:
39 Profile* profile_;
40 scoped_ptr<GaiaAuthFetcher> gaia_auth_fetcher_;
41 std::string refresh_token_;
43 DISALLOW_COPY_AND_ASSIGN(SigninOAuthHelper);
46 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_OAUTH_HELPER_H_