Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / api / networking_private / networking_private_service_client_factory.cc
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_service_client.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
10 #include "content/public/browser/browser_thread.h"
11 #include "extensions/browser/extension_system_provider.h"
12 #include "extensions/browser/extensions_browser_client.h"
13
14 namespace extensions {
15
16 // static
17 NetworkingPrivateServiceClient*
18   NetworkingPrivateServiceClientFactory::GetForProfile(Profile* profile) {
19   return static_cast<NetworkingPrivateServiceClient*>(
20       GetInstance()->GetServiceForBrowserContext(profile, true));
21 }
22
23 // static
24 NetworkingPrivateServiceClientFactory*
25     NetworkingPrivateServiceClientFactory::GetInstance() {
26   return Singleton<NetworkingPrivateServiceClientFactory>::get();
27 }
28
29 NetworkingPrivateServiceClientFactory::NetworkingPrivateServiceClientFactory()
30     : BrowserContextKeyedServiceFactory(
31         "NetworkingPrivateServiceClient",
32         BrowserContextDependencyManager::GetInstance()) {
33   DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
34 }
35
36 NetworkingPrivateServiceClientFactory
37     ::~NetworkingPrivateServiceClientFactory() {
38 }
39
40 BrowserContextKeyedService*
41     NetworkingPrivateServiceClientFactory::BuildServiceInstanceFor(
42         content::BrowserContext* profile) const {
43   DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
44   return new NetworkingPrivateServiceClient(
45       wifi::WiFiService::Create(),
46       NetworkingPrivateServiceClient::CryptoVerify::Create());
47 }
48
49 bool NetworkingPrivateServiceClientFactory::ServiceIsCreatedWithBrowserContext()
50     const {
51   return false;
52 }
53
54 bool NetworkingPrivateServiceClientFactory::ServiceIsNULLWhileTesting() const {
55   return false;
56 }
57
58 }  // namespace extensions