[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / local_discovery / privet_http_asynchronous_factory_mac.cc
blobc268fe9e8ae3dcc959512009acb82bd5256cb156
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.
5 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory_mac.h"
7 #include "chrome/browser/local_discovery/privet_http_impl.h"
9 namespace local_discovery {
11 PrivetHTTPAsynchronousFactoryMac::PrivetHTTPAsynchronousFactoryMac(
12 net::URLRequestContextGetter* request_context)
13 : request_context_(request_context) {}
15 PrivetHTTPAsynchronousFactoryMac::~PrivetHTTPAsynchronousFactoryMac() {}
17 scoped_ptr<PrivetHTTPResolution>
18 PrivetHTTPAsynchronousFactoryMac::CreatePrivetHTTP(
19 const std::string& name,
20 const net::HostPortPair& address,
21 const ResultCallback& callback) {
22 return scoped_ptr<PrivetHTTPResolution>(
23 new ResolutionMac(request_context_, name, address, callback));
26 PrivetHTTPAsynchronousFactoryMac::ResolutionMac::ResolutionMac(
27 net::URLRequestContextGetter* request_context,
28 const std::string& name,
29 const net::HostPortPair& host_port,
30 const ResultCallback& callback)
31 : request_context_(request_context),
32 name_(name),
33 host_port_(host_port),
34 callback_(callback) {}
36 PrivetHTTPAsynchronousFactoryMac::ResolutionMac::~ResolutionMac() {}
38 void PrivetHTTPAsynchronousFactoryMac::ResolutionMac::Start() {
39 callback_.Run(scoped_ptr<PrivetHTTPClient>(
40 new PrivetHTTPClientImpl(name_, host_port_, request_context_)));
43 const std::string& PrivetHTTPAsynchronousFactoryMac::ResolutionMac::GetName() {
44 return name_;
47 } // namespace local_discovery