OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "content/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 if (j_obj.is_null()) | 498 if (j_obj.is_null()) |
499 return; | 499 return; |
500 | 500 |
501 ScopedJavaLocalRef<jobject> bounds_rect(CreateJavaRect(env, bounds)); | 501 ScopedJavaLocalRef<jobject> bounds_rect(CreateJavaRect(env, bounds)); |
502 | 502 |
503 // For multi-select list popups we find the list of previous selections by | 503 // For multi-select list popups we find the list of previous selections by |
504 // iterating through the items. But for single selection popups we take the | 504 // iterating through the items. But for single selection popups we take the |
505 // given |selected_item| as is. | 505 // given |selected_item| as is. |
506 ScopedJavaLocalRef<jintArray> selected_array; | 506 ScopedJavaLocalRef<jintArray> selected_array; |
507 if (multiple) { | 507 if (multiple) { |
508 scoped_ptr<jint[]> native_selected_array(new jint[items.size()]); | 508 std::unique_ptr<jint[]> native_selected_array(new jint[items.size()]); |
509 size_t selected_count = 0; | 509 size_t selected_count = 0; |
510 for (size_t i = 0; i < items.size(); ++i) { | 510 for (size_t i = 0; i < items.size(); ++i) { |
511 if (items[i].checked) | 511 if (items[i].checked) |
512 native_selected_array[selected_count++] = i; | 512 native_selected_array[selected_count++] = i; |
513 } | 513 } |
514 | 514 |
515 selected_array = ScopedJavaLocalRef<jintArray>( | 515 selected_array = ScopedJavaLocalRef<jintArray>( |
516 env, env->NewIntArray(selected_count)); | 516 env, env->NewIntArray(selected_count)); |
517 env->SetIntArrayRegion(selected_array.obj(), 0, selected_count, | 517 env->SetIntArrayRegion(selected_array.obj(), 0, selected_count, |
518 native_selected_array.get()); | 518 native_selected_array.get()); |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 return ScopedJavaLocalRef<jobject>(); | 1575 return ScopedJavaLocalRef<jobject>(); |
1576 | 1576 |
1577 return view->GetJavaObject(); | 1577 return view->GetJavaObject(); |
1578 } | 1578 } |
1579 | 1579 |
1580 bool RegisterContentViewCore(JNIEnv* env) { | 1580 bool RegisterContentViewCore(JNIEnv* env) { |
1581 return RegisterNativesImpl(env); | 1581 return RegisterNativesImpl(env); |
1582 } | 1582 } |
1583 | 1583 |
1584 } // namespace content | 1584 } // namespace content |
OLD | NEW |