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 "base/android/jni_array.h" | 7 #include "base/android/jni_array.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 std::vector<int64> bookmark_ids; | 207 std::vector<int64> bookmark_ids; |
208 base::android::JavaLongArrayToInt64Vector(env, bookmark_ids_array, | 208 base::android::JavaLongArrayToInt64Vector(env, bookmark_ids_array, |
209 &bookmark_ids); | 209 &bookmark_ids); |
210 | 210 |
211 offline_page_model_->DeletePagesByBookmarkId( | 211 offline_page_model_->DeletePagesByBookmarkId( |
212 bookmark_ids, | 212 bookmark_ids, |
213 base::Bind(&DeletePageCallback, j_callback_ref)); | 213 base::Bind(&DeletePageCallback, j_callback_ref)); |
214 } | 214 } |
215 | 215 |
216 void OfflinePageBridge::CheckMetadataConsistency(JNIEnv* env, jobject obj) { | 216 void OfflinePageBridge::CheckMetadataConsistency(JNIEnv* env, jobject obj) { |
217 offline_page_model_->CheckForExternalFileDeletion(); | 217 offline_page_model_->CheckMetadataConsistency(false); |
218 } | 218 } |
219 | 219 |
220 void OfflinePageBridge::NotifyIfDoneLoading() const { | 220 void OfflinePageBridge::NotifyIfDoneLoading() const { |
221 if (!offline_page_model_->is_loaded()) | 221 if (!offline_page_model_->is_loaded()) |
222 return; | 222 return; |
223 JNIEnv* env = base::android::AttachCurrentThread(); | 223 JNIEnv* env = base::android::AttachCurrentThread(); |
224 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); | 224 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); |
225 if (obj.is_null()) | 225 if (obj.is_null()) |
226 return; | 226 return; |
227 Java_OfflinePageBridge_offlinePageModelLoaded(env, obj.obj()); | 227 Java_OfflinePageBridge_offlinePageModelLoaded(env, obj.obj()); |
(...skipping 15 matching lines...) Expand all Loading... |
243 return reinterpret_cast<jlong>(new OfflinePageBridge( | 243 return reinterpret_cast<jlong>(new OfflinePageBridge( |
244 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); | 244 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); |
245 } | 245 } |
246 | 246 |
247 bool RegisterOfflinePageBridge(JNIEnv* env) { | 247 bool RegisterOfflinePageBridge(JNIEnv* env) { |
248 return RegisterNativesImpl(env); | 248 return RegisterNativesImpl(env); |
249 } | 249 } |
250 | 250 |
251 } // namespace android | 251 } // namespace android |
252 } // namespace offline_pages | 252 } // namespace offline_pages |
OLD | NEW |