Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_bridge.cc

Issue 1739503002: Makes the OfflinePageBridge.getAllPages method asynchronous. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 url, bookmark_id, std::move(archiver), 181 url, bookmark_id, std::move(archiver),
182 base::Bind(&SavePageCallback, j_callback_ref, url)); 182 base::Bind(&SavePageCallback, j_callback_ref, url));
183 } 183 }
184 184
185 void OfflinePageBridge::MarkPageAccessed(JNIEnv* env, 185 void OfflinePageBridge::MarkPageAccessed(JNIEnv* env,
186 const JavaParamRef<jobject>& obj, 186 const JavaParamRef<jobject>& obj,
187 jlong bookmark_id) { 187 jlong bookmark_id) {
188 offline_page_model_->MarkPageAccessed(bookmark_id); 188 offline_page_model_->MarkPageAccessed(bookmark_id);
189 } 189 }
190 190
191 void OfflinePageBridge::DeletePage(JNIEnv* env,
192 const JavaParamRef<jobject>& obj,
193 const JavaParamRef<jobject>& j_callback_obj,
194 jlong bookmark_id) {
195 DCHECK(j_callback_obj);
196
197 ScopedJavaGlobalRef<jobject> j_callback_ref;
198 j_callback_ref.Reset(env, j_callback_obj);
199
200 offline_page_model_->DeletePageByBookmarkId(bookmark_id, base::Bind(
201 &DeletePageCallback, j_callback_ref));
202 }
203
204 void OfflinePageBridge::DeletePages( 191 void OfflinePageBridge::DeletePages(
205 JNIEnv* env, 192 JNIEnv* env,
206 const JavaParamRef<jobject>& obj, 193 const JavaParamRef<jobject>& obj,
207 const JavaParamRef<jobject>& j_callback_obj, 194 const JavaParamRef<jobject>& j_callback_obj,
208 const JavaParamRef<jlongArray>& bookmark_ids_array) { 195 const JavaParamRef<jlongArray>& bookmark_ids_array) {
209 DCHECK(j_callback_obj); 196 DCHECK(j_callback_obj);
210 197
211 ScopedJavaGlobalRef<jobject> j_callback_ref; 198 ScopedJavaGlobalRef<jobject> j_callback_ref;
212 j_callback_ref.Reset(env, j_callback_obj); 199 j_callback_ref.Reset(env, j_callback_obj);
213 200
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return reinterpret_cast<jlong>(new OfflinePageBridge( 254 return reinterpret_cast<jlong>(new OfflinePageBridge(
268 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); 255 env, obj, ProfileAndroid::FromProfileAndroid(j_profile)));
269 } 256 }
270 257
271 bool RegisterOfflinePageBridge(JNIEnv* env) { 258 bool RegisterOfflinePageBridge(JNIEnv* env) {
272 return RegisterNativesImpl(env); 259 return RegisterNativesImpl(env);
273 } 260 }
274 261
275 } // namespace android 262 } // namespace android
276 } // namespace offline_pages 263 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698