| // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "update_engine/proxy_resolver.h" |
| namespace chromeos_update_engine { |
| const char kNoProxy[] = "direct://"; |
| DirectProxyResolver::~DirectProxyResolver() { |
| g_source_remove(idle_callback_id_); |
| bool DirectProxyResolver::GetProxiesForUrl(const std::string& url, |
| ProxiesResolvedFn callback, |
| google::protobuf::Closure* closure = |
| google::protobuf::NewCallback(this, |
| &DirectProxyResolver::ReturnCallback, |
| idle_callback_id_ = g_idle_add(utils::GlibRunClosure, closure); |
| void DirectProxyResolver::ReturnCallback(ProxiesResolvedFn callback, |
| // Initialize proxy pool with as many proxies as indicated (all identical). |
| std::deque<std::string> proxies(num_proxies_, kNoProxy); |
| (*callback)(proxies, data); |
| } // namespace chromeos_update_engine |