Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / shell / browser / api / vpn_provider / vpn_service_factory.cc
blob167f5ec965fd4142bc77bcf69ee95c3790c5f51c
1 // Copyright 2014 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 "extensions/browser/api/vpn_provider/vpn_service_factory.h"
7 #include "base/memory/singleton.h"
8 #include "chromeos/dbus/dbus_thread_manager.h"
9 #include "chromeos/network/network_handler.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "extensions/browser/api/vpn_provider/vpn_service.h"
12 #include "extensions/browser/event_router.h"
13 #include "extensions/browser/extension_registry.h"
15 namespace chromeos {
17 // This file is a dummy stub for use in appshell.
19 // static
20 VpnService* VpnServiceFactory::GetForBrowserContext(
21 content::BrowserContext* context) {
22 return static_cast<VpnService*>(
23 GetInstance()->GetServiceForBrowserContext(context, true));
26 // static
27 VpnServiceFactory* VpnServiceFactory::GetInstance() {
28 return base::Singleton<VpnServiceFactory>::get();
31 VpnServiceFactory::VpnServiceFactory()
32 : BrowserContextKeyedServiceFactory(
33 "VpnService",
34 BrowserContextDependencyManager::GetInstance()) {
37 VpnServiceFactory::~VpnServiceFactory() {
40 bool VpnServiceFactory::ServiceIsCreatedWithBrowserContext() const {
41 return true;
44 bool VpnServiceFactory::ServiceIsNULLWhileTesting() const {
45 return true;
48 KeyedService* VpnServiceFactory::BuildServiceInstanceFor(
49 content::BrowserContext* context) const {
50 return new VpnService(
51 context, "testuser", extensions::ExtensionRegistry::Get(context),
52 extensions::EventRouter::Get(context),
53 DBusThreadManager::Get()->GetShillThirdPartyVpnDriverClient(),
54 NetworkHandler::Get()->network_configuration_handler(),
55 NetworkHandler::Get()->network_profile_handler(),
56 NetworkHandler::Get()->network_state_handler());
59 } // namespace chromeos