| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/prefs/scoped_user_pref_update.h" | 11 #include "base/prefs/scoped_user_pref_update.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 14 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 15 #include "chrome/browser/prefs/proxy_prefs.h" | 15 #include "chrome/browser/prefs/proxy_prefs.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" |
| 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" | 20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" |
| 20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" | 22 #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" | 23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" | |
| 24 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 24 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 25 #include "net/url_request/url_request_context_getter.h" | 25 #include "net/url_request/url_request_context_getter.h" |
| 26 | 26 |
| 27 // The Data Reduction Proxy has been turned into a "best effort" proxy, | 27 // The Data Reduction Proxy has been turned into a "best effort" proxy, |
| 28 // meaning it is used only if the effective proxy configuration resolves to | 28 // meaning it is used only if the effective proxy configuration resolves to |
| 29 // DIRECT for a URL. It no longer can be a ProxyConfig in the proxy preference | 29 // DIRECT for a URL. It no longer can be a ProxyConfig in the proxy preference |
| 30 // hierarchy. This method removes the Data Reduction Proxy configuration from | 30 // hierarchy. This method removes the Data Reduction Proxy configuration from |
| 31 // prefs, if present. |proxy_pref_name| is the name of the proxy pref. | 31 // prefs, if present. |proxy_pref_name| is the name of the proxy pref. |
| 32 void DataReductionProxyChromeSettings::MigrateDataReductionProxyOffProxyPrefs( | 32 void DataReductionProxyChromeSettings::MigrateDataReductionProxyOffProxyPrefs( |
| 33 PrefService* prefs) { | 33 PrefService* prefs) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // On mobile we write Data Reduction Proxy prefs directly to the pref service. | 84 // On mobile we write Data Reduction Proxy prefs directly to the pref service. |
| 85 // On desktop we store Data Reduction Proxy prefs in memory, writing to disk | 85 // On desktop we store Data Reduction Proxy prefs in memory, writing to disk |
| 86 // every 60 minutes and on termination. Shutdown hooks must be added for | 86 // every 60 minutes and on termination. Shutdown hooks must be added for |
| 87 // Android and iOS in order for non-zero delays to be supported. | 87 // Android and iOS in order for non-zero delays to be supported. |
| 88 // (http://crbug.com/408264) | 88 // (http://crbug.com/408264) |
| 89 base::TimeDelta commit_delay = base::TimeDelta(); | 89 base::TimeDelta commit_delay = base::TimeDelta(); |
| 90 #else | 90 #else |
| 91 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 91 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
| 92 #endif | 92 #endif |
| 93 | 93 |
| 94 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | 94 scoped_ptr<data_reduction_proxy::DataReductionProxyCompressionStats> |
| 95 statistics_prefs = make_scoped_ptr( | 95 statistics_prefs = make_scoped_ptr( |
| 96 new data_reduction_proxy::DataReductionProxyStatisticsPrefs( | 96 new data_reduction_proxy::DataReductionProxyCompressionStats( |
| 97 profile_prefs, ui_task_runner, commit_delay)); | 97 profile_prefs, ui_task_runner, commit_delay)); |
| 98 scoped_ptr<data_reduction_proxy::DataReductionProxyService> | 98 scoped_ptr<data_reduction_proxy::DataReductionProxyService> |
| 99 service = make_scoped_ptr( | 99 service = make_scoped_ptr( |
| 100 new data_reduction_proxy::DataReductionProxyService( | 100 new data_reduction_proxy::DataReductionProxyService( |
| 101 statistics_prefs.Pass(), this, request_context_getter)); | 101 statistics_prefs.Pass(), this, request_context_getter)); |
| 102 data_reduction_proxy::DataReductionProxySettings:: | 102 data_reduction_proxy::DataReductionProxySettings:: |
| 103 InitDataReductionProxySettings(profile_prefs, io_data, service.Pass()); | 103 InitDataReductionProxySettings(profile_prefs, io_data, service.Pass()); |
| 104 io_data->SetDataReductionProxyService( | 104 io_data->SetDataReductionProxyService( |
| 105 data_reduction_proxy_service()->GetWeakPtr()); | 105 data_reduction_proxy_service()->GetWeakPtr()); |
| 106 | 106 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 #elif defined(OS_OPENBSD) | 142 #elif defined(OS_OPENBSD) |
| 143 return data_reduction_proxy::Client::CHROME_OPENBSD; | 143 return data_reduction_proxy::Client::CHROME_OPENBSD; |
| 144 #elif defined(OS_SOLARIS) | 144 #elif defined(OS_SOLARIS) |
| 145 return data_reduction_proxy::Client::CHROME_SOLARIS; | 145 return data_reduction_proxy::Client::CHROME_SOLARIS; |
| 146 #elif defined(OS_QNX) | 146 #elif defined(OS_QNX) |
| 147 return data_reduction_proxy::Client::CHROME_QNX; | 147 return data_reduction_proxy::Client::CHROME_QNX; |
| 148 #else | 148 #else |
| 149 return data_reduction_proxy::Client::UNKNOWN; | 149 return data_reduction_proxy::Client::UNKNOWN; |
| 150 #endif | 150 #endif |
| 151 } | 151 } |
| OLD | NEW |