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

Unified Diff: ui/android/resources/resource_factory.cc

Issue 2746483003: ui/android: Fix Resource meta-data sharing with ResourceManager. (Closed)
Patch Set: jni Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/android/resources/resource_factory.h ('k') | ui/android/resources/resource_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/resources/resource_factory.cc
diff --git a/ui/android/resources/resource_factory.cc b/ui/android/resources/resource_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f6ffba329d59e03b825b527daba34cf4438777ea
--- /dev/null
+++ b/ui/android/resources/resource_factory.cc
@@ -0,0 +1,41 @@
+// 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 "ui/android/resources/resource_factory.h"
+
+#include "jni/ResourceFactory_jni.h"
+#include "ui/android/resources/nine_patch_resource.h"
+#include "ui/gfx/geometry/rect.h"
+
+using base::android::JavaParamRef;
+
+namespace ui {
+
+bool RegisterResourceFactory(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+jlong CreateBitmapResource(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
+ return reinterpret_cast<intptr_t>(new Resource());
+}
+
+jlong CreateNinePatchBitmapResource(JNIEnv* env,
+ const JavaParamRef<jclass>& clazz,
+ jint padding_left,
+ jint padding_top,
+ jint padding_right,
+ jint padding_bottom,
+ jint aperture_left,
+ jint aperture_top,
+ jint aperture_right,
+ jint aperture_bottom) {
+ gfx::Rect padding(padding_left, padding_top, padding_right - padding_left,
+ padding_bottom - padding_top);
+ gfx::Rect aperture(aperture_left, aperture_top,
+ aperture_right - aperture_left,
+ aperture_bottom - aperture_top);
+ return reinterpret_cast<intptr_t>(new NinePatchResource(padding, aperture));
+}
+
+} // namespace ui
« no previous file with comments | « ui/android/resources/resource_factory.h ('k') | ui/android/resources/resource_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698