shell_screen.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2014 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 EXTENSIONS_SHELL_BROWSER_SHELL_SCREEN_H_
  5. #define EXTENSIONS_SHELL_BROWSER_SHELL_SCREEN_H_
  6. #include "ui/aura/window_tree_host_observer.h"
  7. #include "ui/display/display.h"
  8. #include "ui/display/screen_base.h"
  9. namespace aura {
  10. class WindowTreeHost;
  11. }
  12. namespace gfx {
  13. class Size;
  14. }
  15. namespace extensions {
  16. class ShellDesktopControllerAura;
  17. // A minimal Aura implementation of a screen. Scale factor is locked at 1.0.
  18. // When running on a Linux desktop resizing the main window resizes the screen.
  19. class ShellScreen : public display::ScreenBase,
  20. public aura::WindowTreeHostObserver {
  21. public:
  22. // Creates a screen occupying |size| physical pixels. |desktop_controller|
  23. // can be null in tests.
  24. ShellScreen(ShellDesktopControllerAura* desktop_controller,
  25. const gfx::Size& size);
  26. ShellScreen(const ShellScreen&) = delete;
  27. ShellScreen& operator=(const ShellScreen&) = delete;
  28. ~ShellScreen() override;
  29. // aura::WindowTreeHostObserver overrides:
  30. void OnHostResized(aura::WindowTreeHost* host) override;
  31. // display::Screen overrides:
  32. gfx::Point GetCursorScreenPoint() override;
  33. bool IsWindowUnderCursor(gfx::NativeWindow window) override;
  34. gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
  35. display::Display GetDisplayNearestWindow(
  36. gfx::NativeWindow window) const override;
  37. private:
  38. ShellDesktopControllerAura* const desktop_controller_;
  39. };
  40. } // namespace extensions
  41. #endif // EXTENSIONS_SHELL_BROWSER_SHELL_SCREEN_H_