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..6072248626d998ce6dc86067342bc6d2c99623b5 |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2015 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" |
| +#include "content/public/browser/browser_thread.h" |
| +#include "net/base/host_port_pair.h" |
| + |
| +namespace data_reduction_proxy { |
| + |
| +// static |
| +void DataReductionProxyHostImpl::Create( |
| + DataReductionProxySettings* settings, |
| + mojom::DataReductionProxyHostRequest request) { |
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| + new data_reduction_proxy::DataReductionProxyHostImpl(settings, |
| + std::move(request)); |
| +} |
| + |
| +DataReductionProxyHostImpl::DataReductionProxyHostImpl( |
| + DataReductionProxySettings* settings, |
| + mojom::DataReductionProxyHostRequest request) |
| + : config_(nullptr), binding_(this, std::move(request)) { |
| + if (settings) |
| + config_ = settings->Config(); |
|
Sam McNally
2016/06/20 04:57:26
DataReductionProxySettings can only be used on the
leonhsl(Using Gerrit)
2016/06/20 10:51:51
Oh yes, we can pass settings->Config() instead of
leonhsl(Using Gerrit)
2016/06/23 07:16:37
Done.
|
| +} |
| + |
| +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 |