Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc

Issue 2063683002: Migrate components/data_reduction_proxy to Mojo interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698