OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_ANDROID_DISPLAY_ANDROID_MANAGER_H_ |
| 6 #define UI_ANDROID_DISPLAY_ANDROID_MANAGER_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 #include <map> |
| 10 |
| 11 #include "base/android/jni_android.h" |
| 12 #include "base/macros.h" |
| 13 #include "ui/display/screen.h" |
| 14 |
| 15 namespace ui { |
| 16 |
| 17 class DisplayAndroidManager : public display::Screen { |
| 18 public: |
| 19 ~DisplayAndroidManager() override; |
| 20 |
| 21 // Screen interface. |
| 22 |
| 23 gfx::Point GetCursorScreenPoint() override; |
| 24 bool IsWindowUnderCursor(gfx::NativeWindow window) override; |
| 25 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 26 int GetNumDisplays() const override; |
| 27 std::vector<display::Display> GetAllDisplays() const override; |
| 28 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| 29 display::Display GetDisplayNearestPoint( |
| 30 const gfx::Point& point) const override; |
| 31 display::Display GetDisplayMatching( |
| 32 const gfx::Rect& match_rect) const override; |
| 33 display::Display GetPrimaryDisplay() const override; |
| 34 void AddObserver(display::DisplayObserver* observer) override; |
| 35 void RemoveObserver(display::DisplayObserver* observer) override; |
| 36 |
| 37 // Methods called from Java. |
| 38 |
| 39 void UpdateDisplay(JNIEnv* env, |
| 40 const base::android::JavaParamRef<jobject>& jobject, |
| 41 jint sdkDisplayId, |
| 42 jint physicalWidth, |
| 43 jint physicalHeight, |
| 44 jint width, |
| 45 jint height, |
| 46 jfloat dipScale, |
| 47 jint rotationDegrees, |
| 48 jint bitsPerPixel, |
| 49 jint bitsPerComponent); |
| 50 void RemoveDisplay(JNIEnv* env, |
| 51 const base::android::JavaParamRef<jobject>& jobject, |
| 52 jint sdkDisplayId); |
| 53 void SetPrimaryDisplayId(JNIEnv* env, |
| 54 const base::android::JavaParamRef<jobject>& jobject, |
| 55 jint sdkDisplayId); |
| 56 |
| 57 private: |
| 58 friend void SetScreenAndroid(); |
| 59 DisplayAndroidManager(); |
| 60 |
| 61 using DisplayMap = std::map<int, display::Display>; |
| 62 DisplayMap displays_; |
| 63 int primary_display_id_ = 0; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(DisplayAndroidManager); |
| 66 }; |
| 67 |
| 68 } // namespace ui |
| 69 |
| 70 #endif // UI_ANDROID_DISPLAY_ANDROID_MANAGER_H_ |
OLD | NEW |