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

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

Issue 320683002: Extracted PrivetV1HTTPClient with Privet v1 specific operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
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 13 matching lines...) Expand all
24 24
25 return address_str; 25 return address_str;
26 } 26 }
27 27
28 } // namespace 28 } // namespace
29 29
30 PrivetHTTPAsynchronousFactoryImpl::PrivetHTTPAsynchronousFactoryImpl( 30 PrivetHTTPAsynchronousFactoryImpl::PrivetHTTPAsynchronousFactoryImpl(
31 ServiceDiscoveryClient* service_discovery_client, 31 ServiceDiscoveryClient* service_discovery_client,
32 net::URLRequestContextGetter* request_context) 32 net::URLRequestContextGetter* request_context)
33 : service_discovery_client_(service_discovery_client), 33 : service_discovery_client_(service_discovery_client),
34 request_context_(request_context) {} 34 request_context_(request_context) {
35 }
35 36
36 PrivetHTTPAsynchronousFactoryImpl::~PrivetHTTPAsynchronousFactoryImpl() {} 37 PrivetHTTPAsynchronousFactoryImpl::~PrivetHTTPAsynchronousFactoryImpl() {
38 }
37 39
38 scoped_ptr<PrivetHTTPResolution> 40 scoped_ptr<PrivetHTTPResolution>
39 PrivetHTTPAsynchronousFactoryImpl::CreatePrivetHTTP( 41 PrivetHTTPAsynchronousFactoryImpl::CreatePrivetHTTP(
40 const std::string& name, 42 const std::string& name,
41 const net::HostPortPair& address, 43 const net::HostPortPair& address,
42 const ResultCallback& callback) { 44 const ResultCallback& callback) {
43 return scoped_ptr<PrivetHTTPResolution>( 45 return scoped_ptr<PrivetHTTPResolution>(
44 new ResolutionImpl(name, 46 new ResolutionImpl(name,
45 address, 47 address,
46 callback, 48 callback,
(...skipping 16 matching lines...) Expand all
63 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kPrivetIPv6Only)) { 65 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kPrivetIPv6Only)) {
64 address_family = net::ADDRESS_FAMILY_IPV6; 66 address_family = net::ADDRESS_FAMILY_IPV6;
65 } 67 }
66 68
67 resolver_ = service_discovery_client->CreateLocalDomainResolver( 69 resolver_ = service_discovery_client->CreateLocalDomainResolver(
68 address.host(), 70 address.host(),
69 address_family, 71 address_family,
70 base::Bind(&ResolutionImpl::ResolveComplete, base::Unretained(this))); 72 base::Bind(&ResolutionImpl::ResolveComplete, base::Unretained(this)));
71 } 73 }
72 74
73 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::~ResolutionImpl() {} 75 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::~ResolutionImpl() {
76 }
74 77
75 void PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::Start() { 78 void PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::Start() {
76 resolver_->Start(); 79 resolver_->Start();
77 } 80 }
78 81
79 const std::string& 82 const std::string&
80 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::GetName() { 83 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::GetName() {
81 return name_; 84 return name_;
82 } 85 }
83 86
(...skipping 12 matching lines...) Expand all
96 99
97 DCHECK(!address.empty()); 100 DCHECK(!address.empty());
98 101
99 net::HostPortPair new_address = 102 net::HostPortPair new_address =
100 net::HostPortPair(IPAddressToHostString(address), hostport_.port()); 103 net::HostPortPair(IPAddressToHostString(address), hostport_.port());
101 callback_.Run(scoped_ptr<PrivetHTTPClient>( 104 callback_.Run(scoped_ptr<PrivetHTTPClient>(
102 new PrivetHTTPClientImpl(name_, new_address, request_context_.get()))); 105 new PrivetHTTPClientImpl(name_, new_address, request_context_.get())));
103 } 106 }
104 107
105 } // namespace local_discovery 108 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698