Index: ui/android/view_android.h |
diff --git a/ui/android/view_android.h b/ui/android/view_android.h |
index 607a1acc72ae4dad10cfc8216cd5d76831b33c6f..3d3aed81959aebd786b548b8284304b5d5d3a1f4 100644 |
--- a/ui/android/view_android.h |
+++ b/ui/android/view_android.h |
@@ -8,10 +8,13 @@ |
#include <list> |
#include "base/android/jni_weak_ref.h" |
+#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
#include "ui/android/ui_android_export.h" |
#include "ui/gfx/geometry/rect_f.h" |
+typedef unsigned int SkColor; |
+ |
namespace cc { |
class Layer; |
} |
@@ -54,10 +57,6 @@ class UI_ANDROID_EXPORT ViewAndroid { |
// Default copy/assign disabled by move constructor. |
}; |
- // A ViewAndroid may have its own delegate or otherwise will |
- // use the next available parent's delegate. |
- ViewAndroid(const base::android::JavaRef<jobject>& delegate); |
- |
ViewAndroid(); |
virtual ~ViewAndroid(); |
@@ -84,6 +83,37 @@ class UI_ANDROID_EXPORT ViewAndroid { |
void SetAnchorRect(const base::android::JavaRef<jobject>& anchor, |
const gfx::RectF& bounds); |
+ void reset_physical_backing_size_changed_handler( |
+ base::RepeatingCallback<void(int, int)> handler) { |
+ // Handlers are stored in the view android that has the java delegate, |
+ // which is unique in the implementation. |
+ // |
+ // This should be able to find the one to store the handler in before |
+ // reaching the top view (or window, if not attached yet). |
+ DCHECK(parent_); |
+ if (delegate_.is_uninitialized()) |
+ parent_->reset_physical_backing_size_changed_handler(handler); |
+ else |
+ physical_backing_size_changed_handler_ = std::move(handler); |
+ } |
+ |
+ void reset_physical_backing_size_changed_handler() { |
+ DCHECK(parent_); |
+ if (delegate_.is_uninitialized()) |
+ parent_->reset_physical_backing_size_changed_handler(); |
+ else |
+ physical_backing_size_changed_handler_.Reset(); |
+ } |
+ |
+ void OnPhysicalBackingSizeChanged( |
+ JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& obj, |
+ jint width, |
+ jint height); |
+ |
+ // Register the ViewAndroid's native methods through JNI. |
+ static bool RegisterViewAndroid(JNIEnv* env); |
+ |
protected: |
ViewAndroid* parent_; |
@@ -100,6 +130,10 @@ class UI_ANDROID_EXPORT ViewAndroid { |
scoped_refptr<cc::Layer> layer_; |
JavaObjectWeakGlobalRef delegate_; |
+ // Handler for calls coming down from Java layer. |
+ base::RepeatingCallback<void(int, int)> |
+ physical_backing_size_changed_handler_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ViewAndroid); |
}; |