Yuichiro Hanada | fe5239c | 2018-07-17 09:59:52 | [diff] [blame] | 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 | |
| 5 | #ifndef COMPONENTS_EXO_INPUT_METHOD_SURFACE_H_ |
| 6 | #define COMPONENTS_EXO_INPUT_METHOD_SURFACE_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "components/exo/client_controlled_shell_surface.h" |
| 10 | #include "components/exo/surface_delegate.h" |
| 11 | #include "components/exo/surface_observer.h" |
| 12 | |
| 13 | namespace exo { |
| 14 | |
| 15 | class InputMethodSurfaceManager; |
| 16 | |
| 17 | // Handles input method surface role of a given surface. |
| 18 | class InputMethodSurface : public ClientControlledShellSurface { |
| 19 | public: |
| 20 | InputMethodSurface(InputMethodSurfaceManager* manager, |
| 21 | Surface* surface, |
Prabir Pradhan | 875083e | 2020-07-22 20:06:27 | [diff] [blame] | 22 | bool default_scale_cancellation); |
Yuichiro Hanada | fe5239c | 2018-07-17 09:59:52 | [diff] [blame] | 23 | ~InputMethodSurface() override; |
| 24 | |
Yuki Awano | 35a19bd | 2018-12-12 01:35:05 | [diff] [blame] | 25 | static exo::InputMethodSurface* GetInputMethodSurface(); |
| 26 | |
Yuichiro Hanada | fe5239c | 2018-07-17 09:59:52 | [diff] [blame] | 27 | // Overridden from SurfaceDelegate: |
| 28 | void OnSurfaceCommit() override; |
| 29 | |
Tetsui Ohkubo | 57fcf73 | 2020-02-10 03:09:10 | [diff] [blame] | 30 | // Overridden from ShellSurfaceBase: |
| 31 | void SetWidgetBounds(const gfx::Rect& bounds) override; |
| 32 | |
Yuichiro Hanada | dc02dd3 | 2018-09-13 03:09:06 | [diff] [blame] | 33 | gfx::Rect GetBounds() const; |
| 34 | |
Yuichiro Hanada | fe5239c | 2018-07-17 09:59:52 | [diff] [blame] | 35 | private: |
| 36 | InputMethodSurfaceManager* const manager_; |
| 37 | bool added_to_manager_ = false; |
Yuichiro Hanada | 5eb4d262 | 2019-01-30 01:32:15 | [diff] [blame] | 38 | // The bounds of this surface in DIP. |
Yuichiro Hanada | dc02dd3 | 2018-09-13 03:09:06 | [diff] [blame] | 39 | gfx::Rect input_method_bounds_; |
Yuichiro Hanada | fe5239c | 2018-07-17 09:59:52 | [diff] [blame] | 40 | |
| 41 | DISALLOW_COPY_AND_ASSIGN(InputMethodSurface); |
| 42 | }; |
| 43 | |
| 44 | } // namespace exo |
| 45 | |
| 46 | #endif // COMPONENTS_EXO_INPUT_METHOD_SURFACE_H_ |