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