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

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: Fix some comments. Created 4 years, 8 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 <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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 url, client_id, std::move(archiver), 237 url, client_id, std::move(archiver),
238 base::Bind(&SavePageCallback, j_callback_ref, url)); 238 base::Bind(&SavePageCallback, j_callback_ref, url));
239 } 239 }
240 240
241 void OfflinePageBridge::MarkPageAccessed(JNIEnv* env, 241 void OfflinePageBridge::MarkPageAccessed(JNIEnv* env,
242 const JavaParamRef<jobject>& obj, 242 const JavaParamRef<jobject>& obj,
243 jlong offline_id) { 243 jlong offline_id) {
244 offline_page_model_->MarkPageAccessed(offline_id); 244 offline_page_model_->MarkPageAccessed(offline_id);
245 } 245 }
246 246
247 void OfflinePageBridge::DeletePage(JNIEnv* env,
248 const JavaParamRef<jobject>& obj,
249 const JavaParamRef<jobject>& j_callback_obj,
250 jlong offline_id) {
251 DCHECK(j_callback_obj);
252
253 ScopedJavaGlobalRef<jobject> j_callback_ref;
254 j_callback_ref.Reset(env, j_callback_obj);
255
256 offline_page_model_->DeletePageByOfflineId(
257 offline_id, base::Bind(&DeletePageCallback, j_callback_ref));
258 }
259
260 void OfflinePageBridge::DeletePages( 247 void OfflinePageBridge::DeletePages(
261 JNIEnv* env, 248 JNIEnv* env,
262 const JavaParamRef<jobject>& obj, 249 const JavaParamRef<jobject>& obj,
263 const JavaParamRef<jobject>& j_callback_obj, 250 const JavaParamRef<jobject>& j_callback_obj,
264 const JavaParamRef<jlongArray>& offline_ids_array) { 251 const JavaParamRef<jlongArray>& offline_ids_array) {
265 DCHECK(j_callback_obj); 252 DCHECK(j_callback_obj);
266 253
267 ScopedJavaGlobalRef<jobject> j_callback_ref; 254 ScopedJavaGlobalRef<jobject> j_callback_ref;
268 j_callback_ref.Reset(env, j_callback_obj); 255 j_callback_ref.Reset(env, j_callback_obj);
269 256
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 ConvertUTF8ToJavaString(env, client_id.name_space).obj(), 318 ConvertUTF8ToJavaString(env, client_id.name_space).obj(),
332 ConvertUTF8ToJavaString(env, client_id.id).obj()); 319 ConvertUTF8ToJavaString(env, client_id.id).obj());
333 } 320 }
334 321
335 bool RegisterOfflinePageBridge(JNIEnv* env) { 322 bool RegisterOfflinePageBridge(JNIEnv* env) {
336 return RegisterNativesImpl(env); 323 return RegisterNativesImpl(env);
337 } 324 }
338 325
339 } // namespace android 326 } // namespace android
340 } // namespace offline_pages 327 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_bridge.h ('k') | components/offline_pages/offline_page_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698