Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" | |
| 9 #include "content/public/browser/browser_thread.h" | |
| 10 #include "content/public/browser/render_process_host.h" | |
| 11 #include "net/base/host_port_pair.h" | |
| 12 | |
| 13 namespace data_reduction_proxy { | |
| 14 | |
| 15 DataReductionProxyHostImpl::DataReductionProxyHostImpl( | |
| 16 DataReductionProxySettings* settings, | |
| 17 content::RenderProcessHost* host) | |
| 18 : config_(nullptr) { | |
| 19 if (settings) | |
| 20 config_ = settings->Config(); | |
| 21 // Unit tests may pass nullptr as |host|. | |
| 22 if (host) | |
| 23 host->AddObserver(this); | |
| 24 } | |
| 25 | |
| 26 DataReductionProxyHostImpl::~DataReductionProxyHostImpl() {} | |
| 27 | |
| 28 void DataReductionProxyHostImpl::BindRequest( | |
| 29 mojom::DataReductionProxyHostRequest request) { | |
| 30 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | |
| 31 bindings_.AddBinding(this, std::move(request)); | |
| 32 } | |
| 33 | |
| 34 void DataReductionProxyHostImpl::IsDataReductionProxy( | |
| 35 const net::HostPortPair& proxy_server, | |
| 36 const IsDataReductionProxyCallback& callback) { | |
| 37 if (!config_) { | |
|
tbansal1
2016/07/13 17:35:18
Add DCHECK_CURRENTLY_ON(content::BrowserThread::IO
leonhsl(Using Gerrit)
2016/07/14 14:54:53
Tried to add in ps#21 but found DataReductionProxy
| |
| 38 callback.Run(false); | |
| 39 return; | |
| 40 } | |
| 41 | |
| 42 callback.Run(config_->IsDataReductionProxy(proxy_server, nullptr)); | |
| 43 } | |
| 44 | |
| 45 void DataReductionProxyHostImpl::RenderProcessExited( | |
| 46 content::RenderProcessHost* host, | |
| 47 base::TerminationStatus status, | |
| 48 int exit_code) { | |
| 49 host->RemoveObserver(this); | |
| 50 content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, | |
| 51 this); | |
| 52 } | |
| 53 | |
| 54 } // namespace data_reduction_proxy | |
| OLD | NEW |