Index: components/offline_items_collection/core/android/offline_item_visuals_bridge.cc |
diff --git a/components/offline_items_collection/core/android/offline_item_visuals_bridge.cc b/components/offline_items_collection/core/android/offline_item_visuals_bridge.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a1ff778155d8a3e1cd377890051352cd790041a7 |
--- /dev/null |
+++ b/components/offline_items_collection/core/android/offline_item_visuals_bridge.cc |
@@ -0,0 +1,33 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "components/offline_items_collection/core/android/offline_item_visuals_bridge.h" |
+ |
+#include "components/offline_items_collection/core/offline_item.h" |
+#include "jni/OfflineItemVisualsBridge_jni.h" |
+#include "ui/gfx/android/java_bitmap.h" |
+#include "ui/gfx/image/image.h" |
+ |
+using base::android::ScopedJavaLocalRef; |
+ |
+namespace offline_items_collection { |
+namespace android { |
+ |
+// static |
+ScopedJavaLocalRef<jobject> OfflineItemVisualsBridge::CreateOfflineItemVisuals( |
+ JNIEnv* env, |
+ const OfflineItemVisuals* const visuals) { |
+ if (!visuals) |
+ return nullptr; |
+ |
+ base::android::ScopedJavaLocalRef<jobject> j_icon; |
+ |
+ if (!visuals->icon.IsEmpty()) |
+ j_icon = gfx::ConvertToJavaBitmap(visuals->icon.ToSkBitmap()); |
+ |
+ return Java_OfflineItemVisualsBridge_createOfflineItemVisuals(env, j_icon); |
+} |
+ |
+} // namespace android |
+} // namespace offline_items_collection |