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

Unified Diff: ui/android/view_android.h

Issue 2122403002: Android: Extend ViewAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 32c2c719bba1572ddbe2b443d0d01f024a46805e..9ceee0a5e437a49eec647c6931faad42838450bd 100644
--- a/ui/android/view_android.h
+++ b/ui/android/view_android.h
@@ -5,24 +5,62 @@
#ifndef UI_ANDROID_VIEW_ANDROID_H_
#define UI_ANDROID_VIEW_ANDROID_H_
+#include <list>
+
#include "base/android/scoped_java_ref.h"
+#include "base/memory/ref_counted.h"
#include "ui/android/ui_android_export.h"
+namespace cc {
+class Layer;
+}
+
namespace ui {
class WindowAndroid;
-// This is a NativeView interface for getting access to
-// WindowAndroid(NativeWindow).
+// A simple container for a UI layer.
+// At the root of the hierarchy is a WindowAndroid.
+//
class UI_ANDROID_EXPORT ViewAndroid {
public:
- virtual WindowAndroid* GetWindowAndroid() const = 0;
+ // Used to construct a root view.
+ ViewAndroid(const base::android::JavaRef<jobject>& delegate,
+ WindowAndroid* root_window);
+
+ // Used to construct a child view.
+ ViewAndroid();
+ ~ViewAndroid();
+
+ // Returns the window at the root of this hierarchy, or |null|
+ // if disconnected.
+ WindowAndroid* GetWindowAndroid() const;
+
+ // Set the root |WindowAndroid|. This is only valid for root
+ // nodes and must not be called for children.
+ void SetWindowAndroid(WindowAndroid* root_window);
+
+ // 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::JavaRef<jobject>& GetViewAndroidDelegate() const;
+
+ // Used to return and set the layer for this view. May be |null|.
+ cc::Layer* GetLayer() const;
+ void SetLayer(scoped_refptr<cc::Layer> layer);
+
+ // Add/remove this view as a child of another view.
+ void AddChild(ViewAndroid* child);
+ void RemoveChild(ViewAndroid* child);
- virtual base::android::ScopedJavaLocalRef<jobject>
- GetViewAndroidDelegate() const = 0 ;
+ private:
+ ViewAndroid* parent_;
+ std::list<ViewAndroid*> children_;
+ WindowAndroid* window_;
+ scoped_refptr<cc::Layer> layer_;
+ base::android::ScopedJavaGlobalRef<jobject> delegate_;
- protected:
- virtual ~ViewAndroid() {}
+ DISALLOW_COPY_AND_ASSIGN(ViewAndroid);
};
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698