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/extensions/api/networking_private/networking_private_service_client_factory.h"
7 #include "chrome/browser/extensions/api/networking_private/networking_private_service_client.h"
8 #include "chrome/browser/extensions/extension_system_factory.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
11 #include "content/public/browser/browser_thread.h"
13 namespace extensions {
16 NetworkingPrivateServiceClient*
17 NetworkingPrivateServiceClientFactory::GetForProfile(Profile* profile) {
18 return static_cast<NetworkingPrivateServiceClient*>(
19 GetInstance()->GetServiceForBrowserContext(profile, true));
23 NetworkingPrivateServiceClientFactory*
24 NetworkingPrivateServiceClientFactory::GetInstance() {
25 return Singleton<NetworkingPrivateServiceClientFactory>::get();
28 NetworkingPrivateServiceClientFactory::NetworkingPrivateServiceClientFactory()
29 : BrowserContextKeyedServiceFactory(
30 "NetworkingPrivateServiceClient",
31 BrowserContextDependencyManager::GetInstance()) {
32 DependsOn(ExtensionSystemFactory::GetInstance());
35 NetworkingPrivateServiceClientFactory
36 ::~NetworkingPrivateServiceClientFactory() {
39 BrowserContextKeyedService*
40 NetworkingPrivateServiceClientFactory::BuildServiceInstanceFor(
41 content::BrowserContext* profile) const {
42 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
43 return new NetworkingPrivateServiceClient(
44 wifi::WiFiService::Create(),
45 NetworkingPrivateServiceClient::CryptoVerify::Create());
48 bool NetworkingPrivateServiceClientFactory::ServiceIsCreatedWithBrowserContext()
53 bool NetworkingPrivateServiceClientFactory::ServiceIsNULLWhileTesting() const {
57 } // namespace extensions