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. 4 5 #include "extensions/browser/api/dns/host_resolver_wrapper.h" 6 7 #include "content/public/browser/resource_context.h" 8 #include "net/dns/host_resolver.h" 9 10 namespace extensions { 11 HostResolverWrapper()12HostResolverWrapper::HostResolverWrapper() : resolver_(NULL) {} 13 14 // static GetInstance()15HostResolverWrapper* HostResolverWrapper::GetInstance() { 16 return Singleton<extensions::HostResolverWrapper>::get(); 17 } 18 GetHostResolver(content::ResourceContext * context)19net::HostResolver* HostResolverWrapper::GetHostResolver( 20 content::ResourceContext* context) { 21 return resolver_ ? resolver_ : context->GetHostResolver(); 22 } 23 SetHostResolverForTesting(net::HostResolver * mock_resolver)24void HostResolverWrapper::SetHostResolverForTesting( 25 net::HostResolver* mock_resolver) { 26 resolver_ = mock_resolver; 27 } 28 29 } // namespace extensions 30