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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 // static | 60 // static |
61 BrowserContextKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() { | 61 BrowserContextKeyedAPIFactory<MDnsAPI>* MDnsAPI::GetFactoryInstance() { |
62 return g_factory.Pointer(); | 62 return g_factory.Pointer(); |
63 } | 63 } |
64 | 64 |
65 void MDnsAPI::SetDnsSdRegistryForTesting( | 65 void MDnsAPI::SetDnsSdRegistryForTesting( |
66 std::unique_ptr<DnsSdRegistry> dns_sd_registry) { | 66 std::unique_ptr<DnsSdRegistry> dns_sd_registry) { |
67 dns_sd_registry_ = std::move(dns_sd_registry); | 67 dns_sd_registry_ = std::move(dns_sd_registry); |
68 if (dns_sd_registry_.get()) | 68 if (dns_sd_registry_.get()) |
69 dns_sd_registry_.get()->AddObserver(this); | 69 dns_sd_registry_->AddObserver(this); |
70 } | 70 } |
71 | 71 |
72 void MDnsAPI::ForceDiscovery() { | 72 void MDnsAPI::ForceDiscovery() { |
73 DCHECK(thread_checker_.CalledOnValidThread()); | 73 DCHECK(thread_checker_.CalledOnValidThread()); |
74 DnsSdRegistry* registry = dns_sd_registry(); | 74 DnsSdRegistry* registry = dns_sd_registry(); |
75 return registry->ForceDiscovery(); | 75 return registry->ForceDiscovery(); |
76 } | 76 } |
77 | 77 |
78 DnsSdRegistry* MDnsAPI::dns_sd_registry() { | 78 DnsSdRegistry* MDnsAPI::dns_sd_registry() { |
79 DCHECK(thread_checker_.CalledOnValidThread()); | 79 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 AsyncApiFunction::ResponseAction MdnsForceDiscoveryFunction::Run() { | 266 AsyncApiFunction::ResponseAction MdnsForceDiscoveryFunction::Run() { |
267 MDnsAPI* api = MDnsAPI::Get(browser_context()); | 267 MDnsAPI* api = MDnsAPI::Get(browser_context()); |
268 if (!api) { | 268 if (!api) { |
269 return RespondNow(Error("Unknown error.")); | 269 return RespondNow(Error("Unknown error.")); |
270 } | 270 } |
271 api->ForceDiscovery(); | 271 api->ForceDiscovery(); |
272 return RespondNow(NoArguments()); | 272 return RespondNow(NoArguments()); |
273 } | 273 } |
274 | 274 |
275 } // namespace extensions | 275 } // namespace extensions |
OLD | NEW |