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 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 MDnsAPI::~MDnsAPI() { | 39 MDnsAPI::~MDnsAPI() { |
40 if (dns_sd_registry_.get()) { | 40 if (dns_sd_registry_.get()) { |
41 dns_sd_registry_->RemoveObserver(this); | 41 dns_sd_registry_->RemoveObserver(this); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 // static | 45 // static |
46 MDnsAPI* MDnsAPI::Get(content::BrowserContext* context) { | 46 MDnsAPI* MDnsAPI::Get(content::BrowserContext* context) { |
47 return ProfileKeyedAPIFactory<MDnsAPI>::GetForProfile(context); | 47 return BrowserContextKeyedAPIFactory<MDnsAPI>::Get(context); |
48 } | 48 } |
49 | 49 |
50 static base::LazyInstance<ProfileKeyedAPIFactory<MDnsAPI> > g_factory = | 50 static base::LazyInstance<BrowserContextKeyedAPIFactory<MDnsAPI> > g_factory = |
51 LAZY_INSTANCE_INITIALIZER; | 51 LAZY_INSTANCE_INITIALIZER; |
52 | 52 |
53 // static | 53 // static |
54 ProfileKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() { | 54 BrowserContextKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() { |
55 return g_factory.Pointer(); | 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()); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 VLOG(1) << "Broadcasting OnServiceList event: " << event.get(); | 148 VLOG(1) << "Broadcasting OnServiceList event: " << event.get(); |
149 | 149 |
150 // TODO(justinlin): To avoid having listeners without filters getting all | 150 // TODO(justinlin): To avoid having listeners without filters getting all |
151 // events, modify API to have this event require filters. | 151 // events, modify API to have this event require filters. |
152 extensions::ExtensionSystem::Get(browser_context_) | 152 extensions::ExtensionSystem::Get(browser_context_) |
153 ->event_router() | 153 ->event_router() |
154 ->BroadcastEvent(event.Pass()); | 154 ->BroadcastEvent(event.Pass()); |
155 } | 155 } |
156 | 156 |
157 } // namespace extensions | 157 } // namespace extensions |
OLD | NEW |