| 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 compression_stats = 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> service = |
| 99 service = make_scoped_ptr( | 99 make_scoped_ptr(new data_reduction_proxy::DataReductionProxyService( |
| 100 new data_reduction_proxy::DataReductionProxyService( | 100 compression_stats.Pass(), this, request_context_getter)); |
| 101 statistics_prefs.Pass(), this, request_context_getter)); | |
| 102 data_reduction_proxy::DataReductionProxySettings:: | 101 data_reduction_proxy::DataReductionProxySettings:: |
| 103 InitDataReductionProxySettings(profile_prefs, io_data, service.Pass()); | 102 InitDataReductionProxySettings(profile_prefs, io_data, service.Pass()); |
| 104 io_data->SetDataReductionProxyService( | 103 io_data->SetDataReductionProxyService( |
| 105 data_reduction_proxy_service()->GetWeakPtr()); | 104 data_reduction_proxy_service()->GetWeakPtr()); |
| 106 | 105 |
| 107 data_reduction_proxy::DataReductionProxySettings:: | 106 data_reduction_proxy::DataReductionProxySettings:: |
| 108 SetCallbackToRegisterSyntheticFieldTrial( | 107 SetCallbackToRegisterSyntheticFieldTrial( |
| 109 base::Bind( | 108 base::Bind( |
| 110 &ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial)); | 109 &ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial)); |
| 111 SetDataReductionProxyAlternativeEnabled( | 110 SetDataReductionProxyAlternativeEnabled( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 134 #elif defined(OS_OPENBSD) | 133 #elif defined(OS_OPENBSD) |
| 135 return data_reduction_proxy::Client::CHROME_OPENBSD; | 134 return data_reduction_proxy::Client::CHROME_OPENBSD; |
| 136 #elif defined(OS_SOLARIS) | 135 #elif defined(OS_SOLARIS) |
| 137 return data_reduction_proxy::Client::CHROME_SOLARIS; | 136 return data_reduction_proxy::Client::CHROME_SOLARIS; |
| 138 #elif defined(OS_QNX) | 137 #elif defined(OS_QNX) |
| 139 return data_reduction_proxy::Client::CHROME_QNX; | 138 return data_reduction_proxy::Client::CHROME_QNX; |
| 140 #else | 139 #else |
| 141 return data_reduction_proxy::Client::UNKNOWN; | 140 return data_reduction_proxy::Client::UNKNOWN; |
| 142 #endif | 141 #endif |
| 143 } | 142 } |
| OLD | NEW |