Chromium Code Reviews| Index: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc |
| diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc |
| index ed1449a4bc6698c45b0f04ee0df70ea3ea539aa6..04b5f378445b8d36724e8fbe8625d88f4aaaaf35 100644 |
| --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc |
| +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc |
| @@ -6,19 +6,24 @@ |
| #include <utility> |
| +#include "base/bind.h" |
| #include "base/prefs/pref_service.h" |
| #include "build/build_config.h" |
| #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| #include "chrome/common/chrome_content_client.h" |
| #include "chrome/common/pref_names.h" |
| #include "components/data_reduction_proxy/content/browser/content_lofi_decider.h" |
| +#include "components/data_reduction_proxy/content/browser/content_lofi_ui_service.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_retrieval_params.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_experiments_stats.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h" |
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
| +#include "content/public/browser/browser_thread.h" |
| +#include "content/public/browser/web_contents.h" |
| #if defined(OS_ANDROID) |
| #include "base/android/build_info.h" |
| +#include "chrome/browser/android/tab_android.h" |
| #endif |
| #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
| @@ -33,6 +38,22 @@ class BrowserContext; |
| using data_reduction_proxy::DataReductionProxyParams; |
| +namespace { |
| + |
| +// Notifies the TabAndroid associated with |web_contents| that a Lo-Fi response |
|
tbansal1
2016/01/05 21:07:09
Rewrite the comment so that it is clear that this
megjablon
2016/01/06 17:20:47
Done.
|
| +// has been received. The TabAndroid then handles showing Lo-Fi UI if this is |
| +// the first Lo-Fi response for a page load. |
| +void NotifyLoFiResponseReceivedOnUI(content::WebContents* web_contents) { |
| + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| +#if defined(OS_ANDROID) |
| + TabAndroid* tab = TabAndroid::FromWebContents(web_contents); |
| + if (tab) |
| + tab->NotifyLoFiResponseReceived(); |
| +#endif |
| +} |
| + |
| +} // namespace |
| + |
| scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| CreateDataReductionProxyChromeIOData( |
| net::NetLog* net_log, |
| @@ -71,6 +92,10 @@ CreateDataReductionProxyChromeIOData( |
| data_reduction_proxy_io_data->set_lofi_decider( |
| make_scoped_ptr(new data_reduction_proxy::ContentLoFiDecider())); |
| + data_reduction_proxy_io_data->set_lofi_ui_service( |
| + make_scoped_ptr(new data_reduction_proxy::ContentLoFiUIService( |
| + ui_task_runner, |
| + base::Bind(&NotifyLoFiResponseReceivedOnUI)))); |
| #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING) |
| scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService> |