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

Unified Diff: ui/android/view_android.h

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: addressed comments 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..8a20c9ccafee50d71fefa6fff707da590d9bb933 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,8 @@ 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();
+ // Adds this view as a child of another view.
+ virtual void AddChild(ViewAndroid* child);
boliu 2017/01/04 18:58:06 hmm, why does this need to be virtual?
Jinsuk Kim 2017/01/05 11:03:12 Ah forgot to remove it after some testing. Done.
// Used to return and set the layer for this view. May be |null|.
cc::Layer* GetLayer() const;
@@ -74,9 +73,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,22 +86,19 @@ 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_;
+ // Returns |ViewRoot| of this hierarchy. |null| if the hierarchy isn't
+ // attached to a |ViewRoot|.
+ virtual ViewAndroid* GetViewRoot();
- private:
- void RemoveChild(ViewAndroid* child);
+ virtual void RemoveChild(ViewAndroid* child);
boliu 2017/01/04 18:58:06 this doesn't need to be virtual or protected if Vi
Jinsuk Kim 2017/01/05 11:03:12 Removed virtual and turned to private.
- // Checks if any ViewAndroid instance in the tree hierarchy (including
- // all the parents and the children) has |ViewRoot| already.
- bool HasViewRootInTreeHierarchy();
+ // Internal implementation of ViewClient forwarding calls to the interface.
+ void OnPhysicalBackingSizeChangedInternal(int width, int height);
- // Checks if any children (plus this ViewAndroid itself) has |ViewRoot|.
- bool HasViewRootInSubtree();
+ std::list<ViewAndroid*> children_;
+ private:
// 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).
@@ -116,12 +109,9 @@ class UI_ANDROID_EXPORT ViewAndroid {
// should have |ViewRoot| for this ViewAndroid to have one.
base::android::ScopedJavaLocalRef<jobject> CreateViewRoot();
- bool HasViewRoot();
-
- std::list<ViewAndroid*> children_;
+ ViewAndroid* parent_;
scoped_refptr<cc::Layer> layer_;
JavaObjectWeakGlobalRef delegate_;
- JavaObjectWeakGlobalRef view_root_;
ViewClient* const client_;
int physical_width_pix_;
@@ -130,8 +120,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