Home | History | Annotate | Download | only in local_discovery
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory_mac.h"
      6 
      7 #include "chrome/browser/local_discovery/privet_http_impl.h"
      8 
      9 namespace local_discovery {
     10 
     11 PrivetHTTPAsynchronousFactoryMac::PrivetHTTPAsynchronousFactoryMac(
     12     net::URLRequestContextGetter* request_context)
     13     : request_context_(request_context) {
     14 }
     15 
     16 PrivetHTTPAsynchronousFactoryMac::~PrivetHTTPAsynchronousFactoryMac() {
     17 }
     18 
     19 scoped_ptr<PrivetHTTPResolution>
     20 PrivetHTTPAsynchronousFactoryMac::CreatePrivetHTTP(
     21     const std::string& name,
     22     const net::HostPortPair& address,
     23     const ResultCallback& callback) {
     24   return scoped_ptr<PrivetHTTPResolution>(
     25       new ResolutionMac(request_context_, name, address, callback));
     26 }
     27 
     28 PrivetHTTPAsynchronousFactoryMac::ResolutionMac::ResolutionMac(
     29     net::URLRequestContextGetter* request_context,
     30     const std::string& name,
     31     const net::HostPortPair& host_port,
     32     const ResultCallback& callback)
     33     : request_context_(request_context),
     34       name_(name),
     35       host_port_(host_port),
     36       callback_(callback) {
     37 }
     38 
     39 PrivetHTTPAsynchronousFactoryMac::ResolutionMac::~ResolutionMac() {
     40 }
     41 
     42 void PrivetHTTPAsynchronousFactoryMac::ResolutionMac::Start() {
     43   callback_.Run(scoped_ptr<PrivetHTTPClient>(
     44       new PrivetHTTPClientImpl(name_, host_port_, request_context_)));
     45 }
     46 
     47 const std::string& PrivetHTTPAsynchronousFactoryMac::ResolutionMac::GetName() {
     48   return name_;
     49 }
     50 
     51 }  // namespace local_discovery
     52