| 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(); |
| 20 ~DisplayAndroidManager() override; |
| 21 |
| 22 // Screen interface. |
| 23 |
| 24 gfx::Point GetCursorScreenPoint() override; |
| 25 bool IsWindowUnderCursor(gfx::NativeWindow window) override; |
| 26 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 27 int GetNumDisplays() const override; |
| 28 std::vector<display::Display> GetAllDisplays() const override; |
| 29 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| 30 display::Display GetDisplayNearestPoint( |
| 31 const gfx::Point& point) const override; |
| 32 display::Display GetDisplayMatching( |
| 33 const gfx::Rect& match_rect) const override; |
| 34 display::Display GetPrimaryDisplay() const override; |
| 35 void AddObserver(display::DisplayObserver* observer) override; |
| 36 void RemoveObserver(display::DisplayObserver* observer) override; |
| 37 |
| 38 // Methods called from Java. |
| 39 |
| 40 void UpdateDisplay(JNIEnv* env, |
| 41 const base::android::JavaParamRef<jobject>& jobject, |
| 42 jint sdkDisplayId, |
| 43 jint physicalWidth, |
| 44 jint physicalHeight, |
| 45 jint width, |
| 46 jint height, |
| 47 jfloat dipScale, |
| 48 jint rotationDegrees, |
| 49 jint bitsPerPixel, |
| 50 jint bitsPerComponent); |
| 51 void RemoveDisplay(JNIEnv* env, |
| 52 const base::android::JavaParamRef<jobject>& jobject, |
| 53 jint sdkDisplayId); |
| 54 void SetPrimaryDisplayId(JNIEnv* env, |
| 55 const base::android::JavaParamRef<jobject>& jobject, |
| 56 jint sdkDisplayId); |
| 57 |
| 58 private: |
| 59 using DisplayMap = std::map<int, display::Display>; |
| 60 DisplayMap displays_; |
| 61 int primary_display_id_ = 0; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(DisplayAndroidManager); |
| 64 }; |
| 65 |
| 66 } // namespace ui |
| 67 |
| 68 #endif // UI_ANDROID_DISPLAY_ANDROID_MANAGER_H_ |
| OLD | NEW |