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

Unified Diff: ui/android/view_android.h

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: tests Created 3 years, 12 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
Index: ui/android/view_android.h
diff --git a/ui/android/view_android.h b/ui/android/view_android.h
index d05520d514b7ee525f1b85ec78f8fb7ceb1cd04b..3e6e2398c85b13c15a153cb8f0b3621aaf3d73e9 100644
--- a/ui/android/view_android.h
+++ b/ui/android/view_android.h
@@ -22,7 +22,7 @@ class ViewClient;
class WindowAndroid;
// A simple container for a UI layer.
-// At the root of the hierarchy is a WindowAndroid, when attached.
+// At the root of the hierarchy is a ViewRoot, a subclass of ViewAndroid.
class UI_ANDROID_EXPORT ViewAndroid {
public:
// Stores an anchored view to delete itself at the end of its lifetime
@@ -64,9 +64,9 @@ class UI_ANDROID_EXPORT ViewAndroid {
// if disconnected.
virtual WindowAndroid* GetWindowAndroid() const;
- // Returns |ViewRoot| associated with the current ViewAndroid.
- // Create one if not present.
- base::android::ScopedJavaLocalRef<jobject> GetViewRoot();
+ // Set the root |WindowAndroid|. This is simply passed up to the root
+ // of the tree i.e. |ViewRoot| where the reference is held.
+ virtual void SetWindowAndroid(WindowAndroid* window);
boliu 2017/01/03 19:16:11 This should not be needed. First this seems to be
Jinsuk Kim 2017/01/04 10:45:02 Done. Is this suggestion about the immutable pairi
boliu 2017/01/04 17:45:10 Yeah. Also to keep things simple and avoid unneces
Jinsuk Kim 2017/01/05 11:03:12 Acknowledged.
// Used to return and set the layer for this view. May be |null|.
cc::Layer* GetLayer() const;
@@ -91,9 +91,12 @@ class UI_ANDROID_EXPORT ViewAndroid {
void UpdateLayerBounds();
// Internal implementation of ViewClient forwarding calls to the interface.
- void OnPhysicalBackingSizeChanged(int width, int height);
+ void OnPhysicalBackingSizeChangedInternal(int width, int height);
boliu 2017/01/03 19:16:11 the rename is to avoid name collision with ViewRoo
Jinsuk Kim 2017/01/04 10:45:02 Done.
protected:
+ // Returns the root of this hierarchy.
boliu 2017/01/03 19:16:11 not quite, returns the ViewRoot of the hierarchy,
Jinsuk Kim 2017/01/04 10:45:02 Done.
+ virtual ViewAndroid* GetViewRoot();
+
ViewAndroid* parent_;
private:
@@ -116,12 +119,14 @@ class UI_ANDROID_EXPORT ViewAndroid {
// should have |ViewRoot| for this ViewAndroid to have one.
base::android::ScopedJavaLocalRef<jobject> CreateViewRoot();
- bool HasViewRoot();
+ // Checks if this is the root of the view tree. Used to avoid ending up
+ // with multiple roots when modifying a tree.
+ bool IsViewRoot();
std::list<ViewAndroid*> children_;
+
scoped_refptr<cc::Layer> layer_;
JavaObjectWeakGlobalRef delegate_;
- JavaObjectWeakGlobalRef view_root_;
ViewClient* const client_;
int physical_width_pix_;
@@ -130,8 +135,6 @@ class UI_ANDROID_EXPORT ViewAndroid {
DISALLOW_COPY_AND_ASSIGN(ViewAndroid);
};
-bool RegisterViewRoot(JNIEnv* env);
-
} // namespace ui
#endif // UI_ANDROID_VIEW_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698