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

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

Issue 2262423002: Use a vector of smart pointers for callback return type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Logical merge fixes Created 4 years, 3 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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 ScopedJavaLocalRef<jobject> j_save_page_request = 157 ScopedJavaLocalRef<jobject> j_save_page_request =
158 Java_SavePageRequest_create(env, (int)request.request_state(), 158 Java_SavePageRequest_create(env, (int)request.request_state(),
159 request.request_id(), url, name_space, id); 159 request.request_id(), url, name_space, id);
160 env->SetObjectArrayElement(joa, i, j_save_page_request.obj()); 160 env->SetObjectArrayElement(joa, i, j_save_page_request.obj());
161 } 161 }
162 162
163 return ScopedJavaLocalRef<jobjectArray>(env, joa); 163 return ScopedJavaLocalRef<jobjectArray>(env, joa);
164 } 164 }
165 165
166 void OnGetAllRequestsDone(const ScopedJavaGlobalRef<jobject>& j_callback_obj, 166 void OnGetAllRequestsDone(
167 const std::vector<SavePageRequest>& all_requests) { 167 const ScopedJavaGlobalRef<jobject>& j_callback_obj,
168 std::vector<std::unique_ptr<SavePageRequest>> all_requests) {
168 JNIEnv* env = base::android::AttachCurrentThread(); 169 JNIEnv* env = base::android::AttachCurrentThread();
169 170
170 ScopedJavaLocalRef<jobjectArray> j_result_obj = 171 ScopedJavaLocalRef<jobjectArray> j_result_obj =
171 CreateJavaSavePageRequests(env, all_requests); 172 CreateJavaSavePageRequests(env, all_requests);
172 base::android::RunCallbackAndroid(j_callback_obj, j_result_obj); 173 base::android::RunCallbackAndroid(j_callback_obj, j_result_obj);
173 } 174 }
174 175
175 void OnRemoveRequestsDone( 176 void OnRemoveRequestsDone(
176 const ScopedJavaGlobalRef<jobject>& j_callback_obj, 177 const ScopedJavaGlobalRef<jobject>& j_callback_obj,
177 const RequestQueue::UpdateMultipleRequestResults& removed_request_results) { 178 const RequestQueue::UpdateMultipleRequestResults& removed_request_results) {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 env, ConvertUTF8ToJavaString(env, client_id.name_space), 540 env, ConvertUTF8ToJavaString(env, client_id.name_space),
540 ConvertUTF8ToJavaString(env, client_id.id)); 541 ConvertUTF8ToJavaString(env, client_id.id));
541 } 542 }
542 543
543 bool RegisterOfflinePageBridge(JNIEnv* env) { 544 bool RegisterOfflinePageBridge(JNIEnv* env) {
544 return RegisterNativesImpl(env); 545 return RegisterNativesImpl(env);
545 } 546 }
546 547
547 } // namespace android 548 } // namespace android
548 } // namespace offline_pages 549 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698