OLD | NEW |
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/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" |
6 | 6 |
7 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
8 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" | 8 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" |
9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
10 #include "net/url_request/url_fetcher.h" | 10 #include "net/url_request/url_fetcher.h" |
11 #include "net/url_request/url_request_status.h" | 11 #include "net/url_request/url_request_status.h" |
12 | 12 |
13 namespace data_reduction_proxy { | 13 namespace data_reduction_proxy { |
14 | 14 |
15 DataReductionProxyService::DataReductionProxyService( | 15 DataReductionProxyService::DataReductionProxyService( |
16 scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs, | 16 scoped_ptr<DataReductionProxyCompressionStats> compression_stats, |
17 DataReductionProxySettings* settings, | 17 DataReductionProxySettings* settings, |
18 net::URLRequestContextGetter* request_context_getter) | 18 net::URLRequestContextGetter* request_context_getter) |
19 : url_request_context_getter_(request_context_getter), | 19 : url_request_context_getter_(request_context_getter), |
20 settings_(settings), | 20 settings_(settings), |
21 weak_factory_(this) { | 21 weak_factory_(this) { |
22 DCHECK(settings); | 22 DCHECK(settings); |
23 statistics_prefs_ = statistics_prefs.Pass(); | 23 compression_stats_ = compression_stats.Pass(); |
24 } | 24 } |
25 | 25 |
26 DataReductionProxyService::~DataReductionProxyService() { | 26 DataReductionProxyService::~DataReductionProxyService() { |
27 } | 27 } |
28 | 28 |
29 void DataReductionProxyService::Shutdown() { | 29 void DataReductionProxyService::Shutdown() { |
30 DCHECK(CalledOnValidThread()); | 30 DCHECK(CalledOnValidThread()); |
31 weak_factory_.InvalidateWeakPtrs(); | 31 weak_factory_.InvalidateWeakPtrs(); |
32 } | 32 } |
33 | 33 |
34 void DataReductionProxyService::EnableCompressionStatisticsLogging( | 34 void DataReductionProxyService::EnableCompressionStatisticsLogging( |
35 PrefService* prefs, | 35 PrefService* prefs, |
36 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 36 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
37 const base::TimeDelta& commit_delay) { | 37 const base::TimeDelta& commit_delay) { |
38 DCHECK(!statistics_prefs_); | 38 DCHECK(!compression_stats_); |
39 statistics_prefs_.reset(new DataReductionProxyStatisticsPrefs( | 39 compression_stats_.reset(new DataReductionProxyCompressionStats( |
40 prefs, ui_task_runner, commit_delay)); | 40 prefs, ui_task_runner, commit_delay)); |
41 } | 41 } |
42 | 42 |
43 base::WeakPtr<DataReductionProxyService> | 43 base::WeakPtr<DataReductionProxyService> |
44 DataReductionProxyService::GetWeakPtr() { | 44 DataReductionProxyService::GetWeakPtr() { |
45 DCHECK(CalledOnValidThread()); | 45 DCHECK(CalledOnValidThread()); |
46 return weak_factory_.GetWeakPtr(); | 46 return weak_factory_.GetWeakPtr(); |
47 } | 47 } |
48 | 48 |
49 void DataReductionProxyService::OnURLFetchComplete( | 49 void DataReductionProxyService::OnURLFetchComplete( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 net::URLFetcher* fetcher = | 83 net::URLFetcher* fetcher = |
84 GetURLFetcherForSecureProxyCheck(secure_proxy_check_url); | 84 GetURLFetcherForSecureProxyCheck(secure_proxy_check_url); |
85 if (!fetcher) | 85 if (!fetcher) |
86 return; | 86 return; |
87 fetcher_.reset(fetcher); | 87 fetcher_.reset(fetcher); |
88 fetcher_callback_ = fetcher_callback; | 88 fetcher_callback_ = fetcher_callback; |
89 fetcher_->Start(); | 89 fetcher_->Start(); |
90 } | 90 } |
91 | 91 |
92 } // namespace data_reduction_proxy | 92 } // namespace data_reduction_proxy |
OLD | NEW |