input_method_surface.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2018 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 COMPONENTS_EXO_INPUT_METHOD_SURFACE_H_
  5. #define COMPONENTS_EXO_INPUT_METHOD_SURFACE_H_
  6. #include "components/exo/client_controlled_shell_surface.h"
  7. #include "components/exo/surface_delegate.h"
  8. #include "components/exo/surface_observer.h"
  9. namespace exo {
  10. class InputMethodSurfaceManager;
  11. // Handles input method surface role of a given surface.
  12. class InputMethodSurface : public ClientControlledShellSurface {
  13. public:
  14. InputMethodSurface(InputMethodSurfaceManager* manager,
  15. Surface* surface,
  16. bool default_scale_cancellation);
  17. InputMethodSurface(const InputMethodSurface&) = delete;
  18. InputMethodSurface& operator=(const InputMethodSurface&) = delete;
  19. ~InputMethodSurface() override;
  20. static exo::InputMethodSurface* GetInputMethodSurface();
  21. // Overridden from SurfaceDelegate:
  22. void OnSurfaceCommit() override;
  23. // Overridden from ShellSurfaceBase:
  24. void SetWidgetBounds(const gfx::Rect& bounds,
  25. bool adjusted_by_server) override;
  26. gfx::Rect GetBounds() const;
  27. private:
  28. InputMethodSurfaceManager* const manager_;
  29. bool added_to_manager_ = false;
  30. // The bounds of this surface in DIP.
  31. gfx::Rect input_method_bounds_;
  32. };
  33. } // namespace exo
  34. #endif // COMPONENTS_EXO_INPUT_METHOD_SURFACE_H_