| Index: ui/android/view_android.h
|
| diff --git a/ui/android/view_android.h b/ui/android/view_android.h
|
| index 68adf34d70eb8e6496ff37e547b165eb5bcc4d98..e446048580dc6d63d456cff04791170fa19bfccc 100644
|
| --- a/ui/android/view_android.h
|
| +++ b/ui/android/view_android.h
|
| @@ -10,6 +10,7 @@
|
| #include "base/android/jni_weak_ref.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "ui/android/ui_android_export.h"
|
| +#include "ui/android/view_client.h"
|
| #include "ui/gfx/geometry/rect_f.h"
|
|
|
| namespace cc {
|
| @@ -22,6 +23,8 @@ class WindowAndroid;
|
|
|
| // A simple container for a UI layer.
|
| // At the root of the hierarchy is a WindowAndroid, when attached.
|
| +// TODO(jinsukkim): Replace WindowAndroid with ViewRoot for the root of the
|
| +// view hierarchy. See https://crbug.com/671401
|
| class UI_ANDROID_EXPORT ViewAndroid {
|
| public:
|
| // Stores an anchored view to delete itself at the end of its lifetime
|
| @@ -54,9 +57,7 @@ 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);
|
| + explicit ViewAndroid(ViewClient* client);
|
|
|
| ViewAndroid();
|
| virtual ~ViewAndroid();
|
| @@ -75,18 +76,29 @@ class UI_ANDROID_EXPORT ViewAndroid {
|
| // if disconnected.
|
| virtual WindowAndroid* GetWindowAndroid() const;
|
|
|
| + // Returns |ViewRoot| of this hierarchy. |null| if the hierarchy isn't
|
| + // attached to a |ViewRoot|.
|
| + virtual ViewAndroid* GetViewRoot();
|
| +
|
| // Used to return and set the layer for this view. May be |null|.
|
| cc::Layer* GetLayer() const;
|
| void SetLayer(scoped_refptr<cc::Layer> layer);
|
|
|
| void SetDelegate(const base::android::JavaRef<jobject>& delegate);
|
|
|
| - // Adds this view as a child of another view.
|
| + // Adds a child to this view.
|
| void AddChild(ViewAndroid* child);
|
|
|
| + // Move the give child ViewAndroid to the top of the list
|
| + // so that it can be the first responder of events.
|
| + void MoveToTop(ViewAndroid* child);
|
| +
|
| // Detaches this view from its parent.
|
| void RemoveFromParent();
|
|
|
| + // Set the layout relative to parent. Used to do hit testing against events.
|
| + void SetLayout(int x, int y, int width, int height, bool match_parent);
|
| +
|
| bool StartDragAndDrop(const base::android::JavaRef<jstring>& jtext,
|
| const base::android::JavaRef<jobject>& jimage);
|
|
|
| @@ -98,9 +110,18 @@ class UI_ANDROID_EXPORT ViewAndroid {
|
| base::android::ScopedJavaLocalRef<jobject> GetContainerView();
|
|
|
| protected:
|
| + // Internal implementation of ViewClient forwarding calls to the interface.
|
| + bool OnTouchEventInternal(const MotionEventData& event);
|
| +
|
| + // Virtual for testing.
|
| + virtual float GetDipScale();
|
| +
|
| ViewAndroid* parent_;
|
|
|
| private:
|
| + // Returns true only if this is of type |ViewRoot|.
|
| + bool IsViewRoot();
|
| +
|
| void RemoveChild(ViewAndroid* child);
|
|
|
| // Returns the Java delegate for this view. This is used to delegate work
|
| @@ -109,10 +130,19 @@ class UI_ANDROID_EXPORT ViewAndroid {
|
| const base::android::ScopedJavaLocalRef<jobject>
|
| GetViewAndroidDelegate() const;
|
|
|
| + // The child view at the back of the list receives event first.
|
| std::list<ViewAndroid*> children_;
|
| scoped_refptr<cc::Layer> layer_;
|
| JavaObjectWeakGlobalRef delegate_;
|
| - gfx::Vector2dF content_offset_; // in CSS pixel
|
| + ViewClient* const client_;
|
| +
|
| + // Basic view layout information. Used to do hit testing deciding whether
|
| + // the passed events should be processed by the view.
|
| + gfx::Point origin_; // In parent's coordinate space.
|
| + gfx::Size size_;
|
| + bool match_parent_; // Bounds matches that of the parent if true.
|
| +
|
| + gfx::Vector2dF content_offset_; // In CSS pixel.
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ViewAndroid);
|
| };
|
|
|