| 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_WINDOW_ANDROID_H_ | 5 #ifndef UI_ANDROID_WINDOW_ANDROID_H_ |
| 6 #define UI_ANDROID_WINDOW_ANDROID_H_ | 6 #define UI_ANDROID_WINDOW_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/android/jni_weak_ref.h" | 14 #include "base/android/jni_weak_ref.h" |
| 15 #include "base/android/scoped_java_ref.h" | 15 #include "base/android/scoped_java_ref.h" |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "ui/android/ui_android_export.h" | 20 #include "ui/android/ui_android_export.h" |
| 21 #include "ui/android/view_android.h" | |
| 22 #include "ui/gfx/geometry/vector2d_f.h" | 21 #include "ui/gfx/geometry/vector2d_f.h" |
| 23 | 22 |
| 24 namespace cc { | 23 namespace cc { |
| 25 class BeginFrameSource; | 24 class BeginFrameSource; |
| 26 } // namespace cc | 25 } // namespace cc |
| 27 | 26 |
| 28 namespace display { | 27 namespace display { |
| 29 class DisplayAndroidManager; | 28 class DisplayAndroidManager; |
| 30 } // namespace display | 29 } // namespace display |
| 31 | 30 |
| 32 namespace ui { | 31 namespace ui { |
| 33 | 32 |
| 34 class WindowAndroidCompositor; | 33 class WindowAndroidCompositor; |
| 35 class WindowAndroidObserver; | 34 class WindowAndroidObserver; |
| 36 | 35 |
| 37 // Android implementation of the activity window. | 36 // Android implementation of the activity window. |
| 38 // WindowAndroid is also the root of a ViewAndroid tree. | 37 class UI_ANDROID_EXPORT WindowAndroid { |
| 39 class UI_ANDROID_EXPORT WindowAndroid : public ViewAndroid { | |
| 40 public: | 38 public: |
| 41 WindowAndroid(JNIEnv* env, jobject obj, int display_id); | 39 WindowAndroid(JNIEnv* env, jobject obj, int display_id); |
| 42 | 40 |
| 43 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 41 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 44 | 42 |
| 45 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 43 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 46 | 44 |
| 47 static bool RegisterWindowAndroid(JNIEnv* env); | 45 static bool RegisterWindowAndroid(JNIEnv* env); |
| 48 | 46 |
| 49 // Compositor callback relay. | 47 // Compositor callback relay. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 bool CanRequestPermission(const std::string& permission); | 79 bool CanRequestPermission(const std::string& permission); |
| 82 | 80 |
| 83 static WindowAndroid* CreateForTesting(); | 81 static WindowAndroid* CreateForTesting(); |
| 84 void DestroyForTesting(); | 82 void DestroyForTesting(); |
| 85 | 83 |
| 86 private: | 84 private: |
| 87 class WindowBeginFrameSource; | 85 class WindowBeginFrameSource; |
| 88 friend class DisplayAndroidManager; | 86 friend class DisplayAndroidManager; |
| 89 friend class WindowBeginFrameSource; | 87 friend class WindowBeginFrameSource; |
| 90 | 88 |
| 91 ~WindowAndroid() override; | 89 ~WindowAndroid(); |
| 92 | 90 |
| 93 void SetNeedsBeginFrames(bool needs_begin_frames); | 91 void SetNeedsBeginFrames(bool needs_begin_frames); |
| 94 void RequestVSyncUpdate(); | 92 void RequestVSyncUpdate(); |
| 95 | 93 |
| 96 // ViewAndroid overrides. | |
| 97 WindowAndroid* GetWindowAndroid() const override; | |
| 98 | |
| 99 // The ID of the display that this window belongs to. | 94 // The ID of the display that this window belongs to. |
| 100 int display_id() const { return display_id_; } | 95 int display_id() const { return display_id_; } |
| 101 | 96 |
| 102 base::android::ScopedJavaGlobalRef<jobject> java_window_; | 97 base::android::ScopedJavaGlobalRef<jobject> java_window_; |
| 103 const int display_id_; | 98 const int display_id_; |
| 104 WindowAndroidCompositor* compositor_; | 99 WindowAndroidCompositor* compositor_; |
| 105 | 100 |
| 106 base::ObserverList<WindowAndroidObserver> observer_list_; | 101 base::ObserverList<WindowAndroidObserver> observer_list_; |
| 107 | 102 |
| 108 std::unique_ptr<WindowBeginFrameSource> begin_frame_source_; | 103 std::unique_ptr<WindowBeginFrameSource> begin_frame_source_; |
| 109 bool needs_begin_frames_; | 104 bool needs_begin_frames_; |
| 110 std::list<base::Closure> vsync_complete_callbacks_; | 105 std::list<base::Closure> vsync_complete_callbacks_; |
| 111 | 106 |
| 112 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); | 107 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); |
| 113 }; | 108 }; |
| 114 | 109 |
| 115 } // namespace ui | 110 } // namespace ui |
| 116 | 111 |
| 117 #endif // UI_ANDROID_WINDOW_ANDROID_H_ | 112 #endif // UI_ANDROID_WINDOW_ANDROID_H_ |
| OLD | NEW |