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 "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" |
6 | 6 |
| 7 #include "base/prefs/pref_service.h" |
7 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 8 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
8 #include "chrome/common/chrome_content_client.h" | 9 #include "chrome/common/chrome_content_client.h" |
9 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 11 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 12 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" |
11 | 13 |
12 #if defined(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
13 #include "base/android/build_info.h" | 15 #include "base/android/build_info.h" |
14 #endif | 16 #endif |
15 | 17 |
16 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | 18 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
17 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
18 #include "components/data_reduction_proxy/content/browser/content_data_reduction
_proxy_debug_ui_service.h" | 20 #include "components/data_reduction_proxy/content/browser/content_data_reduction
_proxy_debug_ui_service.h" |
19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" | 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" |
20 #endif | 22 #endif |
(...skipping 21 matching lines...) Expand all Loading... |
42 flags |= DataReductionProxyParams::kPromoAllowed; | 44 flags |= DataReductionProxyParams::kPromoAllowed; |
43 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial()) | 45 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial()) |
44 flags |= DataReductionProxyParams::kHoldback; | 46 flags |= DataReductionProxyParams::kHoldback; |
45 #if defined(OS_ANDROID) | 47 #if defined(OS_ANDROID) |
46 if (DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial( | 48 if (DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial( |
47 base::android::BuildInfo::GetInstance()->android_build_fp())) { | 49 base::android::BuildInfo::GetInstance()->android_build_fp())) { |
48 flags |= DataReductionProxyParams::kPromoAllowed; | 50 flags |= DataReductionProxyParams::kPromoAllowed; |
49 } | 51 } |
50 #endif | 52 #endif |
51 | 53 |
| 54 bool enabled = prefs->GetBoolean( |
| 55 data_reduction_proxy::prefs::kDataReductionProxyEnabled) || |
| 56 data_reduction_proxy::DataReductionProxyParams:: |
| 57 ShouldForceEnableDataReductionProxy(); |
52 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> | 58 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
53 data_reduction_proxy_io_data( | 59 data_reduction_proxy_io_data( |
54 new data_reduction_proxy::DataReductionProxyIOData( | 60 new data_reduction_proxy::DataReductionProxyIOData( |
55 DataReductionProxyChromeSettings::GetClient(), flags, net_log, | 61 DataReductionProxyChromeSettings::GetClient(), flags, net_log, |
56 io_task_runner, ui_task_runner, enable_quic, GetUserAgent())); | 62 io_task_runner, ui_task_runner, enabled, enable_quic, |
57 data_reduction_proxy_io_data->InitOnUIThread(prefs); | 63 GetUserAgent())); |
58 | 64 |
59 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | 65 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
60 scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService> | 66 scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService> |
61 data_reduction_proxy_ui_service( | 67 data_reduction_proxy_ui_service( |
62 new data_reduction_proxy::ContentDataReductionProxyDebugUIService( | 68 new data_reduction_proxy::ContentDataReductionProxyDebugUIService( |
63 base::Bind(&data_reduction_proxy::DataReductionProxyConfigurator:: | 69 base::Bind(&data_reduction_proxy::DataReductionProxyConfigurator:: |
64 GetProxyConfig, | 70 GetProxyConfig, |
65 base::Unretained( | 71 base::Unretained( |
66 data_reduction_proxy_io_data->configurator())), | 72 data_reduction_proxy_io_data->configurator())), |
67 ui_task_runner, io_task_runner, | 73 ui_task_runner, io_task_runner, |
68 g_browser_process->GetApplicationLocale())); | 74 g_browser_process->GetApplicationLocale())); |
69 data_reduction_proxy_io_data->set_debug_ui_service( | 75 data_reduction_proxy_io_data->set_debug_ui_service( |
70 data_reduction_proxy_ui_service.Pass()); | 76 data_reduction_proxy_ui_service.Pass()); |
71 #endif | 77 #endif |
72 | 78 |
73 return data_reduction_proxy_io_data.Pass(); | 79 return data_reduction_proxy_io_data.Pass(); |
74 } | 80 } |
OLD | NEW |