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/extensions/api/networking_private/networking_private_service_client_factory.h"
6
7#include "chrome/browser/extensions/api/networking_private/networking_private_delegate.h"
8#include "chrome/browser/extensions/api/networking_private/networking_private_service_client.h"
9#include "components/keyed_service/content/browser_context_dependency_manager.h"
10#include "content/public/browser/browser_thread.h"
11
12namespace extensions {
13
14// static
15NetworkingPrivateDelegate* NetworkingPrivateDelegate::GetForBrowserContext(
16    content::BrowserContext* browser_context) {
17  return NetworkingPrivateServiceClientFactory::GetForBrowserContext(
18      browser_context);
19}
20
21// static
22NetworkingPrivateServiceClient*
23NetworkingPrivateServiceClientFactory::GetForBrowserContext(
24    content::BrowserContext* browser_context) {
25  return static_cast<NetworkingPrivateServiceClient*>(
26      GetInstance()->GetServiceForBrowserContext(browser_context, true));
27}
28
29// static
30NetworkingPrivateServiceClientFactory*
31    NetworkingPrivateServiceClientFactory::GetInstance() {
32  return Singleton<NetworkingPrivateServiceClientFactory>::get();
33}
34
35NetworkingPrivateServiceClientFactory::NetworkingPrivateServiceClientFactory()
36    : BrowserContextKeyedServiceFactory(
37        "NetworkingPrivateServiceClient",
38        BrowserContextDependencyManager::GetInstance()) {
39}
40
41NetworkingPrivateServiceClientFactory
42    ::~NetworkingPrivateServiceClientFactory() {
43}
44
45KeyedService* NetworkingPrivateServiceClientFactory::BuildServiceInstanceFor(
46    content::BrowserContext* browser_context) const {
47  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
48  return new NetworkingPrivateServiceClient(
49      wifi::WiFiService::Create(),
50      NetworkingPrivateServiceClient::CryptoVerify::Create());
51}
52
53bool NetworkingPrivateServiceClientFactory::ServiceIsCreatedWithBrowserContext()
54    const {
55  return false;
56}
57
58bool NetworkingPrivateServiceClientFactory::ServiceIsNULLWhileTesting() const {
59  return false;
60}
61
62}  // namespace extensions
63