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 #include "chrome/browser/signin/fake_account_reconcilor.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/signin/chrome_signin_client_factory.h"
9 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
11 #include "chrome/browser/signin/signin_manager_factory.h"
13 FakeAccountReconcilor::FakeAccountReconcilor(
14 ProfileOAuth2TokenService
* token_service
,
15 SigninManagerBase
* signin_manager
,
17 GaiaCookieManagerService
* cookie_manager_service
) :
19 token_service
, signin_manager
, client
, cookie_manager_service
) {}
23 KeyedService
* FakeAccountReconcilor::Build(content::BrowserContext
* context
) {
24 Profile
* profile
= Profile::FromBrowserContext(context
);
25 AccountReconcilor
* reconcilor
= new FakeAccountReconcilor(
26 ProfileOAuth2TokenServiceFactory::GetForProfile(profile
),
27 SigninManagerFactory::GetForProfile(profile
),
28 ChromeSigninClientFactory::GetForProfile(profile
),
29 GaiaCookieManagerServiceFactory::GetForProfile(profile
));
30 reconcilor
->Initialize(true /* start_reconcile_if_tokens_available */);
34 void FakeAccountReconcilor::GetAccountsFromCookie(
35 GetAccountsFromCookieCallback callback
) {
36 std::vector
<std::pair
<std::string
, bool> > gaia_accounts
;
37 callback
.Run(GoogleServiceAuthError::AuthErrorNone(), gaia_accounts
);