| Index: ui/android/view_android.h
|
| diff --git a/ui/android/view_android.h b/ui/android/view_android.h
|
| index 9ceee0a5e437a49eec647c6931faad42838450bd..f4bd50b062b12624069c50b0a49e31b385acce18 100644
|
| --- a/ui/android/view_android.h
|
| +++ b/ui/android/view_android.h
|
| @@ -10,6 +10,7 @@
|
| #include "base/android/scoped_java_ref.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "ui/android/ui_android_export.h"
|
| +#include "ui/gfx/geometry/rect_f.h"
|
|
|
| namespace cc {
|
| class Layer;
|
| @@ -28,6 +29,10 @@ class UI_ANDROID_EXPORT ViewAndroid {
|
| ViewAndroid(const base::android::JavaRef<jobject>& delegate,
|
| WindowAndroid* root_window);
|
|
|
| + // This method is intentionally not called anywhere, since there are
|
| + // no native methods that are called from Java. TODO(crbug.com/603936).
|
| + static bool RegisterViewAndroid(JNIEnv* env);
|
| +
|
| // Used to construct a child view.
|
| ViewAndroid();
|
| ~ViewAndroid();
|
| @@ -40,11 +45,6 @@ class UI_ANDROID_EXPORT ViewAndroid {
|
| // 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);
|
| @@ -53,7 +53,39 @@ class UI_ANDROID_EXPORT ViewAndroid {
|
| void AddChild(ViewAndroid* child);
|
| void RemoveChild(ViewAndroid* child);
|
|
|
| + // Stores an anchored view to delete itself at the end of its lifetime
|
| + // automatically. This helps manage the lifecyle without the dependency
|
| + // on |ViewAndroid|.
|
| + class ScopedAnchorView {
|
| + public:
|
| + ScopedAnchorView(const base::android::JavaRef<jobject>& jview,
|
| + const base::android::JavaRef<jobject>& jdelegate);
|
| +
|
| + ScopedAnchorView();
|
| + ScopedAnchorView(ScopedAnchorView&& other);
|
| + ScopedAnchorView& operator=(ScopedAnchorView&& other);
|
| +
|
| + // Calls JNI removeView() on the delegate for cleanup.
|
| + ~ScopedAnchorView();
|
| +
|
| + const bool is_null() const { return view_.is_null(); }
|
| + const base::android::JavaRef<jobject>& view() const { return view_; }
|
| +
|
| + private:
|
| + base::android::ScopedJavaGlobalRef<jobject> view_;
|
| + base::android::ScopedJavaGlobalRef<jobject> delegate_;
|
| + };
|
| +
|
| + ScopedAnchorView AcquireAnchorView();
|
| + void SetAnchorRect(const base::android::JavaRef<jobject>& anchor,
|
| + const gfx::RectF& bounds);
|
| +
|
| 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).
|
| + const base::android::JavaRef<jobject>& GetViewAndroidDelegate() const;
|
| +
|
| ViewAndroid* parent_;
|
| std::list<ViewAndroid*> children_;
|
| WindowAndroid* window_;
|
|
|