| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 offline_page_model_->DeletePagesByOfflineId( | 357 offline_page_model_->DeletePagesByOfflineId( |
| 358 offline_ids, base::Bind(&DeletePageCallback, j_callback_ref)); | 358 offline_ids, base::Bind(&DeletePageCallback, j_callback_ref)); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void OfflinePageBridge::CheckMetadataConsistency( | 361 void OfflinePageBridge::CheckMetadataConsistency( |
| 362 JNIEnv* env, | 362 JNIEnv* env, |
| 363 const JavaParamRef<jobject>& obj) { | 363 const JavaParamRef<jobject>& obj) { |
| 364 offline_page_model_->CheckForExternalFileDeletion(); | 364 offline_page_model_->CheckForExternalFileDeletion(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void OfflinePageBridge::RecordStorageHistograms( | |
| 368 JNIEnv* env, | |
| 369 const JavaParamRef<jobject>& obj, | |
| 370 jlong total_space_bytes, | |
| 371 jlong free_space_bytes, | |
| 372 jboolean reporting_after_delete) { | |
| 373 offline_page_model_->RecordStorageHistograms( | |
| 374 total_space_bytes, free_space_bytes, reporting_after_delete); | |
| 375 } | |
| 376 | |
| 377 void OfflinePageBridge::NotifyIfDoneLoading() const { | 367 void OfflinePageBridge::NotifyIfDoneLoading() const { |
| 378 if (!offline_page_model_->is_loaded()) | 368 if (!offline_page_model_->is_loaded()) |
| 379 return; | 369 return; |
| 380 JNIEnv* env = base::android::AttachCurrentThread(); | 370 JNIEnv* env = base::android::AttachCurrentThread(); |
| 381 Java_OfflinePageBridge_offlinePageModelLoaded(env, java_ref_.obj()); | 371 Java_OfflinePageBridge_offlinePageModelLoaded(env, java_ref_.obj()); |
| 382 } | 372 } |
| 383 | 373 |
| 384 ScopedJavaLocalRef<jobject> OfflinePageBridge::CreateOfflinePageItem( | 374 ScopedJavaLocalRef<jobject> OfflinePageBridge::CreateOfflinePageItem( |
| 385 JNIEnv* env, | 375 JNIEnv* env, |
| 386 const OfflinePageItem& offline_page) const { | 376 const OfflinePageItem& offline_page) const { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 402 ConvertUTF8ToJavaString(env, client_id.name_space).obj(), | 392 ConvertUTF8ToJavaString(env, client_id.name_space).obj(), |
| 403 ConvertUTF8ToJavaString(env, client_id.id).obj()); | 393 ConvertUTF8ToJavaString(env, client_id.id).obj()); |
| 404 } | 394 } |
| 405 | 395 |
| 406 bool RegisterOfflinePageBridge(JNIEnv* env) { | 396 bool RegisterOfflinePageBridge(JNIEnv* env) { |
| 407 return RegisterNativesImpl(env); | 397 return RegisterNativesImpl(env); |
| 408 } | 398 } |
| 409 | 399 |
| 410 } // namespace android | 400 } // namespace android |
| 411 } // namespace offline_pages | 401 } // namespace offline_pages |
| OLD | NEW |