| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/mdns/mdns_api.h" | 5 #include "chrome/browser/extensions/api/mdns/mdns_api.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // static | 45 // static |
| 46 MDnsAPI* MDnsAPI::Get(Profile* profile) { | 46 MDnsAPI* MDnsAPI::Get(Profile* profile) { |
| 47 return ProfileKeyedAPIFactory<MDnsAPI>::GetForProfile(profile); | 47 return ProfileKeyedAPIFactory<MDnsAPI>::GetForProfile(profile); |
| 48 } | 48 } |
| 49 | 49 |
| 50 static base::LazyInstance<ProfileKeyedAPIFactory<MDnsAPI> > g_factory = | 50 static base::LazyInstance<ProfileKeyedAPIFactory<MDnsAPI> > g_factory = |
| 51 LAZY_INSTANCE_INITIALIZER; | 51 LAZY_INSTANCE_INITIALIZER; |
| 52 | 52 |
| 53 // static | 53 // static |
| 54 ProfileKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() { | 54 ProfileKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() { |
| 55 return &g_factory.Get(); | 55 return g_factory.Pointer(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void MDnsAPI::SetDnsSdRegistryForTesting( | 58 void MDnsAPI::SetDnsSdRegistryForTesting( |
| 59 scoped_ptr<DnsSdRegistry> dns_sd_registry) { | 59 scoped_ptr<DnsSdRegistry> dns_sd_registry) { |
| 60 dns_sd_registry_ = dns_sd_registry.Pass(); | 60 dns_sd_registry_ = dns_sd_registry.Pass(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 DnsSdRegistry* MDnsAPI::dns_sd_registry() { | 63 DnsSdRegistry* MDnsAPI::dns_sd_registry() { |
| 64 DCHECK(thread_checker_.CalledOnValidThread()); | 64 DCHECK(thread_checker_.CalledOnValidThread()); |
| 65 if (!dns_sd_registry_.get()) { | 65 if (!dns_sd_registry_.get()) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 event->restrict_to_browser_context = profile_; | 146 event->restrict_to_browser_context = profile_; |
| 147 event->filter_info.SetServiceType(service_type); | 147 event->filter_info.SetServiceType(service_type); |
| 148 | 148 |
| 149 // TODO(justinlin): To avoid having listeners without filters getting all | 149 // TODO(justinlin): To avoid having listeners without filters getting all |
| 150 // events, modify API to have this event require filters. | 150 // events, modify API to have this event require filters. |
| 151 extensions::ExtensionSystem::Get(profile_)->event_router()-> | 151 extensions::ExtensionSystem::Get(profile_)->event_router()-> |
| 152 BroadcastEvent(event.Pass()); | 152 BroadcastEvent(event.Pass()); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace extensions | 155 } // namespace extensions |
| OLD | NEW |