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

Side by Side Diff: ui/android/view_android.h

Issue 2103243002: Factor out ContentViewAndroidDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_ANDROID_VIEW_ANDROID_H_ 5 #ifndef UI_ANDROID_VIEW_ANDROID_H_
6 #define UI_ANDROID_VIEW_ANDROID_H_ 6 #define UI_ANDROID_VIEW_ANDROID_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "ui/android/ui_android_export.h" 12 #include "ui/android/ui_android_export.h"
13 #include "ui/gfx/geometry/rect_f.h"
13 14
14 namespace cc { 15 namespace cc {
15 class Layer; 16 class Layer;
16 } 17 }
17 18
18 namespace ui { 19 namespace ui {
19 20
20 class WindowAndroid; 21 class WindowAndroid;
21 22
22 // A simple container for a UI layer. 23 // A simple container for a UI layer.
23 // At the root of the hierarchy is a WindowAndroid. 24 // At the root of the hierarchy is a WindowAndroid.
24 // 25 //
25 class UI_ANDROID_EXPORT ViewAndroid { 26 class UI_ANDROID_EXPORT ViewAndroid {
26 public: 27 public:
27 // Used to construct a root view. 28 // Used to construct a root view.
28 ViewAndroid(const base::android::JavaRef<jobject>& delegate, 29 ViewAndroid(const base::android::JavaRef<jobject>& context,
30 const base::android::JavaRef<jobject>& delegate,
29 WindowAndroid* root_window); 31 WindowAndroid* root_window);
30 32
33 static bool RegisterWindowAndroid(JNIEnv* env);
34
31 // Used to construct a child view. 35 // Used to construct a child view.
32 ViewAndroid(); 36 ViewAndroid();
33 ~ViewAndroid(); 37 ~ViewAndroid();
34 38
35 // Returns the window at the root of this hierarchy, or |null| 39 // Returns the window at the root of this hierarchy, or |null|
36 // if disconnected. 40 // if disconnected.
37 WindowAndroid* GetWindowAndroid() const; 41 WindowAndroid* GetWindowAndroid() const;
38 42
39 // Set the root |WindowAndroid|. This is only valid for root 43 // Set the root |WindowAndroid|. This is only valid for root
40 // nodes and must not be called for children. 44 // nodes and must not be called for children.
41 void SetWindowAndroid(WindowAndroid* root_window); 45 void SetWindowAndroid(WindowAndroid* root_window);
42 46
43 // Returns the Java delegate for this view. This is used to delegate work
44 // up to the embedding view (or the embedder that can deal with the
45 // implementation details).
46 const base::android::JavaRef<jobject>& GetViewAndroidDelegate() const;
47
48 // Used to return and set the layer for this view. May be |null|. 47 // Used to return and set the layer for this view. May be |null|.
49 cc::Layer* GetLayer() const; 48 cc::Layer* GetLayer() const;
50 void SetLayer(scoped_refptr<cc::Layer> layer); 49 void SetLayer(scoped_refptr<cc::Layer> layer);
51 50
52 // Add/remove this view as a child of another view. 51 // Add/remove this view as a child of another view.
53 void AddChild(ViewAndroid* child); 52 void AddChild(ViewAndroid* child);
54 void RemoveChild(ViewAndroid* child); 53 void RemoveChild(ViewAndroid* child);
55 54
55 base::android::ScopedJavaLocalRef<jobject> AcquireAnchorView();
56 void SetAnchorRect(const jobject& anchor,
no sievers 2016/07/14 23:14:32 nit: you can use 'const JavaRef<jobject>&>' for th
Jinsuk Kim 2016/07/15 05:46:27 Done.
57 const gfx::RectF& bounds);
58 void RemoveAnchorView(const jobject& anchor);
59
56 private: 60 private:
57 ViewAndroid* parent_; 61 ViewAndroid* parent_;
58 std::list<ViewAndroid*> children_; 62 std::list<ViewAndroid*> children_;
59 WindowAndroid* window_; 63 WindowAndroid* window_;
60 scoped_refptr<cc::Layer> layer_; 64 scoped_refptr<cc::Layer> layer_;
65 base::android::ScopedJavaGlobalRef<jobject> java_ref_;
61 base::android::ScopedJavaGlobalRef<jobject> delegate_; 66 base::android::ScopedJavaGlobalRef<jobject> delegate_;
62 67
63 DISALLOW_COPY_AND_ASSIGN(ViewAndroid); 68 DISALLOW_COPY_AND_ASSIGN(ViewAndroid);
64 }; 69 };
65 70
66 } // namespace ui 71 } // namespace ui
67 72
68 #endif // UI_ANDROID_VIEW_ANDROID_H_ 73 #endif // UI_ANDROID_VIEW_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698