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 "chrome/browser/local_discovery/privet_http_asynchronous_factory_impl.h
" | 5 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory_impl.h
" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/local_discovery/privet_http_impl.h" | 10 #include "chrome/browser/local_discovery/privet_http_impl.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 const net::HostPortPair& address, | 55 const net::HostPortPair& address, |
56 const ResultCallback& callback, | 56 const ResultCallback& callback, |
57 ServiceDiscoveryClient* service_discovery_client, | 57 ServiceDiscoveryClient* service_discovery_client, |
58 net::URLRequestContextGetter* request_context) | 58 net::URLRequestContextGetter* request_context) |
59 : name_(name), | 59 : name_(name), |
60 hostport_(address), | 60 hostport_(address), |
61 callback_(callback), | 61 callback_(callback), |
62 request_context_(request_context) { | 62 request_context_(request_context) { |
63 net::AddressFamily address_family = net::ADDRESS_FAMILY_UNSPECIFIED; | 63 net::AddressFamily address_family = net::ADDRESS_FAMILY_UNSPECIFIED; |
64 | 64 |
65 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kPrivetIPv6Only)) { | 65 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 66 switches::kPrivetIPv6Only)) { |
66 address_family = net::ADDRESS_FAMILY_IPV6; | 67 address_family = net::ADDRESS_FAMILY_IPV6; |
67 } | 68 } |
68 | 69 |
69 resolver_ = service_discovery_client->CreateLocalDomainResolver( | 70 resolver_ = service_discovery_client->CreateLocalDomainResolver( |
70 address.host(), | 71 address.host(), |
71 address_family, | 72 address_family, |
72 base::Bind(&ResolutionImpl::ResolveComplete, base::Unretained(this))); | 73 base::Bind(&ResolutionImpl::ResolveComplete, base::Unretained(this))); |
73 } | 74 } |
74 | 75 |
75 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::~ResolutionImpl() { | 76 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::~ResolutionImpl() { |
(...skipping 23 matching lines...) Expand all Loading... |
99 | 100 |
100 DCHECK(!address.empty()); | 101 DCHECK(!address.empty()); |
101 | 102 |
102 net::HostPortPair new_address = | 103 net::HostPortPair new_address = |
103 net::HostPortPair(IPAddressToHostString(address), hostport_.port()); | 104 net::HostPortPair(IPAddressToHostString(address), hostport_.port()); |
104 callback_.Run(scoped_ptr<PrivetHTTPClient>( | 105 callback_.Run(scoped_ptr<PrivetHTTPClient>( |
105 new PrivetHTTPClientImpl(name_, new_address, request_context_.get()))); | 106 new PrivetHTTPClientImpl(name_, new_address, request_context_.get()))); |
106 } | 107 } |
107 | 108 |
108 } // namespace local_discovery | 109 } // namespace local_discovery |
OLD | NEW |