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

Side by Side Diff: components/cronet/android/cronet_data_reduction_proxy.cc

Issue 1238043005: Use new API of DataReductionProxyService. Fixes CroNet build break. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/cronet/android/cronet_data_reduction_proxy.h" 5 #include "components/cronet/android/cronet_data_reduction_proxy.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/prefs/pref_service_factory.h" 11 #include "base/prefs/pref_service_factory.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "components/cronet/android/cronet_in_memory_pref_store.h" 13 #include "components/cronet/android/cronet_in_memory_pref_store.h"
14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h"
15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h"
16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw ork_delegate.h" 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw ork_delegate.h"
17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h"
18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ est_options.h" 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ est_options.h"
19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h" 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h"
20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" 20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h"
21 #include "components/data_reduction_proxy/core/browser/data_store.h"
21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 22 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
22 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h" 23 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h"
23 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
24 #include "net/url_request/url_request_interceptor.h" 25 #include "net/url_request/url_request_interceptor.h"
25 26
26 namespace cronet { 27 namespace cronet {
27 namespace { 28 namespace {
28 29
29 scoped_ptr<PrefService> CreatePrefService() { 30 scoped_ptr<PrefService> CreatePrefService() {
30 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple()); 31 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 scoped_ptr<net::URLRequestInterceptor> 103 scoped_ptr<net::URLRequestInterceptor>
103 CronetDataReductionProxy::CreateInterceptor() { 104 CronetDataReductionProxy::CreateInterceptor() {
104 return io_data_->CreateInterceptor(); 105 return io_data_->CreateInterceptor();
105 } 106 }
106 107
107 void CronetDataReductionProxy::Init(bool enable, 108 void CronetDataReductionProxy::Init(bool enable,
108 net::URLRequestContext* context) { 109 net::URLRequestContext* context) {
109 url_request_context_getter_ = 110 url_request_context_getter_ =
110 new net::TrivialURLRequestContextGetter( 111 new net::TrivialURLRequestContextGetter(
111 context, task_runner_); 112 context, task_runner_);
112 scoped_ptr<data_reduction_proxy::DataReductionProxyCompressionStats>
113 compression_stats(
114 new data_reduction_proxy::DataReductionProxyCompressionStats(
115 prefs_.get(), task_runner_, base::TimeDelta()));
116 scoped_ptr<data_reduction_proxy::DataReductionProxyService> 113 scoped_ptr<data_reduction_proxy::DataReductionProxyService>
117 data_reduction_proxy_service( 114 data_reduction_proxy_service(
118 new data_reduction_proxy::DataReductionProxyService( 115 new data_reduction_proxy::DataReductionProxyService(
119 compression_stats.Pass(), settings_.get(), prefs_.get(), 116 settings_.get(), prefs_.get(),
120 url_request_context_getter_.get(), task_runner_)); 117 url_request_context_getter_.get(),
118 make_scoped_ptr(new data_reduction_proxy::DataStore()),
119 task_runner_, task_runner_, task_runner_, base::TimeDelta()));
121 io_data_->SetDataReductionProxyService( 120 io_data_->SetDataReductionProxyService(
122 data_reduction_proxy_service->GetWeakPtr()); 121 data_reduction_proxy_service->GetWeakPtr());
123 settings_->InitDataReductionProxySettings( 122 settings_->InitDataReductionProxySettings(
124 prefs_.get(), io_data_.get(), data_reduction_proxy_service.Pass()); 123 prefs_.get(), io_data_.get(), data_reduction_proxy_service.Pass());
125 settings_->SetDataReductionProxyEnabled(enable); 124 settings_->SetDataReductionProxyEnabled(enable);
126 settings_->MaybeActivateDataReductionProxy(true); 125 settings_->MaybeActivateDataReductionProxy(true);
127 } 126 }
128 127
129 } // namespace cronet 128 } // namespace cronet
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698