1116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved.
2116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
3116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// found in the LICENSE file.
4116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
5116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "chrome/browser/signin/fake_account_reconcilor.h"
6116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
7116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "chrome/browser/profiles/profile.h"
8116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "chrome/browser/signin/chrome_signin_client_factory.h"
9116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
10116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "chrome/browser/signin/signin_manager_factory.h"
11116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
12116680a4aac90f2aa7413d9095a592090648e557Ben MurdochFakeAccountReconcilor::FakeAccountReconcilor(
13116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    ProfileOAuth2TokenService* token_service,
14116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    SigninManagerBase* signin_manager,
15116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    SigninClient* client) :
16116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  AccountReconcilor(token_service, signin_manager, client) {}
17116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
18116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
19116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// static
20116680a4aac90f2aa7413d9095a592090648e557Ben MurdochKeyedService* FakeAccountReconcilor::Build(content::BrowserContext* context) {
21116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  Profile* profile = Profile::FromBrowserContext(context);
22116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  AccountReconcilor* reconcilor = new FakeAccountReconcilor(
23116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
24116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      SigninManagerFactory::GetForProfile(profile),
25116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      ChromeSigninClientFactory::GetForProfile(profile));
26116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  reconcilor->Initialize(true /* start_reconcile_if_tokens_available */);
27116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  return reconcilor;
28116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch}
29116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
30116680a4aac90f2aa7413d9095a592090648e557Ben Murdochvoid FakeAccountReconcilor::GetAccountsFromCookie(
31116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    GetAccountsFromCookieCallback callback) {
32116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  std::vector<std::pair<std::string, bool> > gaia_accounts;
33116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  callback.Run(GoogleServiceAuthError::AuthErrorNone(), gaia_accounts);
34116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch}
35