Chromium Code Reviews| Index: ui/android/view_android.h |
| diff --git a/ui/android/view_android.h b/ui/android/view_android.h |
| index 607a1acc72ae4dad10cfc8216cd5d76831b33c6f..6a728c6a8d506f30fade73a7e309eb55831874bf 100644 |
| --- a/ui/android/view_android.h |
| +++ b/ui/android/view_android.h |
| @@ -18,6 +18,7 @@ class Layer; |
| namespace ui { |
| +class ViewClient; |
| class WindowAndroid; |
| // A simple container for a UI layer. |
| @@ -54,17 +55,20 @@ 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(); |
| // Returns the window at the root of this hierarchy, or |null| |
| // if disconnected. |
| virtual WindowAndroid* GetWindowAndroid() const; |
| + // Returns |EventHandler| associated with the current ViewAndroid. |
| + // Create one if not present. |
| + virtual base::android::ScopedJavaLocalRef<jobject> GetEventHandler(); |
|
boliu
2016/12/08 05:01:06
shouldn't be virtual
Jinsuk Kim
2016/12/13 23:20:38
Done.
|
| + |
| // Used to return and set the layer for this view. May be |null|. |
| cc::Layer* GetLayer() const; |
| void SetLayer(scoped_refptr<cc::Layer> layer); |
| @@ -84,21 +88,52 @@ class UI_ANDROID_EXPORT ViewAndroid { |
| void SetAnchorRect(const base::android::JavaRef<jobject>& anchor, |
| const gfx::RectF& bounds); |
| + gfx::Size GetPhysicalBackingSize(); |
| + void UpdateLayerBounds(); |
| + |
| + // Internal implementation of ViewClient forwarding calls to the interface. |
| + void OnPhysicalBackingSizeChanged(int width, int height); |
| + |
| protected: |
| ViewAndroid* parent_; |
| private: |
| void RemoveChild(ViewAndroid* child); |
| + // Checks if any ViewAndroid instance in the tree hierarchy (including |
| + // all the parents and the children) has |EventHandler| already. |
| + bool HasEventHandlerInTreeHierarchy(); |
| + |
| + // Checks if any children (plus this ViewAndroid itself) has |EventHandler|. |
| + bool HasEventHandlerInSubtree(); |
| + |
| // Returns the Java delegate for this view. This is used to delegate work |
| // up to the embedding view (or the embedder that can deal with the |
| // implementation details). |
| const base::android::ScopedJavaLocalRef<jobject> |
| GetViewAndroidDelegate() const; |
| + // Creates a new |EventHandler| for this ViewAndroid. No parent or child |
| + // should have |EventHandler| for this ViewAndroid to have one. |
| + virtual base::android::ScopedJavaLocalRef<jobject> CreateEventHandler( |
| + ViewAndroid* native_view); |
| + |
| + void SetPhysicalBackingSize(int width, int height) { |
|
boliu
2016/12/08 05:01:06
don't inline this
general rule is: inline is allo
Jinsuk Kim
2016/12/13 23:20:38
You asked me to :/
217 void ViewAndroid::SetPhysi
boliu
2016/12/13 23:50:41
Ohh... overloading the word "inline", I meant don'
Jinsuk Kim
2016/12/14 00:34:08
I see. Should have made a better guess :) Done.
|
| + physical_width_pix_ = width; |
| + physical_height_pix_ = height; |
| + UpdateLayerBounds(); |
| + } |
| + |
| + bool HasEventHandler() { return !event_handler_.is_uninitialized(); } |
|
boliu
2016/12/08 05:01:06
don't inline this
Jinsuk Kim
2016/12/13 23:20:38
Done.
|
| + |
| std::list<ViewAndroid*> children_; |
| scoped_refptr<cc::Layer> layer_; |
| JavaObjectWeakGlobalRef delegate_; |
| + JavaObjectWeakGlobalRef event_handler_; |
|
boliu
2016/12/08 05:01:06
this can actually be strong, we create EventHandle
Jinsuk Kim
2016/12/13 23:20:38
Done. Now event handler is created directly in vie
|
| + ViewClient* const client_; |
| + |
| + int physical_width_pix_; |
| + int physical_height_pix_; |
| DISALLOW_COPY_AND_ASSIGN(ViewAndroid); |
| }; |