| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 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 "components/data_reduction_proxy/content/browser/data_reduction_proxy_h
ost_impl.h" |
| 6 |
| 7 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" |
| 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "net/base/host_port_pair.h" |
| 11 |
| 12 namespace data_reduction_proxy { |
| 13 |
| 14 DataReductionProxyHostImpl::DataReductionProxyHostImpl( |
| 15 DataReductionProxyConfig* config, |
| 16 content::RenderProcessHost* host) |
| 17 : config_(config), binding_(this) { |
| 18 // Unit tests may pass nullptr as |host|. |
| 19 if (host) |
| 20 host->AddObserver(this); |
| 21 } |
| 22 |
| 23 DataReductionProxyHostImpl::~DataReductionProxyHostImpl() {} |
| 24 |
| 25 void DataReductionProxyHostImpl::BindRequest( |
| 26 mojom::DataReductionProxyHostRequest request) { |
| 27 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 28 binding_.Bind(std::move(request)); |
| 29 } |
| 30 |
| 31 void DataReductionProxyHostImpl::IsDataReductionProxy( |
| 32 const net::HostPortPair& proxy_server, |
| 33 const IsDataReductionProxyCallback& callback) { |
| 34 if (!config_) { |
| 35 callback.Run(false); |
| 36 return; |
| 37 } |
| 38 |
| 39 callback.Run(config_->IsDataReductionProxy(proxy_server, nullptr)); |
| 40 } |
| 41 |
| 42 void DataReductionProxyHostImpl::RenderProcessHostDestroyed( |
| 43 content::RenderProcessHost* host) { |
| 44 content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, |
| 45 this); |
| 46 } |
| 47 |
| 48 } // namespace data_reduction_proxy |
| OLD | NEW |