Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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/mdns/mdns_api_factory.h" | |
| 6 | |
| 7 #include "chrome/browser/extensions/api/mdns/mdns_api.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_ma nager.h" | |
| 11 | |
| 12 // TODO(justinlin): Instead my NsdRegistry the LazyInstance. | |
| 13 // TODO(justinlin): Just need somehow to access profile to dispatch events. | |
| 14 | |
| 15 namespace extensions { | |
| 16 | |
| 17 // static | |
| 18 MDnsAPI* MDnsAPIFactory::GetForProfile(Profile* profile) { | |
|
mark a. foltz
2013/08/23 23:27:23
I wonder if profile can be const Profile* in these
| |
| 19 return static_cast<MDnsAPI*>( | |
| 20 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 21 } | |
| 22 | |
| 23 // static | |
| 24 MDnsAPIFactory* MDnsAPIFactory::GetInstance() { | |
| 25 return Singleton<MDnsAPIFactory>::get(); | |
| 26 } | |
| 27 | |
| 28 MDnsAPIFactory::MDnsAPIFactory() : BrowserContextKeyedServiceFactory( | |
| 29 "MDnsAPI", BrowserContextDependencyManager::GetInstance()) { | |
| 30 DependsOn(ExtensionSystemFactory::GetInstance()); | |
| 31 } | |
| 32 | |
| 33 MDnsAPIFactory::~MDnsAPIFactory() { | |
| 34 } | |
| 35 | |
| 36 BrowserContextKeyedService *MDnsAPIFactory::BuildServiceInstanceFor( | |
| 37 content::BrowserContext* profile) const { | |
| 38 return new MDnsAPI(static_cast<Profile*>(profile)); | |
| 39 } | |
| 40 | |
| 41 bool MDnsAPIFactory::ServiceIsCreatedWithBrowserContext() const { | |
| 42 return true; | |
| 43 } | |
| 44 | |
| 45 bool MDnsAPIFactory::ServiceIsNULLWhileTesting() const { | |
| 46 return true; | |
| 47 } | |
| 48 | |
| 49 } // namespace extensions | |
| OLD | NEW |