blob: 25e806d4f6fde68a5c7d1565a7d846bd95441d48 [file] [log] [blame]
[email protected]a263ff52014-04-23 19:46:531// 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.
4
Colin Blundell3e0efae2018-06-05 07:11:495#include "components/invalidation/impl/profile_identity_provider.h"
[email protected]a263ff52014-04-23 19:46:536
[email protected]a263ff52014-04-23 19:46:537#include "components/signin/core/browser/profile_oauth2_token_service.h"
8
Colin Blundell3e0efae2018-06-05 07:11:499namespace invalidation {
10
[email protected]a263ff52014-04-23 19:46:5311ProfileIdentityProvider::ProfileIdentityProvider(
12 SigninManagerBase* signin_manager,
Colin Blundell12b411d22018-05-23 09:24:2613 ProfileOAuth2TokenService* token_service)
14 : signin_manager_(signin_manager), token_service_(token_service) {
[email protected]a263ff52014-04-23 19:46:5315 signin_manager_->AddObserver(this);
16}
17
18ProfileIdentityProvider::~ProfileIdentityProvider() {
19 signin_manager_->RemoveObserver(this);
20}
21
[email protected]a263ff52014-04-23 19:46:5322std::string ProfileIdentityProvider::GetActiveAccountId() {
23 return signin_manager_->GetAuthenticatedAccountId();
24}
25
26OAuth2TokenService* ProfileIdentityProvider::GetTokenService() {
27 return token_service_;
28}
29
[email protected]a263ff52014-04-23 19:46:5330void ProfileIdentityProvider::GoogleSigninSucceeded(
rogerta22aa58e2014-08-29 15:15:5731 const std::string& account_id,
Mihai Sardarescub4b697e2017-07-04 16:41:4632 const std::string& username) {
[email protected]a263ff52014-04-23 19:46:5333 FireOnActiveAccountLogin();
34}
35
rogerta22aa58e2014-08-29 15:15:5736void ProfileIdentityProvider::GoogleSignedOut(const std::string& account_id,
37 const std::string& username) {
[email protected]a263ff52014-04-23 19:46:5338 FireOnActiveAccountLogout();
39}
Colin Blundell3e0efae2018-06-05 07:11:4940
41} // namespace invalidation