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_BASE_ANDROID_WINDOW_ANDROID_H_ | 5 #ifndef UI_BASE_ANDROID_WINDOW_ANDROID_H_ |
6 #define UI_BASE_ANDROID_WINDOW_ANDROID_H_ | 6 #define UI_BASE_ANDROID_WINDOW_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/containers/scoped_ptr_hash_map.h" | |
12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "cc/resources/ui_resource_client.h" | |
14 #include "ui/base/ui_base_export.h" | 16 #include "ui/base/ui_base_export.h" |
15 #include "ui/gfx/vector2d_f.h" | 17 #include "ui/gfx/vector2d_f.h" |
16 | 18 |
17 namespace ui { | 19 namespace ui { |
18 | 20 |
21 class UIResourceClientAndroid; | |
19 class WindowAndroidCompositor; | 22 class WindowAndroidCompositor; |
20 class WindowAndroidObserver; | 23 class WindowAndroidObserver; |
21 | 24 |
22 // Android implementation of the activity window. | 25 // Android implementation of the activity window. |
23 class UI_BASE_EXPORT WindowAndroid { | 26 class UI_BASE_EXPORT WindowAndroid { |
24 public: | 27 public: |
28 enum SystemUIResource { | |
29 OVERSCROLL_EDGE, | |
30 OVERSCROLL_GLOW | |
31 }; | |
32 | |
25 WindowAndroid(JNIEnv* env, jobject obj, jlong vsync_period); | 33 WindowAndroid(JNIEnv* env, jobject obj, jlong vsync_period); |
26 | 34 |
27 void Destroy(JNIEnv* env, jobject obj); | 35 void Destroy(JNIEnv* env, jobject obj); |
28 | 36 |
29 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 37 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
30 | 38 |
31 static bool RegisterWindowAndroid(JNIEnv* env); | 39 static bool RegisterWindowAndroid(JNIEnv* env); |
32 | 40 |
33 // The content offset is used to translate snapshots to the correct part of | 41 // The content offset is used to translate snapshots to the correct part of |
34 // the window. | 42 // the window. |
(...skipping 14 matching lines...) Expand all Loading... | |
49 void AddObserver(WindowAndroidObserver* observer); | 57 void AddObserver(WindowAndroidObserver* observer); |
50 void RemoveObserver(WindowAndroidObserver* observer); | 58 void RemoveObserver(WindowAndroidObserver* observer); |
51 | 59 |
52 WindowAndroidCompositor* GetCompositor() { return compositor_; } | 60 WindowAndroidCompositor* GetCompositor() { return compositor_; } |
53 | 61 |
54 void RequestVSyncUpdate(); | 62 void RequestVSyncUpdate(); |
55 void SetNeedsAnimate(); | 63 void SetNeedsAnimate(); |
56 void OnVSync(JNIEnv* env, jobject obj, jlong time_micros); | 64 void OnVSync(JNIEnv* env, jobject obj, jlong time_micros); |
57 void Animate(base::TimeTicks begin_frame_time); | 65 void Animate(base::TimeTicks begin_frame_time); |
58 | 66 |
67 void InitializeSystemUIResource(SystemUIResource system_resource, | |
powei
2014/07/08 19:12:43
having this feels a little awkward, but since ui d
jdduke (slow)
2014/07/08 20:10:11
Hmm, who is responsible for calling this now for t
powei
2014/07/12 00:24:46
Done. Moved resource loading to system_ui_resource
| |
68 scoped_ptr<UIResourceClientAndroid> resource); | |
69 | |
70 cc::UIResourceId GetSystemUIResource(SystemUIResource system_resource); | |
jdduke (slow)
2014/07/08 20:10:11
Is it worth making this method const?
jdduke (slow)
2014/07/08 20:42:08
This pull and push model makes synchronization som
powei
2014/07/09 20:41:03
A subscriber model sounds good. Although it would
jdduke (slow)
2014/07/09 21:12:13
Are there any downsides? I'm thinking perhaps we p
powei
2014/07/09 23:43:14
So we'll need another interface like ui::SystemUIR
| |
71 | |
59 private: | 72 private: |
60 ~WindowAndroid(); | 73 ~WindowAndroid(); |
61 | 74 |
62 JavaObjectWeakGlobalRef weak_java_window_; | 75 JavaObjectWeakGlobalRef weak_java_window_; |
63 gfx::Vector2dF content_offset_; | 76 gfx::Vector2dF content_offset_; |
64 WindowAndroidCompositor* compositor_; | 77 WindowAndroidCompositor* compositor_; |
65 base::TimeDelta vsync_period_; | 78 base::TimeDelta vsync_period_; |
66 | 79 |
67 ObserverList<WindowAndroidObserver> observer_list_; | 80 ObserverList<WindowAndroidObserver> observer_list_; |
68 | 81 |
82 typedef base::ScopedPtrHashMap<int, UIResourceClientAndroid> UIResourceMap; | |
83 UIResourceMap ui_resource_map_; | |
84 | |
69 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); | 85 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); |
70 }; | 86 }; |
71 | 87 |
72 } // namespace ui | 88 } // namespace ui |
73 | 89 |
74 #endif // UI_BASE_ANDROID_WINDOW_ANDROID_H_ | 90 #endif // UI_BASE_ANDROID_WINDOW_ANDROID_H_ |
OLD | NEW |