| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/offline_pages/offline_page_bridge.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_bridge.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 offline_page.access_count, offline_page.last_access_time.ToJavaTime()); | 66 offline_page.access_count, offline_page.last_access_time.ToJavaTime()); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| 72 static jint GetFeatureMode(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 72 static jint GetFeatureMode(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
| 73 return static_cast<jint>(offline_pages::GetOfflinePageFeatureMode()); | 73 return static_cast<jint>(offline_pages::GetOfflinePageFeatureMode()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 static jboolean IsOfflinePagesBackgroundLoadingEnabled( |
| 77 JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
| 78 return offline_pages::IsOfflinePagesBackgroundLoadingEnabled(); |
| 79 } |
| 80 |
| 76 static jboolean CanSavePage(JNIEnv* env, | 81 static jboolean CanSavePage(JNIEnv* env, |
| 77 const JavaParamRef<jclass>& clazz, | 82 const JavaParamRef<jclass>& clazz, |
| 78 const JavaParamRef<jstring>& j_url) { | 83 const JavaParamRef<jstring>& j_url) { |
| 79 GURL url(ConvertJavaStringToUTF8(env, j_url)); | 84 GURL url(ConvertJavaStringToUTF8(env, j_url)); |
| 80 return url.is_valid() && OfflinePageModel::CanSavePage(url); | 85 return url.is_valid() && OfflinePageModel::CanSavePage(url); |
| 81 } | 86 } |
| 82 | 87 |
| 83 OfflinePageBridge::OfflinePageBridge(JNIEnv* env, | 88 OfflinePageBridge::OfflinePageBridge(JNIEnv* env, |
| 84 jobject obj, | 89 jobject obj, |
| 85 content::BrowserContext* browser_context) | 90 content::BrowserContext* browser_context) |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 return reinterpret_cast<jlong>(new OfflinePageBridge( | 307 return reinterpret_cast<jlong>(new OfflinePageBridge( |
| 303 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); | 308 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); |
| 304 } | 309 } |
| 305 | 310 |
| 306 bool RegisterOfflinePageBridge(JNIEnv* env) { | 311 bool RegisterOfflinePageBridge(JNIEnv* env) { |
| 307 return RegisterNativesImpl(env); | 312 return RegisterNativesImpl(env); |
| 308 } | 313 } |
| 309 | 314 |
| 310 } // namespace android | 315 } // namespace android |
| 311 } // namespace offline_pages | 316 } // namespace offline_pages |
| OLD | NEW |