c9b7304dc4d55a44258939fdee9343e96d3d7117
[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/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"
12
13 namespace extensions {
14
15 // static
16 NetworkingPrivateServiceClient*
17   NetworkingPrivateServiceClientFactory::GetForProfile(Profile* profile) {
18   return static_cast<NetworkingPrivateServiceClient*>(
19       GetInstance()->GetServiceForBrowserContext(profile, true));
20 }
21
22 // static
23 NetworkingPrivateServiceClientFactory*
24     NetworkingPrivateServiceClientFactory::GetInstance() {
25   return Singleton<NetworkingPrivateServiceClientFactory>::get();
26 }
27
28 NetworkingPrivateServiceClientFactory::NetworkingPrivateServiceClientFactory()
29     : BrowserContextKeyedServiceFactory(
30         "NetworkingPrivateServiceClient",
31         BrowserContextDependencyManager::GetInstance()) {
32   DependsOn(ExtensionSystemFactory::GetInstance());
33 }
34
35 NetworkingPrivateServiceClientFactory
36     ::~NetworkingPrivateServiceClientFactory() {
37 }
38
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());
46 }
47
48 bool NetworkingPrivateServiceClientFactory::ServiceIsCreatedWithBrowserContext()
49     const {
50   return false;
51 }
52
53 bool NetworkingPrivateServiceClientFactory::ServiceIsNULLWhileTesting() const {
54   return false;
55 }
56
57 }  // namespace extensions