| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/android/jni_weak_ref.h" | 13 #include "base/android/jni_weak_ref.h" |
| 14 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "ui/android/ui_android_export.h" | 18 #include "ui/android/ui_android_export.h" |
| 19 #include "ui/android/view_android.h" | |
| 20 #include "ui/gfx/geometry/vector2d_f.h" | 19 #include "ui/gfx/geometry/vector2d_f.h" |
| 21 | 20 |
| 22 namespace cc { | 21 namespace cc { |
| 23 class BeginFrameSource; | 22 class BeginFrameSource; |
| 24 } // namespace cc | 23 } // namespace cc |
| 25 | 24 |
| 26 namespace display { | 25 namespace display { |
| 27 class DisplayAndroidManager; | 26 class DisplayAndroidManager; |
| 28 } // namespace display | 27 } // namespace display |
| 29 | 28 |
| 30 namespace ui { | 29 namespace ui { |
| 31 | 30 |
| 32 class WindowAndroidCompositor; | 31 class WindowAndroidCompositor; |
| 33 class WindowAndroidObserver; | 32 class WindowAndroidObserver; |
| 34 | 33 |
| 35 // Android implementation of the activity window. | 34 // Android implementation of the activity window. |
| 36 // WindowAndroid is also the root of a ViewAndroid tree. | 35 class UI_ANDROID_EXPORT WindowAndroid { |
| 37 class UI_ANDROID_EXPORT WindowAndroid : public ViewAndroid { | |
| 38 public: | 36 public: |
| 39 WindowAndroid(JNIEnv* env, jobject obj, int display_id); | 37 WindowAndroid(JNIEnv* env, jobject obj, int display_id); |
| 40 | 38 |
| 41 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 39 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 42 | 40 |
| 43 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 41 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 44 | 42 |
| 45 static bool RegisterWindowAndroid(JNIEnv* env); | 43 static bool RegisterWindowAndroid(JNIEnv* env); |
| 46 | 44 |
| 47 // The content offset in CSS pixels. It is used together with device scale | 45 // The content offset in CSS pixels. It is used together with device scale |
| (...skipping 24 matching lines...) Expand all Loading... |
| 72 const base::android::JavaParamRef<jobject>& obj, | 70 const base::android::JavaParamRef<jobject>& obj, |
| 73 jlong time_micros, | 71 jlong time_micros, |
| 74 jlong period_micros); | 72 jlong period_micros); |
| 75 void OnVisibilityChanged(JNIEnv* env, | 73 void OnVisibilityChanged(JNIEnv* env, |
| 76 const base::android::JavaParamRef<jobject>& obj, | 74 const base::android::JavaParamRef<jobject>& obj, |
| 77 bool visible); | 75 bool visible); |
| 78 void OnActivityStopped(JNIEnv* env, | 76 void OnActivityStopped(JNIEnv* env, |
| 79 const base::android::JavaParamRef<jobject>& obj); | 77 const base::android::JavaParamRef<jobject>& obj); |
| 80 void OnActivityStarted(JNIEnv* env, | 78 void OnActivityStarted(JNIEnv* env, |
| 81 const base::android::JavaParamRef<jobject>& obj); | 79 const base::android::JavaParamRef<jobject>& obj); |
| 82 base::android::ScopedJavaLocalRef<jobject> GetViewRootForJava(JNIEnv* env, | |
| 83 const base::android::JavaParamRef<jobject>& obj); | |
| 84 | 80 |
| 85 // Return whether the specified Android permission is granted. | 81 // Return whether the specified Android permission is granted. |
| 86 bool HasPermission(const std::string& permission); | 82 bool HasPermission(const std::string& permission); |
| 87 // Return whether the specified Android permission can be requested by Chrome. | 83 // Return whether the specified Android permission can be requested by Chrome. |
| 88 bool CanRequestPermission(const std::string& permission); | 84 bool CanRequestPermission(const std::string& permission); |
| 89 | 85 |
| 90 static WindowAndroid* CreateForTesting(); | 86 static WindowAndroid* CreateForTesting(); |
| 91 void DestroyForTesting(); | 87 void DestroyForTesting(); |
| 92 | 88 |
| 93 private: | 89 private: |
| 94 class WindowBeginFrameSource; | 90 class WindowBeginFrameSource; |
| 95 friend class DisplayAndroidManager; | 91 friend class DisplayAndroidManager; |
| 96 friend class WindowBeginFrameSource; | 92 friend class WindowBeginFrameSource; |
| 97 | 93 |
| 98 ~WindowAndroid() override; | 94 ~WindowAndroid(); |
| 99 | 95 |
| 100 void SetNeedsBeginFrames(bool needs_begin_frames); | 96 void SetNeedsBeginFrames(bool needs_begin_frames); |
| 101 void RequestVSyncUpdate(); | 97 void RequestVSyncUpdate(); |
| 102 | 98 |
| 103 // ViewAndroid overrides. | |
| 104 WindowAndroid* GetWindowAndroid() const override; | |
| 105 | |
| 106 // The ID of the display that this window belongs to. | 99 // The ID of the display that this window belongs to. |
| 107 int display_id() const { return display_id_; } | 100 int display_id() const { return display_id_; } |
| 108 | 101 |
| 109 base::android::ScopedJavaGlobalRef<jobject> java_window_; | 102 base::android::ScopedJavaGlobalRef<jobject> java_window_; |
| 110 const int display_id_; | 103 const int display_id_; |
| 111 gfx::Vector2dF content_offset_; | 104 gfx::Vector2dF content_offset_; |
| 112 WindowAndroidCompositor* compositor_; | 105 WindowAndroidCompositor* compositor_; |
| 113 | 106 |
| 114 base::ObserverList<WindowAndroidObserver> observer_list_; | 107 base::ObserverList<WindowAndroidObserver> observer_list_; |
| 115 | 108 |
| 116 std::unique_ptr<WindowBeginFrameSource> begin_frame_source_; | 109 std::unique_ptr<WindowBeginFrameSource> begin_frame_source_; |
| 117 bool needs_begin_frames_; | 110 bool needs_begin_frames_; |
| 118 | 111 |
| 119 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); | 112 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); |
| 120 }; | 113 }; |
| 121 | 114 |
| 122 } // namespace ui | 115 } // namespace ui |
| 123 | 116 |
| 124 #endif // UI_ANDROID_WINDOW_ANDROID_H_ | 117 #endif // UI_ANDROID_WINDOW_ANDROID_H_ |
| OLD | NEW |