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

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

Issue 1662523004: Delete base/prefs and update callers to use components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « components/cronet/DEPS ('k') | components/cronet/android/cronet_in_memory_pref_store.h » ('j') | 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/prefs/pref_registry_simple.h"
12 #include "base/prefs/pref_service.h"
13 #include "base/prefs/pref_service_factory.h"
14 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
15 #include "components/cronet/android/cronet_in_memory_pref_store.h" 12 #include "components/cronet/android/cronet_in_memory_pref_store.h"
16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" 13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h"
17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h"
18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw ork_delegate.h" 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw ork_delegate.h"
19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h"
20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ est_options.h" 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_requ est_options.h"
21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h" 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h"
22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h"
23 #include "components/data_reduction_proxy/core/browser/data_store.h" 20 #include "components/data_reduction_proxy/core/browser/data_store.h"
24 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 21 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
25 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h" 22 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switc hes.h"
23 #include "components/prefs/pref_registry_simple.h"
24 #include "components/prefs/pref_service.h"
25 #include "components/prefs/pref_service_factory.h"
26 #include "net/url_request/url_request_context_getter.h" 26 #include "net/url_request/url_request_context_getter.h"
27 #include "net/url_request/url_request_interceptor.h" 27 #include "net/url_request/url_request_interceptor.h"
28 28
29 namespace cronet { 29 namespace cronet {
30 namespace { 30 namespace {
31 31
32 // Name of the preference that governs enabling the Data Reduction Proxy. 32 // Name of the preference that governs enabling the Data Reduction Proxy.
33 const char kDataReductionProxyEnabled[] = "data_reduction_proxy.enabled"; 33 const char kDataReductionProxyEnabled[] = "data_reduction_proxy.enabled";
34 34
35 scoped_ptr<PrefService> CreatePrefService() { 35 scoped_ptr<PrefService> CreatePrefService() {
36 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple()); 36 scoped_refptr<PrefRegistrySimple> pref_registry(new PrefRegistrySimple());
37 pref_registry->RegisterBooleanPref(kDataReductionProxyEnabled, false); 37 pref_registry->RegisterBooleanPref(kDataReductionProxyEnabled, false);
38 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry.get()); 38 data_reduction_proxy::RegisterSimpleProfilePrefs(pref_registry.get());
39 base::PrefServiceFactory pref_service_factory; 39 PrefServiceFactory pref_service_factory;
40 pref_service_factory.set_user_prefs( 40 pref_service_factory.set_user_prefs(
41 make_scoped_refptr(new CronetInMemoryPrefStore())); 41 make_scoped_refptr(new CronetInMemoryPrefStore()));
42 scoped_ptr<PrefService> pref_service = 42 scoped_ptr<PrefService> pref_service =
43 pref_service_factory.Create(pref_registry.get()); 43 pref_service_factory.Create(pref_registry.get());
44 pref_registry = nullptr; 44 pref_registry = nullptr;
45 return pref_service; 45 return pref_service;
46 } 46 }
47 47
48 // TODO(bengr): Apply test configurations directly, instead of via the 48 // TODO(bengr): Apply test configurations directly, instead of via the
49 // command line. 49 // command line.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 io_data_->SetDataReductionProxyService( 126 io_data_->SetDataReductionProxyService(
127 data_reduction_proxy_service->GetWeakPtr()); 127 data_reduction_proxy_service->GetWeakPtr());
128 settings_->InitDataReductionProxySettings( 128 settings_->InitDataReductionProxySettings(
129 kDataReductionProxyEnabled, prefs_.get(), io_data_.get(), 129 kDataReductionProxyEnabled, prefs_.get(), io_data_.get(),
130 std::move(data_reduction_proxy_service)); 130 std::move(data_reduction_proxy_service));
131 settings_->SetDataReductionProxyEnabled(enable); 131 settings_->SetDataReductionProxyEnabled(enable);
132 settings_->MaybeActivateDataReductionProxy(true); 132 settings_->MaybeActivateDataReductionProxy(true);
133 } 133 }
134 134
135 } // namespace cronet 135 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/DEPS ('k') | components/cronet/android/cronet_in_memory_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698