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

Unified Diff: ui/android/view_android.h

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: updateViewRoot, ... Created 3 years, 11 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..e49a4522e2f6b0b66ebc1db0599740e444c48111 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,12 @@ 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();
+ // Returns |ViewRoot| of this hierarchy. |null| if the hierarchy isn't
+ // attached to a |ViewRoot|.
+ virtual ViewAndroid* GetViewRoot();
+
+ // Adds this view as a child of another view.
boliu 2017/01/05 19:09:29 just noticed this comment sounds backwards..
Jinsuk Kim 2017/01/05 22:30:15 Done.
+ void AddChild(ViewAndroid* child);
boliu 2017/01/05 19:09:29 nit: avoid rearranging method order
Jinsuk Kim 2017/01/05 22:30:15 Done.
// Used to return and set the layer for this view. May be |null|.
cc::Layer* GetLayer() const;
@@ -74,9 +77,6 @@ class UI_ANDROID_EXPORT ViewAndroid {
void SetDelegate(const base::android::JavaRef<jobject>& delegate);
- // Adds this view as a child of another view.
- void AddChild(ViewAndroid* child);
-
// Detaches this view from its parent.
void RemoveFromParent();
@@ -90,21 +90,15 @@ class UI_ANDROID_EXPORT ViewAndroid {
gfx::Size GetPhysicalBackingSize();
void UpdateLayerBounds();
- // Internal implementation of ViewClient forwarding calls to the interface.
- void OnPhysicalBackingSizeChanged(int width, int height);
-
protected:
- ViewAndroid* parent_;
+ // Internal implementation of ViewClient forwarding calls to the interface.
+ void OnPhysicalBackingSizeChangedInternal(int width, int height);
private:
- void RemoveChild(ViewAndroid* child);
-
- // Checks if any ViewAndroid instance in the tree hierarchy (including
- // all the parents and the children) has |ViewRoot| already.
- bool HasViewRootInTreeHierarchy();
+ // Returns true only if this is of type |ViewRoot|.
+ bool IsViewRoot();
- // Checks if any children (plus this ViewAndroid itself) has |ViewRoot|.
- bool HasViewRootInSubtree();
+ void RemoveChild(ViewAndroid* child);
// 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
@@ -116,12 +110,10 @@ class UI_ANDROID_EXPORT ViewAndroid {
// should have |ViewRoot| for this ViewAndroid to have one.
base::android::ScopedJavaLocalRef<jobject> CreateViewRoot();
- bool HasViewRoot();
-
+ ViewAndroid* parent_;
std::list<ViewAndroid*> children_;
scoped_refptr<cc::Layer> layer_;
JavaObjectWeakGlobalRef delegate_;
- JavaObjectWeakGlobalRef view_root_;
ViewClient* const client_;
int physical_width_pix_;
@@ -130,8 +122,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