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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
12 #include "chrome/common/chrome_content_client.h" | 12 #include "chrome/common/chrome_content_client.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "components/data_reduction_proxy/content/browser/content_lofi_decider.h
" | 14 #include "components/data_reduction_proxy/content/browser/content_lofi_decider.h
" |
15 #include "components/data_reduction_proxy/content/browser/content_lofi_ui_servic
e.h" | 15 #include "components/data_reduction_proxy/content/browser/content_lofi_ui_servic
e.h" |
16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_retrieval_params.h" | |
17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_expe
riments_stats.h" | |
18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
19 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 17 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
20 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
21 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
23 | 21 |
24 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
25 #include "base/android/build_info.h" | 23 #include "base/android/build_info.h" |
26 #include "chrome/browser/android/tab_android.h" | 24 #include "chrome/browser/android/tab_android.h" |
27 #endif | 25 #endif |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 79 |
82 bool enabled = | 80 bool enabled = |
83 prefs->GetBoolean(prefs::kDataSaverEnabled) || | 81 prefs->GetBoolean(prefs::kDataSaverEnabled) || |
84 data_reduction_proxy::params::ShouldForceEnableDataReductionProxy(); | 82 data_reduction_proxy::params::ShouldForceEnableDataReductionProxy(); |
85 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> | 83 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
86 data_reduction_proxy_io_data( | 84 data_reduction_proxy_io_data( |
87 new data_reduction_proxy::DataReductionProxyIOData( | 85 new data_reduction_proxy::DataReductionProxyIOData( |
88 DataReductionProxyChromeSettings::GetClient(), flags, net_log, | 86 DataReductionProxyChromeSettings::GetClient(), flags, net_log, |
89 io_task_runner, ui_task_runner, enabled, enable_quic, | 87 io_task_runner, ui_task_runner, enabled, enable_quic, |
90 GetUserAgent())); | 88 GetUserAgent())); |
91 data_reduction_proxy_io_data->experiments_stats()->InitializeOnUIThread( | |
92 data_reduction_proxy::DataReductionProxyConfigRetrievalParams::Create( | |
93 prefs)); | |
94 | 89 |
95 data_reduction_proxy_io_data->set_lofi_decider( | 90 data_reduction_proxy_io_data->set_lofi_decider( |
96 make_scoped_ptr(new data_reduction_proxy::ContentLoFiDecider())); | 91 make_scoped_ptr(new data_reduction_proxy::ContentLoFiDecider())); |
97 data_reduction_proxy_io_data->set_lofi_ui_service( | 92 data_reduction_proxy_io_data->set_lofi_ui_service( |
98 make_scoped_ptr(new data_reduction_proxy::ContentLoFiUIService( | 93 make_scoped_ptr(new data_reduction_proxy::ContentLoFiUIService( |
99 ui_task_runner, | 94 ui_task_runner, |
100 base::Bind(&OnLoFiResponseReceivedOnUI)))); | 95 base::Bind(&OnLoFiResponseReceivedOnUI)))); |
101 | 96 |
102 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | 97 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
103 scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService> | 98 scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService> |
104 data_reduction_proxy_ui_service( | 99 data_reduction_proxy_ui_service( |
105 new data_reduction_proxy::ContentDataReductionProxyDebugUIService( | 100 new data_reduction_proxy::ContentDataReductionProxyDebugUIService( |
106 base::Bind(&data_reduction_proxy::DataReductionProxyConfigurator:: | 101 base::Bind(&data_reduction_proxy::DataReductionProxyConfigurator:: |
107 GetProxyConfig, | 102 GetProxyConfig, |
108 base::Unretained( | 103 base::Unretained( |
109 data_reduction_proxy_io_data->configurator())), | 104 data_reduction_proxy_io_data->configurator())), |
110 ui_task_runner, io_task_runner, | 105 ui_task_runner, io_task_runner, |
111 g_browser_process->GetApplicationLocale())); | 106 g_browser_process->GetApplicationLocale())); |
112 data_reduction_proxy_io_data->set_debug_ui_service( | 107 data_reduction_proxy_io_data->set_debug_ui_service( |
113 std::move(data_reduction_proxy_ui_service)); | 108 std::move(data_reduction_proxy_ui_service)); |
114 #endif | 109 #endif |
115 | 110 |
116 return data_reduction_proxy_io_data; | 111 return data_reduction_proxy_io_data; |
117 } | 112 } |
OLD | NEW |