Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: chrome/browser/extensions/api/dns/dns_api.cc

Issue 10537017: Allow hostnames in socket.connect(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Set 1 Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/dns/dns_api.cc
diff --git a/chrome/browser/extensions/api/dns/dns_api.cc b/chrome/browser/extensions/api/dns/dns_api.cc
index ccfa2ca5321c6141a480833629db8387006853f6..063873adfe6b2e2ad5b1fab09bc16b44f77ccbc9 100644
--- a/chrome/browser/extensions/api/dns/dns_api.cc
+++ b/chrome/browser/extensions/api/dns/dns_api.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/extensions/api/dns/host_resolver_wrapper.h"
#include "chrome/browser/io_thread.h"
#include "chrome/common/extensions/api/experimental_dns.h"
#include "content/public/browser/browser_thread.h"
@@ -21,15 +22,6 @@ namespace Resolve = extensions::api::experimental_dns::Resolve;
namespace extensions {
-namespace {
-
-// If null, then we'll use io_thread_ to obtain the real HostResolver. We use
-// a plain pointer for to be consistent with the ownership model of the real
-// one.
-net::HostResolver* g_host_resolver_for_testing = NULL;
-
-} // namespace
-
DnsResolveFunction::DnsResolveFunction()
: response_(false),
io_thread_(g_browser_process->io_thread()),
@@ -37,12 +29,6 @@ DnsResolveFunction::DnsResolveFunction()
addresses_(new net::AddressList) {
}
-// static
-void DnsResolveFunction::set_host_resolver_for_testing(
- net::HostResolver* host_resolver_for_testing_param) {
- g_host_resolver_for_testing = host_resolver_for_testing_param;
-}
-
DnsResolveFunction::~DnsResolveFunction() {}
bool DnsResolveFunction::RunImpl() {
@@ -61,8 +47,9 @@ bool DnsResolveFunction::RunImpl() {
void DnsResolveFunction::WorkOnIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- net::HostResolver* host_resolver = g_host_resolver_for_testing ?
- g_host_resolver_for_testing : io_thread_->globals()->host_resolver.get();
+ net::HostResolver* host_resolver =
+ HostResolverWrapper::GetInstance()->GetHostResolver(
+ io_thread_->globals()->host_resolver.get());
DCHECK(host_resolver);
// Yes, we are passing zero as the port. There are some interesting but not

Powered by Google App Engine
This is Rietveld 408576698