| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "extensions/browser/api/dns/dns_api.h" | 5 #include "extensions/browser/api/dns/dns_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 FROM_HERE, | 42 FROM_HERE, |
| 43 base::Bind(&DnsResolveFunction::WorkOnIOThread, this)); | 43 base::Bind(&DnsResolveFunction::WorkOnIOThread, this)); |
| 44 DCHECK(result); | 44 DCHECK(result); |
| 45 return true; | 45 return true; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void DnsResolveFunction::WorkOnIOThread() { | 48 void DnsResolveFunction::WorkOnIOThread() { |
| 49 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 49 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 50 | 50 |
| 51 net::HostResolver* host_resolver = | 51 net::HostResolver* host_resolver = |
| 52 HostResolverWrapper::GetInstance()->GetHostResolver( | 52 HostResolverWrapper::GetInstance()->GetHostResolver(resource_context_); |
| 53 resource_context_->GetHostResolver()); | |
| 54 DCHECK(host_resolver); | 53 DCHECK(host_resolver); |
| 55 | 54 |
| 56 // Yes, we are passing zero as the port. There are some interesting but not | 55 // Yes, we are passing zero as the port. There are some interesting but not |
| 57 // presently relevant reasons why HostResolver asks for the port of the | 56 // presently relevant reasons why HostResolver asks for the port of the |
| 58 // hostname you'd like to resolve, even though it doesn't use that value in | 57 // hostname you'd like to resolve, even though it doesn't use that value in |
| 59 // determining its answer. | 58 // determining its answer. |
| 60 net::HostPortPair host_port_pair(hostname_, 0); | 59 net::HostPortPair host_port_pair(hostname_, 0); |
| 61 | 60 |
| 62 net::HostResolver::RequestInfo request_info(host_port_pair); | 61 net::HostResolver::RequestInfo request_info(host_port_pair); |
| 63 int resolve_result = host_resolver->Resolve( | 62 int resolve_result = host_resolver->Resolve( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 bool post_task_result = BrowserThread::PostTask( | 94 bool post_task_result = BrowserThread::PostTask( |
| 96 BrowserThread::UI, | 95 BrowserThread::UI, |
| 97 FROM_HERE, | 96 FROM_HERE, |
| 98 base::Bind(&DnsResolveFunction::RespondOnUIThread, this)); | 97 base::Bind(&DnsResolveFunction::RespondOnUIThread, this)); |
| 99 DCHECK(post_task_result); | 98 DCHECK(post_task_result); |
| 100 | 99 |
| 101 Release(); // Added in WorkOnIOThread(). | 100 Release(); // Added in WorkOnIOThread(). |
| 102 } | 101 } |
| 103 | 102 |
| 104 } // namespace extensions | 103 } // namespace extensions |
| OLD | NEW |