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

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: rebase Created 4 years, 12 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
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..1a58a2182ea736905f1f929fdaf12b004a787473 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,23 @@
#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/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 +37,19 @@ class BrowserContext;
using data_reduction_proxy::DataReductionProxyParams;
+namespace {
+
+void NotifyLoFiResponseReceivedCallback(content::WebContents* web_contents) {
+#if defined(OS_ANDROID)
+ TabAndroid* tab = TabAndroid::FromWebContents(web_contents);
+ if (tab) {
tbansal1 2016/01/05 03:10:59 braces not needed.
megjablon 2016/01/05 20:13:02 Done.
+ tab->NotifyLoFiResponseReceived();
+ }
+#endif
+}
+
+} // namespace
+
scoped_ptr<data_reduction_proxy::DataReductionProxyIOData>
CreateDataReductionProxyChromeIOData(
net::NetLog* net_log,
@@ -71,6 +88,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(&NotifyLoFiResponseReceivedCallback))));
#if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING)
scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService>

Powered by Google App Engine
This is Rietveld 408576698