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

Side by Side Diff: chrome/browser/local_discovery/privet_http_asynchronous_factory_impl.cc

Issue 954883003: Remove privet_http_asynchronous_factory_mac.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wed Feb 25 09:06:16 PST 2015 Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 resolver_ = service_discovery_client_->CreateLocalDomainResolver( 65 resolver_ = service_discovery_client_->CreateLocalDomainResolver(
66 address.host(), address_family, 66 address.host(), address_family,
67 base::Bind(&ResolutionImpl::ResolveComplete, base::Unretained(this))); 67 base::Bind(&ResolutionImpl::ResolveComplete, base::Unretained(this)));
68 } 68 }
69 69
70 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::~ResolutionImpl() { 70 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::~ResolutionImpl() {
71 } 71 }
72 72
73 void PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::Start() { 73 void PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::Start() {
74 #if defined(OS_MACOSX)
75 // MAC already has IP there.
76 callback_.Run(scoped_ptr<PrivetHTTPClient>(
77 new PrivetHTTPClientImpl(name_, hostport_, request_context_.get())));
78 #else
74 resolver_->Start(); 79 resolver_->Start();
80 #endif
75 } 81 }
76 82
77 const std::string& 83 const std::string&
78 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::GetName() { 84 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::GetName() {
79 return name_; 85 return name_;
80 } 86 }
81 87
82 void PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::ResolveComplete( 88 void PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::ResolveComplete(
83 bool success, 89 bool success,
84 const net::IPAddressNumber& address_ipv4, 90 const net::IPAddressNumber& address_ipv4,
85 const net::IPAddressNumber& address_ipv6) { 91 const net::IPAddressNumber& address_ipv6) {
86 if (!success) { 92 if (!success) {
87 callback_.Run(scoped_ptr<PrivetHTTPClient>()); 93 callback_.Run(scoped_ptr<PrivetHTTPClient>());
88 return; 94 return;
89 } 95 }
90 96
91 net::IPAddressNumber address = address_ipv4; 97 net::IPAddressNumber address = address_ipv4;
92 if (address.empty()) 98 if (address.empty())
93 address = address_ipv6; 99 address = address_ipv6;
94 100
95 DCHECK(!address.empty()); 101 DCHECK(!address.empty());
96 102
97 net::HostPortPair new_address = 103 net::HostPortPair new_address =
98 net::HostPortPair(IPAddressToHostString(address), hostport_.port()); 104 net::HostPortPair(IPAddressToHostString(address), hostport_.port());
99 callback_.Run(scoped_ptr<PrivetHTTPClient>( 105 callback_.Run(scoped_ptr<PrivetHTTPClient>(
100 new PrivetHTTPClientImpl(name_, new_address, request_context_.get()))); 106 new PrivetHTTPClientImpl(name_, new_address, request_context_.get())));
101 } 107 }
102 108
103 } // namespace local_discovery 109 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698