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

Unified Diff: ui/android/view_android.h

Issue 2502763003: Introduce ViewRoot to forward input/view events to native (Closed)
Patch Set: WindowAndroid.GetEventHandler Created 4 years 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 607a1acc72ae4dad10cfc8216cd5d76831b33c6f..c5df2973d3b198d40a1cf07a11a20b18d93bca8b 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,11 +55,9 @@ 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|
@@ -77,28 +76,59 @@ class UI_ANDROID_EXPORT ViewAndroid {
// Detaches this view from its parent.
void RemoveFromParent();
+ bool has_event_handler() { return has_event_handler_; }
boliu 2016/12/06 23:15:46 private
Jinsuk Kim 2016/12/07 12:36:28 Removed.
+
+ // Called when an |EventHandler| gets associated with the current ViewAndroid.
+ // The |EventHandler| must be unique in the tree to which this ViewAndroid
boliu 2016/12/06 23:15:46 "unique in the tree" is not the phrase here, I don
Jinsuk Kim 2016/12/07 12:36:28 Done.
+ // belongs - i.e. there must be no parent or child ViewAndroid instance that
+ // already has an |EventHandler|.
+ void OnSetEventHandler();
+
bool StartDragAndDrop(const base::android::JavaRef<jstring>& jtext,
const base::android::JavaRef<jobject>& jimage);
+ gfx::Size GetPhysicalBackingSize();
+
ScopedAnchorView AcquireAnchorView();
void SetAnchorRect(const base::android::JavaRef<jobject>& anchor,
const gfx::RectF& bounds);
+ // Internal implementation of ViewClient forwarding calls to the interface.
+ void OnPhysicalBackingSizeChanged(int width, int height);
+
+ void UpdateLayerBounds();
+
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;
+ int GetPhysicalBackingSizeWidthPix();
boliu 2016/12/06 23:15:46 remove these two
Jinsuk Kim 2016/12/07 12:36:28 Done.
+ int GetPhysicalBackingSizeHeightPix();
+ void SetPhysicalBackingSize(int width, int height);
+
std::list<ViewAndroid*> children_;
scoped_refptr<cc::Layer> layer_;
JavaObjectWeakGlobalRef delegate_;
+ ViewClient* const client_;
+
+ int physical_width_pix_;
+ int physical_height_pix_;
+ bool has_event_handler_;
DISALLOW_COPY_AND_ASSIGN(ViewAndroid);
};

Powered by Google App Engine
This is Rietveld 408576698