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

Side by Side 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 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>
9
8 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/memory/ref_counted.h"
9 #include "ui/android/ui_android_export.h" 12 #include "ui/android/ui_android_export.h"
10 13
14 namespace cc {
15 class Layer;
16 }
17
11 namespace ui { 18 namespace ui {
12 19
13 class WindowAndroid; 20 class WindowAndroid;
14 21
15 // This is a NativeView interface for getting access to 22 // A simple container for a UI layer.
16 // WindowAndroid(NativeWindow). 23 // At the root of the hierarchy is a WindowAndroid.
24 //
17 class UI_ANDROID_EXPORT ViewAndroid { 25 class UI_ANDROID_EXPORT ViewAndroid {
18 public: 26 public:
19 virtual WindowAndroid* GetWindowAndroid() const = 0; 27 // Used to construct a root view.
28 ViewAndroid(const base::android::JavaRef<jobject>& delegate,
29 WindowAndroid* root_window);
20 30
21 virtual base::android::ScopedJavaLocalRef<jobject> 31 // Used to construct a child view.
22 GetViewAndroidDelegate() const = 0 ; 32 ViewAndroid();
33 ~ViewAndroid();
23 34
24 protected: 35 // Returns the window at the root of this hierarchy, or |null|
25 virtual ~ViewAndroid() {} 36 // if disconnected.
37 WindowAndroid* GetWindowAndroid() const;
38
39 // Set the root |WindowAndroid|. This is only valid for root
40 // nodes and must not be called for children.
41 void SetWindowAndroid(WindowAndroid* root_window);
42
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|.
49 cc::Layer* GetLayer() const;
50 void SetLayer(scoped_refptr<cc::Layer> layer);
51
52 // Add/remove this view as a child of another view.
53 void AddChild(ViewAndroid* child);
54 void RemoveChild(ViewAndroid* child);
55
56 private:
57 ViewAndroid* parent_;
58 std::list<ViewAndroid*> children_;
59 WindowAndroid* window_;
60 scoped_refptr<cc::Layer> layer_;
61 base::android::ScopedJavaGlobalRef<jobject> delegate_;
62
63 DISALLOW_COPY_AND_ASSIGN(ViewAndroid);
26 }; 64 };
27 65
28 } // namespace ui 66 } // namespace ui
29 67
30 #endif // UI_ANDROID_VIEW_ANDROID_H_ 68 #endif // UI_ANDROID_VIEW_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698