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

Unified Diff: android_webview/native/aw_contents_statics.cc

Issue 271523002: Add the plumbing to enable DRP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: android_webview/native/aw_contents_statics.cc
diff --git a/android_webview/native/aw_contents_statics.cc b/android_webview/native/aw_contents_statics.cc
index 2b38d798b0e32ca29b8b8a71f1d95bc9b6038488..b89195cbf38fd7c2ca13e7fbc7bf6e0ed6e084f0 100644
--- a/android_webview/native/aw_contents_statics.cc
+++ b/android_webview/native/aw_contents_statics.cc
@@ -4,8 +4,10 @@
#include "android_webview/native/aw_contents_statics.h"
+#include "android_webview/browser/aw_browser_context.h"
#include "base/android/scoped_java_ref.h"
#include "base/callback.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
#include "content/public/browser/browser_thread.h"
#include "jni/AwContentsStatics_jni.h"
#include "net/cert/cert_database.h"
@@ -13,6 +15,7 @@
using base::android::AttachCurrentThread;
using base::android::ScopedJavaGlobalRef;
using content::BrowserThread;
+using data_reduction_proxy::DataReductionProxySettings;
namespace android_webview {
@@ -43,6 +46,16 @@ void ClearClientCertPreferences(JNIEnv* env, jclass, jobject callback) {
base::Bind(&ClientCertificatesCleared, base::Owned(j_callback)));
}
+// static
+void SetDataReductionProxyEnabled(JNIEnv* env, jclass, jboolean enabled) {
+ AwBrowserContext* context = AwBrowserContext::GetDefault();
+ if (context == NULL) return;
boliu 2014/05/06 23:38:04 return on new line (don't need brackets) here and
+ DataReductionProxySettings* proxy_settings =
+ context->GetDataReductionProxySettings();
+ if (proxy_settings == NULL) return;
+ proxy_settings->SetDataReductionProxyEnabled(enabled);
+}
+
bool RegisterAwContentsStatics(JNIEnv* env) {
return RegisterNativesImpl(env);
}

Powered by Google App Engine
This is Rietveld 408576698