screen_base.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #ifndef UI_DISPLAY_SCREEN_BASE_H_
  5. #define UI_DISPLAY_SCREEN_BASE_H_
  6. #include <vector>
  7. #include "ui/display/display.h"
  8. #include "ui/display/display_export.h"
  9. #include "ui/display/display_list.h"
  10. #include "ui/display/screen.h"
  11. namespace display {
  12. // Simple screen implementation with a display list.
  13. class DISPLAY_EXPORT ScreenBase : public Screen {
  14. public:
  15. ScreenBase();
  16. ScreenBase(const ScreenBase&) = delete;
  17. ScreenBase& operator=(const ScreenBase&) = delete;
  18. ~ScreenBase() override;
  19. DisplayList& display_list() { return display_list_; }
  20. const DisplayList& display_list() const { return display_list_; }
  21. // Screen:
  22. gfx::Point GetCursorScreenPoint() override;
  23. bool IsWindowUnderCursor(gfx::NativeWindow window) override;
  24. gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
  25. gfx::NativeWindow GetLocalProcessWindowAtPoint(
  26. const gfx::Point& screen_point,
  27. const std::set<gfx::NativeWindow>& ignore) override;
  28. Display GetPrimaryDisplay() const override;
  29. Display GetDisplayNearestWindow(gfx::NativeWindow window) const override;
  30. Display GetDisplayNearestPoint(const gfx::Point& point) const override;
  31. int GetNumDisplays() const override;
  32. const std::vector<Display>& GetAllDisplays() const override;
  33. Display GetDisplayMatching(const gfx::Rect& match_rect) const override;
  34. void AddObserver(DisplayObserver* observer) override;
  35. void RemoveObserver(DisplayObserver* observer) override;
  36. void SetPanelRotationForTesting(int64_t display_id,
  37. Display::Rotation rotation) override;
  38. bool HasDisplayObservers() const;
  39. protected:
  40. // Invoked when a display changed in some way, including being added.
  41. // If |is_primary| is true, |changed_display| is the primary display.
  42. void ProcessDisplayChanged(const Display& changed_display, bool is_primary);
  43. private:
  44. DisplayList display_list_;
  45. };
  46. } // namespace display
  47. #endif // UI_DISPLAY_SCREEN_BASE_H_