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"
17 // This file is a dummy stub for use in appshell.
20 VpnService
* VpnServiceFactory::GetForBrowserContext(
21 content::BrowserContext
* context
) {
22 return static_cast<VpnService
*>(
23 GetInstance()->GetServiceForBrowserContext(context
, true));
27 VpnServiceFactory
* VpnServiceFactory::GetInstance() {
28 return Singleton
<VpnServiceFactory
>::get();
31 VpnServiceFactory::VpnServiceFactory()
32 : BrowserContextKeyedServiceFactory(
34 BrowserContextDependencyManager::GetInstance()) {
37 VpnServiceFactory::~VpnServiceFactory() {
40 bool VpnServiceFactory::ServiceIsCreatedWithBrowserContext() const {
44 bool VpnServiceFactory::ServiceIsNULLWhileTesting() const {
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