OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/offline_items_collection/core/android/offline_item_visuals_
bridge.h" |
| 6 |
| 7 #include "components/offline_items_collection/core/offline_item.h" |
| 8 #include "jni/OfflineItemVisualsBridge_jni.h" |
| 9 #include "ui/gfx/android/java_bitmap.h" |
| 10 #include "ui/gfx/image/image.h" |
| 11 |
| 12 using base::android::ScopedJavaLocalRef; |
| 13 |
| 14 namespace offline_items_collection { |
| 15 namespace android { |
| 16 |
| 17 // static |
| 18 ScopedJavaLocalRef<jobject> OfflineItemVisualsBridge::CreateOfflineItemVisuals( |
| 19 JNIEnv* env, |
| 20 const OfflineItemVisuals* const visuals) { |
| 21 if (!visuals) |
| 22 return nullptr; |
| 23 |
| 24 base::android::ScopedJavaLocalRef<jobject> j_icon; |
| 25 |
| 26 if (!visuals->icon.IsEmpty()) |
| 27 j_icon = gfx::ConvertToJavaBitmap(visuals->icon.ToSkBitmap()); |
| 28 |
| 29 return Java_OfflineItemVisualsBridge_createOfflineItemVisuals(env, j_icon); |
| 30 } |
| 31 |
| 32 } // namespace android |
| 33 } // namespace offline_items_collection |
OLD | NEW |