Chromium Code Reviews| Index: components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc |
| diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..68bb5d46e6e7f6bade6499c6592af938183a09f6 |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2016 The Chromium 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 "components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h" |
| + |
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h" |
| +#include "content/public/browser/browser_thread.h" |
| +#include "net/base/host_port_pair.h" |
| + |
| +namespace data_reduction_proxy { |
| + |
| +// static |
| +void DataReductionProxyHostImpl::Create( |
| + base::WeakPtr<DataReductionProxyConfig> config, |
| + mojom::DataReductionProxyHostRequest request) { |
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| + if (config) { |
| + new data_reduction_proxy::DataReductionProxyHostImpl(config, |
|
dcheng
2016/08/26 19:16:20
Does it make sense to actually call Create if |con
leonhsl(Using Gerrit)
2016/08/29 06:12:06
If we do not AddInterface, ERROR log "Failed to lo
|
| + std::move(request)); |
| + } |
| +} |
| + |
| +DataReductionProxyHostImpl::DataReductionProxyHostImpl( |
| + base::WeakPtr<DataReductionProxyConfig> config, |
| + mojom::DataReductionProxyHostRequest request) |
| + : config_(config), binding_(this, std::move(request)) {} |
| + |
| +DataReductionProxyHostImpl::~DataReductionProxyHostImpl() {} |
| + |
| +void DataReductionProxyHostImpl::IsDataReductionProxy( |
| + const net::HostPortPair& proxy_server, |
| + const IsDataReductionProxyCallback& callback) { |
| + if (!config_) { |
| + callback.Run(false); |
| + return; |
| + } |
| + |
| + callback.Run(config_->IsDataReductionProxy(proxy_server, nullptr)); |
| +} |
| + |
| +} // namespace data_reduction_proxy |