Upstream version 7.36.149.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/keyed_service/content/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 KeyedService* NetworkingPrivateServiceClientFactory::BuildServiceInstanceFor(
41     content::BrowserContext* profile) const {
42   DCHECK_CURRENTLY_ON(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