blob: 5dda57db881bb6d822ab00bf59927bfa78cd713e [file] [log] [blame]
Avi Drissman3e1a26c2022-09-15 20:26:031// Copyright 2016 The Chromium Authors
timavfe53c2c62016-11-23 02:35:462// 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
Nick Diego Yamane7b59df542024-06-10 21:24:5410#include <optional>
11
timavfe53c2c62016-11-23 02:35:4612#include "base/android/jni_android.h"
timavfe53c2c62016-11-23 02:35:4613#include "ui/display/screen_base.h"
Bo Liu71ca79c2019-02-26 18:01:2414#include "ui/gfx/geometry/size.h"
timavfe53c2c62016-11-23 02:35:4615
16namespace ui {
17
Bo Liu71ca79c2019-02-26 18:01:2418class WindowAndroid;
19
timavfe53c2c62016-11-23 02:35:4620class DisplayAndroidManager : public display::ScreenBase {
21 public:
Peter Boströmc8c12352021-09-21 23:37:1522 DisplayAndroidManager(const DisplayAndroidManager&) = delete;
23 DisplayAndroidManager& operator=(const DisplayAndroidManager&) = delete;
24
timavfe53c2c62016-11-23 02:35:4625 ~DisplayAndroidManager() override;
26
27 // Screen interface.
28
jinsukkim2dd85f32017-03-17 01:54:2829 display::Display GetDisplayNearestWindow(
30 gfx::NativeWindow window) const override;
31 display::Display GetDisplayNearestView(gfx::NativeView view) const override;
timavfe53c2c62016-11-23 02:35:4632 display::Display GetDisplayNearestPoint(
33 const gfx::Point& point) const override;
34 display::Display GetDisplayMatching(
35 const gfx::Rect& match_rect) const override;
Nick Diego Yamane7b59df542024-06-10 21:24:5436 std::optional<float> GetPreferredScaleFactorForView(
37 gfx::NativeView view) const override;
timavfe53c2c62016-11-23 02:35:4638
39 // Methods called from Java.
40
41 void UpdateDisplay(JNIEnv* env,
42 const base::android::JavaParamRef<jobject>& jobject,
43 jint sdkDisplayId,
timavfe53c2c62016-11-23 02:35:4644 jint width,
45 jint height,
46 jfloat dipScale,
47 jint rotationDegrees,
48 jint bitsPerPixel,
Christopher Cameronbc1ae6d2017-07-18 05:20:4649 jint bitsPerComponent,
Bo Liu55dc9d6b2023-04-20 12:22:0150 jboolean isWideColorGamut,
Christopher Cameron50ca5c72023-09-26 15:44:42