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