| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_settings_android.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 13 #include "base/android/jni_string.h" | 13 #include "base/android/jni_string.h" |
| 14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 16 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 17 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" | 17 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" | 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" |
| 22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" | 22 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" |
| 23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" | 23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" |
| 24 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 24 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 25 #include "components/data_reduction_proxy/core/browser/data_usage_store.h" | 25 #include "components/data_reduction_proxy/core/browser/data_usage_store.h" |
| 26 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" | 26 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" |
| 27 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
| 27 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 28 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 28 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" | 29 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
names.h" |
| 29 #include "jni/DataReductionProxySettings_jni.h" | 30 #include "jni/DataReductionProxySettings_jni.h" |
| 30 #include "net/proxy/proxy_server.h" | 31 #include "net/proxy/proxy_server.h" |
| 31 #include "url/gurl.h" | 32 #include "url/gurl.h" |
| 32 | 33 |
| 33 | 34 |
| 34 using base::android::ConvertUTF8ToJavaString; | 35 using base::android::ConvertUTF8ToJavaString; |
| 35 using base::android::JavaParamRef; | 36 using base::android::JavaParamRef; |
| 36 using base::android::ScopedJavaLocalRef; | 37 using base::android::ScopedJavaLocalRef; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 140 } |
| 140 | 141 |
| 141 ScopedJavaLocalRef<jlongArray> | 142 ScopedJavaLocalRef<jlongArray> |
| 142 DataReductionProxySettingsAndroid::GetDailyReceivedContentLengths( | 143 DataReductionProxySettingsAndroid::GetDailyReceivedContentLengths( |
| 143 JNIEnv* env, | 144 JNIEnv* env, |
| 144 const JavaParamRef<jobject>& obj) { | 145 const JavaParamRef<jobject>& obj) { |
| 145 return GetDailyContentLengths( | 146 return GetDailyContentLengths( |
| 146 env, data_reduction_proxy::prefs::kDailyHttpReceivedContentLength); | 147 env, data_reduction_proxy::prefs::kDailyHttpReceivedContentLength); |
| 147 } | 148 } |
| 148 | 149 |
| 150 ScopedJavaLocalRef<jstring> |
| 151 DataReductionProxySettingsAndroid::GetDataReductionProxyPassThroughHeader( |
| 152 JNIEnv* env, |
| 153 const JavaParamRef<jobject>& obj) { |
| 154 return ConvertUTF8ToJavaString( |
| 155 env, data_reduction_proxy::chrome_proxy_pass_through_header()); |
| 156 } |
| 157 |
| 149 jboolean DataReductionProxySettingsAndroid::IsDataReductionProxyUnreachable( | 158 jboolean DataReductionProxySettingsAndroid::IsDataReductionProxyUnreachable( |
| 150 JNIEnv* env, | 159 JNIEnv* env, |
| 151 const JavaParamRef<jobject>& obj) { | 160 const JavaParamRef<jobject>& obj) { |
| 152 return Settings()->IsDataReductionProxyUnreachable(); | 161 return Settings()->IsDataReductionProxyUnreachable(); |
| 153 } | 162 } |
| 154 | 163 |
| 155 jboolean DataReductionProxySettingsAndroid::AreLoFiPreviewsEnabled( | 164 jboolean DataReductionProxySettingsAndroid::AreLoFiPreviewsEnabled( |
| 156 JNIEnv* env, | 165 JNIEnv* env, |
| 157 const JavaParamRef<jobject>& obj) { | 166 const JavaParamRef<jobject>& obj) { |
| 158 return data_reduction_proxy::params::IsIncludedInLitePageFieldTrial() || | 167 return data_reduction_proxy::params::IsIncludedInLitePageFieldTrial() || |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 env, j_settings_obj_.get(env), j_query_result_obj_.obj()); | 276 env, j_settings_obj_.get(env), j_query_result_obj_.obj()); |
| 268 | 277 |
| 269 j_query_result_obj_.Release(); | 278 j_query_result_obj_.Release(); |
| 270 } | 279 } |
| 271 | 280 |
| 272 // Used by generated jni code. | 281 // Used by generated jni code. |
| 273 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 282 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 274 return reinterpret_cast<intptr_t>( | 283 return reinterpret_cast<intptr_t>( |
| 275 new DataReductionProxySettingsAndroid(env, obj)); | 284 new DataReductionProxySettingsAndroid(env, obj)); |
| 276 } | 285 } |
| OLD | NEW |