OLD | NEW |
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. |
17 class UI_ANDROID_EXPORT ViewAndroid { | 24 class UI_ANDROID_EXPORT ViewAndroid { |
18 public: | 25 public: |
19 virtual WindowAndroid* GetWindowAndroid() const = 0; | 26 // Used to construct a root view. |
| 27 ViewAndroid(const base::android::JavaRef<jobject>& delegate, |
| 28 WindowAndroid* root_window); |
20 | 29 |
21 virtual base::android::ScopedJavaLocalRef<jobject> | 30 ViewAndroid(); |
22 GetViewAndroidDelegate() const = 0 ; | 31 ~ViewAndroid(); |
23 | 32 |
24 protected: | 33 WindowAndroid* GetWindowAndroid() const; |
25 virtual ~ViewAndroid() {} | 34 void SetWindowAndroid(WindowAndroid* root_window); |
| 35 const base::android::JavaRef<jobject>& GetViewAndroidDelegate() const; |
| 36 cc::Layer* GetLayer() const; |
| 37 void SetLayer(scoped_refptr<cc::Layer> layer); |
| 38 void AddChild(ViewAndroid* child); |
| 39 void RemoveChild(ViewAndroid* child); |
| 40 |
| 41 private: |
| 42 ViewAndroid* parent_; |
| 43 std::list<ViewAndroid*> children_; |
| 44 WindowAndroid* window_; |
| 45 scoped_refptr<cc::Layer> layer_; |
| 46 base::android::ScopedJavaGlobalRef<jobject> delegate_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(ViewAndroid); |
26 }; | 49 }; |
27 | 50 |
28 } // namespace ui | 51 } // namespace ui |
29 | 52 |
30 #endif // UI_ANDROID_VIEW_ANDROID_H_ | 53 #endif // UI_ANDROID_VIEW_ANDROID_H_ |
OLD | NEW |