1 // Copyright 2013 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/network_time/network_time_service_factory.h"
7 #include "chrome/browser/network_time/network_time_service.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
11 NetworkTimeServiceFactory::NetworkTimeServiceFactory()
12 : BrowserContextKeyedServiceFactory(
14 BrowserContextDependencyManager::GetInstance()) {
17 NetworkTimeServiceFactory::~NetworkTimeServiceFactory() {
21 NetworkTimeServiceFactory
* NetworkTimeServiceFactory::GetInstance() {
22 return Singleton
<NetworkTimeServiceFactory
>::get();
26 NetworkTimeService
* NetworkTimeServiceFactory::GetForProfile(
28 return static_cast<NetworkTimeService
*>(
29 GetInstance()->GetServiceForBrowserContext(profile
, true));
32 content::BrowserContext
* NetworkTimeServiceFactory::GetBrowserContextToUse(
33 content::BrowserContext
* context
) const {
34 return chrome::GetBrowserContextRedirectedInIncognito(context
);
37 BrowserContextKeyedService
*
38 NetworkTimeServiceFactory::BuildServiceInstanceFor(
39 content::BrowserContext
* context
) const {
40 return new NetworkTimeService(static_cast<Profile
*>(context
));