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

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

Issue 2873953003: [Offline Pages] Adds the DeletePagesByOfflineId. (Closed)
Patch Set: Null check. Created 3 years, 7 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
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_bridge.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 const JavaParamRef<jobjectArray>& j_ids_array, 378 const JavaParamRef<jobjectArray>& j_ids_array,
379 const JavaParamRef<jobject>& j_callback_obj) { 379 const JavaParamRef<jobject>& j_callback_obj) {
380 ScopedJavaGlobalRef<jobject> j_callback_ref; 380 ScopedJavaGlobalRef<jobject> j_callback_ref;
381 j_callback_ref.Reset(env, j_callback_obj); 381 j_callback_ref.Reset(env, j_callback_obj);
382 std::vector<ClientId> client_ids = 382 std::vector<ClientId> client_ids =
383 getClientIdsFromObjectArrays(env, j_namespaces_array, j_ids_array); 383 getClientIdsFromObjectArrays(env, j_namespaces_array, j_ids_array);
384 offline_page_model_->DeletePagesByClientIds( 384 offline_page_model_->DeletePagesByClientIds(
385 client_ids, base::Bind(&DeletePageCallback, j_callback_ref)); 385 client_ids, base::Bind(&DeletePageCallback, j_callback_ref));
386 } 386 }
387 387
388 void OfflinePageBridge::DeletePagesByOfflineId(
389 JNIEnv* env,
390 const JavaParamRef<jobject>& obj,
391 const JavaParamRef<jlongArray>& j_offline_ids_array,
392 const JavaParamRef<jobject>& j_callback_obj) {
393 ScopedJavaGlobalRef<jobject> j_callback_ref;
394 j_callback_ref.Reset(env, j_callback_obj);
395 std::vector<int64_t> offline_ids;
396 base::android::JavaLongArrayToInt64Vector(env, j_offline_ids_array,
397 &offline_ids);
398 offline_page_model_->DeletePagesByOfflineId(
399 offline_ids, base::Bind(&DeletePageCallback, j_callback_ref));
400 }
401
388 void OfflinePageBridge::GetPagesByClientId( 402 void OfflinePageBridge::GetPagesByClientId(
389 JNIEnv* env, 403 JNIEnv* env,
390 const JavaParamRef<jobject>& obj, 404 const JavaParamRef<jobject>& obj,
391 const JavaParamRef<jobject>& j_result_obj, 405 const JavaParamRef<jobject>& j_result_obj,
392 const JavaParamRef<jobjectArray>& j_namespaces_array, 406 const JavaParamRef<jobjectArray>& j_namespaces_array,
393 const JavaParamRef<jobjectArray>& j_ids_array, 407 const JavaParamRef<jobjectArray>& j_ids_array,
394 const JavaParamRef<jobject>& j_callback_obj) { 408 const JavaParamRef<jobject>& j_callback_obj) {
395 ScopedJavaGlobalRef<jobject> j_result_ref; 409 ScopedJavaGlobalRef<jobject> j_result_ref;
396 j_result_ref.Reset(env, j_result_obj); 410 j_result_ref.Reset(env, j_result_obj);
397 411
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 env, ConvertUTF8ToJavaString(env, client_id.name_space), 686 env, ConvertUTF8ToJavaString(env, client_id.name_space),
673 ConvertUTF8ToJavaString(env, client_id.id)); 687 ConvertUTF8ToJavaString(env, client_id.id));
674 } 688 }
675 689
676 bool RegisterOfflinePageBridge(JNIEnv* env) { 690 bool RegisterOfflinePageBridge(JNIEnv* env) {
677 return RegisterNativesImpl(env); 691 return RegisterNativesImpl(env);
678 } 692 }
679 693
680 } // namespace android 694 } // namespace android
681 } // namespace offline_pages 695 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698