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/printing/cloud_print/privet_http_asynchronous_factory_i
mpl.h" |
6 | 6 |
7 #include "chrome/browser/local_discovery/endpoint_resolver.h" | 7 #include "chrome/browser/local_discovery/endpoint_resolver.h" |
8 #include "chrome/browser/local_discovery/privet_http_impl.h" | 8 #include "chrome/browser/printing/cloud_print/privet_http_impl.h" |
9 | 9 |
10 namespace local_discovery { | 10 namespace cloud_print { |
11 | 11 |
12 PrivetHTTPAsynchronousFactoryImpl::PrivetHTTPAsynchronousFactoryImpl( | 12 PrivetHTTPAsynchronousFactoryImpl::PrivetHTTPAsynchronousFactoryImpl( |
13 net::URLRequestContextGetter* request_context) | 13 net::URLRequestContextGetter* request_context) |
14 : request_context_(request_context) { | 14 : request_context_(request_context) { |
15 } | 15 } |
16 | 16 |
17 PrivetHTTPAsynchronousFactoryImpl::~PrivetHTTPAsynchronousFactoryImpl() { | 17 PrivetHTTPAsynchronousFactoryImpl::~PrivetHTTPAsynchronousFactoryImpl() { |
18 } | 18 } |
19 | 19 |
20 scoped_ptr<PrivetHTTPResolution> | 20 scoped_ptr<PrivetHTTPResolution> |
21 PrivetHTTPAsynchronousFactoryImpl::CreatePrivetHTTP( | 21 PrivetHTTPAsynchronousFactoryImpl::CreatePrivetHTTP( |
22 const std::string& service_name) { | 22 const std::string& service_name) { |
23 return scoped_ptr<PrivetHTTPResolution>( | 23 return scoped_ptr<PrivetHTTPResolution>( |
24 new ResolutionImpl(service_name, request_context_.get())); | 24 new ResolutionImpl(service_name, request_context_.get())); |
25 } | 25 } |
26 | 26 |
27 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::ResolutionImpl( | 27 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::ResolutionImpl( |
28 const std::string& service_name, | 28 const std::string& service_name, |
29 net::URLRequestContextGetter* request_context) | 29 net::URLRequestContextGetter* request_context) |
30 : name_(service_name), | 30 : name_(service_name), |
31 request_context_(request_context), | 31 request_context_(request_context), |
32 endpoint_resolver_(new EndpointResolver()) {} | 32 endpoint_resolver_(new local_discovery::EndpointResolver()) {} |
33 | 33 |
34 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::~ResolutionImpl() { | 34 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::~ResolutionImpl() { |
35 } | 35 } |
36 | 36 |
37 const std::string& | 37 const std::string& |
38 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::GetName() { | 38 PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::GetName() { |
39 return name_; | 39 return name_; |
40 } | 40 } |
41 | 41 |
42 void PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::Start( | 42 void PrivetHTTPAsynchronousFactoryImpl::ResolutionImpl::Start( |
(...skipping 15 matching lines...) Expand all Loading... |
58 const ResultCallback& callback, | 58 const ResultCallback& callback, |
59 const net::IPEndPoint& endpoint) { | 59 const net::IPEndPoint& endpoint) { |
60 if (endpoint.address().empty()) | 60 if (endpoint.address().empty()) |
61 return callback.Run(scoped_ptr<PrivetHTTPClient>()); | 61 return callback.Run(scoped_ptr<PrivetHTTPClient>()); |
62 | 62 |
63 net::HostPortPair new_address = net::HostPortPair::FromIPEndPoint(endpoint); | 63 net::HostPortPair new_address = net::HostPortPair::FromIPEndPoint(endpoint); |
64 callback.Run(scoped_ptr<PrivetHTTPClient>( | 64 callback.Run(scoped_ptr<PrivetHTTPClient>( |
65 new PrivetHTTPClientImpl(name_, new_address, request_context_.get()))); | 65 new PrivetHTTPClientImpl(name_, new_address, request_context_.get()))); |
66 } | 66 } |
67 | 67 |
68 } // namespace local_discovery | 68 } // namespace cloud_print |
OLD | NEW |