| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "chrome/browser/network_time/network_time_service_factory.h" | |
| 6 | |
| 7 #include "chrome/browser/network_time/network_time_service.h" | |
| 8 #include "chrome/browser/profiles/incognito_helpers.h" | |
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 10 | |
| 11 NetworkTimeServiceFactory::NetworkTimeServiceFactory() | |
| 12 : BrowserContextKeyedServiceFactory( | |
| 13 "NetworkTimeService", | |
| 14 BrowserContextDependencyManager::GetInstance()) { | |
| 15 } | |
| 16 | |
| 17 NetworkTimeServiceFactory::~NetworkTimeServiceFactory() { | |
| 18 } | |
| 19 | |
| 20 // static | |
| 21 NetworkTimeServiceFactory* NetworkTimeServiceFactory::GetInstance() { | |
| 22 return Singleton<NetworkTimeServiceFactory>::get(); | |
| 23 } | |
| 24 | |
| 25 // static | |
| 26 NetworkTimeService* NetworkTimeServiceFactory::GetForProfile( | |
| 27 Profile* profile) { | |
| 28 return static_cast<NetworkTimeService*>( | |
| 29 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 30 } | |
| 31 | |
| 32 content::BrowserContext* NetworkTimeServiceFactory::GetBrowserContextToUse( | |
| 33 content::BrowserContext* context) const { | |
| 34 return chrome::GetBrowserContextRedirectedInIncognito(context); | |
| 35 } | |
| 36 | |
| 37 KeyedService* NetworkTimeServiceFactory::BuildServiceInstanceFor( | |
| 38 content::BrowserContext* context) const { | |
| 39 return new NetworkTimeService(static_cast<Profile*>(context)); | |
| 40 } | |
| OLD | NEW |