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