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

Unified Diff: ui/android/view_android.h

Issue 2136373002: Make WindowAndroid a ViewAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@view3
Patch Set: Make WindowAndroid a ViewAndroid 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | ui/android/view_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/view_android.h
diff --git a/ui/android/view_android.h b/ui/android/view_android.h
index ecbe0c7caa78448aab4ba7946c9f2b09505044ad..6e7140da3e111d470da0ff73c77a7fa007108d6b 100644
--- a/ui/android/view_android.h
+++ b/ui/android/view_android.h
@@ -20,25 +20,18 @@ namespace ui {
class WindowAndroid;
// A simple container for a UI layer.
-// At the root of the hierarchy is a WindowAndroid.
-//
+// At the root of the hierarchy is a WindowAndroid, when attached.
class UI_ANDROID_EXPORT ViewAndroid {
public:
- // Used to construct a root view.
- ViewAndroid(const base::android::JavaRef<jobject>& delegate,
- WindowAndroid* root_window);
-
- // Used to construct a child view.
+ // A ViewAndroid may have its own delegate or otherwise will
+ // use the next available parent's delegate.
+ ViewAndroid(const base::android::JavaRef<jobject>& delegate);
ViewAndroid();
- ~ViewAndroid();
+ virtual ~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);
+ virtual WindowAndroid* GetWindowAndroid() const;
// 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
@@ -49,17 +42,22 @@ class UI_ANDROID_EXPORT ViewAndroid {
cc::Layer* GetLayer() const;
void SetLayer(scoped_refptr<cc::Layer> layer);
- // Add/remove this view as a child of another view.
+ // Adds this view as a child of another view.
void AddChild(ViewAndroid* child);
- void RemoveChild(ViewAndroid* child);
+
+ // Detaches this view from its parent.
+ void RemoveFromParent();
void StartDragAndDrop(const base::android::JavaRef<jstring>& jtext,
const base::android::JavaRef<jobject>& jimage);
- private:
+ protected:
ViewAndroid* parent_;
+
+ private:
+ void RemoveChild(ViewAndroid* child);
+
std::list<ViewAndroid*> children_;
- WindowAndroid* window_;
scoped_refptr<cc::Layer> layer_;
base::android::ScopedJavaGlobalRef<jobject> delegate_;
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | ui/android/view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698