[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / signin / signin_tracker_factory.cc
blob5b1febc92885436dfe23f7f933aa6badd9700e37
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/signin_tracker_factory.h"
7 #include "chrome/browser/signin/account_reconcilor_factory.h"
8 #include "chrome/browser/signin/chrome_signin_client_factory.h"
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
10 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "components/signin/core/common/profile_management_switches.h"
13 SigninTrackerFactory::SigninTrackerFactory() {}
14 SigninTrackerFactory::~SigninTrackerFactory() {}
16 // static
17 scoped_ptr<SigninTracker> SigninTrackerFactory::CreateForProfile(
18 Profile* profile,
19 SigninTracker::Observer* observer) {
20 // Determine whether to use the AccountReconcilor.
21 AccountReconcilor* account_reconcilor = NULL;
22 if (!switches::IsEnableWebBasedSignin() && switches::IsNewProfileManagement())
23 account_reconcilor = AccountReconcilorFactory::GetForProfile(profile);
25 return scoped_ptr<SigninTracker>(new SigninTracker(
26 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
27 SigninManagerFactory::GetForProfile(profile),
28 account_reconcilor,
29 ChromeSigninClientFactory::GetForProfile(profile),
30 observer));