OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/dns/dns_api.h" | 5 #include "chrome/browser/extensions/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 "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/api/dns/host_resolver_wrapper.h" | 10 #include "chrome/browser/extensions/api/dns/host_resolver_wrapper.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 void DnsResolveFunction::OnLookupFinished(int resolve_result) { | 79 void DnsResolveFunction::OnLookupFinished(int resolve_result) { |
80 scoped_ptr<ResolveCallbackResolveInfo> resolve_info( | 80 scoped_ptr<ResolveCallbackResolveInfo> resolve_info( |
81 new ResolveCallbackResolveInfo()); | 81 new ResolveCallbackResolveInfo()); |
82 resolve_info->result_code = resolve_result; | 82 resolve_info->result_code = resolve_result; |
83 if (resolve_result == net::OK) { | 83 if (resolve_result == net::OK) { |
84 DCHECK(!addresses_->empty()); | 84 DCHECK(!addresses_->empty()); |
85 resolve_info->address.reset( | 85 resolve_info->address.reset( |
86 new std::string(addresses_->front().ToStringWithoutPort())); | 86 new std::string(addresses_->front().ToStringWithoutPort())); |
87 } | 87 } |
88 result_.reset(Resolve::Result::Create(*resolve_info)); | 88 SetResult(Resolve::Result::Create(*resolve_info)); |
89 response_ = true; | 89 response_ = true; |
90 | 90 |
91 bool post_task_result = BrowserThread::PostTask( | 91 bool post_task_result = BrowserThread::PostTask( |
92 BrowserThread::UI, FROM_HERE, | 92 BrowserThread::UI, FROM_HERE, |
93 base::Bind(&DnsResolveFunction::RespondOnUIThread, this)); | 93 base::Bind(&DnsResolveFunction::RespondOnUIThread, this)); |
94 DCHECK(post_task_result); | 94 DCHECK(post_task_result); |
95 | 95 |
96 Release(); // Added in WorkOnIOThread(). | 96 Release(); // Added in WorkOnIOThread(). |
97 } | 97 } |
98 | 98 |
99 } // namespace extensions | 99 } // namespace extensions |
OLD | NEW |