Chromium Code Reviews| 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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 12 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 12 #include "chrome/common/chrome_content_client.h" | 13 #include "chrome/common/chrome_content_client.h" |
| 13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 14 #include "components/data_reduction_proxy/content/browser/content_lofi_decider.h " | 15 #include "components/data_reduction_proxy/content/browser/content_lofi_decider.h " |
| 16 #include "components/data_reduction_proxy/content/browser/content_lofi_ui_servic e.h" | |
| 15 #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_conf ig_retrieval_params.h" |
| 16 #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_expe riments_stats.h" |
| 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" | 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" |
| 18 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | 20 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" |
| 21 #include "content/public/browser/web_contents.h" | |
| 19 | 22 |
| 20 #if defined(OS_ANDROID) | 23 #if defined(OS_ANDROID) |
| 21 #include "base/android/build_info.h" | 24 #include "base/android/build_info.h" |
| 25 #include "chrome/browser/android/tab_android.h" | |
| 22 #endif | 26 #endif |
| 23 | 27 |
| 24 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | 28 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
| 25 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 26 #include "components/data_reduction_proxy/content/browser/content_data_reduction _proxy_debug_ui_service.h" | 30 #include "components/data_reduction_proxy/content/browser/content_data_reduction _proxy_debug_ui_service.h" |
| 27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf igurator.h" | 31 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf igurator.h" |
| 28 #endif | 32 #endif |
| 29 | 33 |
| 30 namespace content { | 34 namespace content { |
| 31 class BrowserContext; | 35 class BrowserContext; |
| 32 } | 36 } |
| 33 | 37 |
| 34 using data_reduction_proxy::DataReductionProxyParams; | 38 using data_reduction_proxy::DataReductionProxyParams; |
| 35 | 39 |
| 40 namespace { | |
| 41 | |
| 42 void NotifyLoFiResponseReceivedCallback(content::WebContents* web_contents) { | |
|
tbansal1
2016/01/05 03:10:59
This function name matches the typdef in another f
megjablon
2016/01/05 20:13:03
Done.
| |
| 43 #if defined(OS_ANDROID) | |
| 44 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); | |
| 45 if (tab) { | |
| 46 tab->NotifyLoFiResponseReceived(); | |
| 47 } | |
| 48 #endif | |
| 49 } | |
| 50 | |
| 51 } // namespace | |
| 52 | |
| 36 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> | 53 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| 37 CreateDataReductionProxyChromeIOData( | 54 CreateDataReductionProxyChromeIOData( |
| 38 net::NetLog* net_log, | 55 net::NetLog* net_log, |
| 39 PrefService* prefs, | 56 PrefService* prefs, |
| 40 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 57 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 41 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, | 58 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
| 42 bool enable_quic) { | 59 bool enable_quic) { |
| 43 DCHECK(net_log); | 60 DCHECK(net_log); |
| 44 DCHECK(prefs); | 61 DCHECK(prefs); |
| 45 | 62 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 64 new data_reduction_proxy::DataReductionProxyIOData( | 81 new data_reduction_proxy::DataReductionProxyIOData( |
| 65 DataReductionProxyChromeSettings::GetClient(), flags, net_log, | 82 DataReductionProxyChromeSettings::GetClient(), flags, net_log, |
| 66 io_task_runner, ui_task_runner, enabled, enable_quic, | 83 io_task_runner, ui_task_runner, enabled, enable_quic, |
| 67 GetUserAgent())); | 84 GetUserAgent())); |
| 68 data_reduction_proxy_io_data->experiments_stats()->InitializeOnUIThread( | 85 data_reduction_proxy_io_data->experiments_stats()->InitializeOnUIThread( |
| 69 data_reduction_proxy::DataReductionProxyConfigRetrievalParams::Create( | 86 data_reduction_proxy::DataReductionProxyConfigRetrievalParams::Create( |
| 70 prefs)); | 87 prefs)); |
| 71 | 88 |
| 72 data_reduction_proxy_io_data->set_lofi_decider( | 89 data_reduction_proxy_io_data->set_lofi_decider( |
| 73 make_scoped_ptr(new data_reduction_proxy::ContentLoFiDecider())); | 90 make_scoped_ptr(new data_reduction_proxy::ContentLoFiDecider())); |
| 91 data_reduction_proxy_io_data->set_lofi_ui_service( | |
| 92 make_scoped_ptr(new data_reduction_proxy::ContentLoFiUIService( | |
| 93 ui_task_runner, | |
| 94 base::Bind(&NotifyLoFiResponseReceivedCallback)))); | |
| 74 | 95 |
| 75 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) | 96 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
| 76 scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService> | 97 scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService> |
| 77 data_reduction_proxy_ui_service( | 98 data_reduction_proxy_ui_service( |
| 78 new data_reduction_proxy::ContentDataReductionProxyDebugUIService( | 99 new data_reduction_proxy::ContentDataReductionProxyDebugUIService( |
| 79 base::Bind(&data_reduction_proxy::DataReductionProxyConfigurator:: | 100 base::Bind(&data_reduction_proxy::DataReductionProxyConfigurator:: |
| 80 GetProxyConfig, | 101 GetProxyConfig, |
| 81 base::Unretained( | 102 base::Unretained( |
| 82 data_reduction_proxy_io_data->configurator())), | 103 data_reduction_proxy_io_data->configurator())), |
| 83 ui_task_runner, io_task_runner, | 104 ui_task_runner, io_task_runner, |
| 84 g_browser_process->GetApplicationLocale())); | 105 g_browser_process->GetApplicationLocale())); |
| 85 data_reduction_proxy_io_data->set_debug_ui_service( | 106 data_reduction_proxy_io_data->set_debug_ui_service( |
| 86 std::move(data_reduction_proxy_ui_service)); | 107 std::move(data_reduction_proxy_ui_service)); |
| 87 #endif | 108 #endif |
| 88 | 109 |
| 89 return data_reduction_proxy_io_data; | 110 return data_reduction_proxy_io_data; |
| 90 } | 111 } |
| OLD | NEW |