Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3797)

Unified Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc

Issue 1558553002: Lo-Fi snackbar should only be shown for the first q=low response of a page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..def66ab77c167be3725369df7a97e9faf3218eff 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 {
+
+// For Android builds, notifies the TabAndroid associated with |web_contents|
+// that a Lo-Fi response has been received. The TabAndroid then handles showing
+// Lo-Fi UI if this is the first Lo-Fi response for a page load.
+void OnLoFiResponseReceivedOnUI(content::WebContents* web_contents) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+#if defined(OS_ANDROID)
+ TabAndroid* tab = TabAndroid::FromWebContents(web_contents);
+ if (tab)
+ tab->OnLoFiResponseReceived();
+#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(&OnLoFiResponseReceivedOnUI))));
#if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING)
scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService>
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698