Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / signin / core / browser / profile_identity_provider.h
blobca3e1a590a3b73b265eb5f68840e571318857ed6
1 // Copyright 2014 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 COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_IDENTITY_PROVIDER_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_IDENTITY_PROVIDER_H_
8 #include "base/callback_forward.h"
9 #include "base/macros.h"
10 #include "components/signin/core/browser/signin_manager_base.h"
11 #include "google_apis/gaia/identity_provider.h"
13 class ProfileOAuth2TokenService;
15 // An identity provider implementation that's backed by
16 // ProfileOAuth2TokenService and SigninManager.
17 class ProfileIdentityProvider : public IdentityProvider,
18 public SigninManagerBase::Observer {
19 public:
20 // |request_login_callback| may be null, in which case login attempts are
21 // ignored.
22 ProfileIdentityProvider(SigninManagerBase* signin_manager,
23 ProfileOAuth2TokenService* token_service,
24 const base::Closure& request_login_callback);
25 ~ProfileIdentityProvider() override;
27 // IdentityProvider:
28 std::string GetActiveUsername() override;
29 std::string GetActiveAccountId() override;
30 OAuth2TokenService* GetTokenService() override;
31 bool RequestLogin() override;
33 // SigninManagerBase::Observer:
34 void GoogleSigninSucceeded(const std::string& account_id,
35 const std::string& username,
36 const std::string& password) override;
37 void GoogleSignedOut(const std::string& account_id,
38 const std::string& username) override;
40 private:
41 SigninManagerBase* const signin_manager_;
42 ProfileOAuth2TokenService* const token_service_;
43 base::Closure request_login_callback_;
45 DISALLOW_COPY_AND_ASSIGN(ProfileIdentityProvider);
48 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_IDENTITY_PROVIDER_H_