OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_HOST_ASH_WINDOW_TREE_HOST_H_ | 5 #ifndef ASH_HOST_ASH_WINDOW_TREE_HOST_H_ |
6 #define ASH_HOST_ASH_WINDOW_TREE_HOST_H_ | 6 #define ASH_HOST_ASH_WINDOW_TREE_HOST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 | 11 |
12 namespace aura { | 12 namespace aura { |
13 class WindowTreeHost; | 13 class WindowTreeHost; |
14 } | 14 } |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Insets; | 17 class Insets; |
18 } | 18 } |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 class LocatedEvent; | 21 class LocatedEvent; |
22 } | 22 } |
23 | 23 |
24 namespace ash { | 24 namespace ash { |
25 struct AshWindowTreeHostInitParams; | 25 struct AshWindowTreeHostInitParams; |
| 26 class InputMethodEventHandler; |
26 class RootWindowTransformer; | 27 class RootWindowTransformer; |
27 | 28 |
28 class ASH_EXPORT AshWindowTreeHost { | 29 class ASH_EXPORT AshWindowTreeHost { |
29 public: | 30 public: |
30 AshWindowTreeHost(); | 31 AshWindowTreeHost(); |
31 virtual ~AshWindowTreeHost(); | 32 virtual ~AshWindowTreeHost(); |
32 | 33 |
33 static std::unique_ptr<AshWindowTreeHost> Create( | 34 static std::unique_ptr<AshWindowTreeHost> Create( |
34 const AshWindowTreeHostInitParams& init_params); | 35 const AshWindowTreeHostInitParams& init_params); |
35 | 36 |
| 37 void set_input_method_handler(InputMethodEventHandler* input_method_handler) { |
| 38 input_method_handler_ = input_method_handler; |
| 39 } |
| 40 |
| 41 InputMethodEventHandler* input_method_handler() { |
| 42 return input_method_handler_; |
| 43 } |
| 44 |
36 // Toggles the host's full screen state. | 45 // Toggles the host's full screen state. |
37 virtual void ToggleFullScreen() = 0; | 46 virtual void ToggleFullScreen() = 0; |
38 | 47 |
39 // Clips the cursor to the bounds of the root window until UnConfineCursor(). | 48 // Clips the cursor to the bounds of the root window until UnConfineCursor(). |
40 // We would like to be able to confine the cursor to that window. However, | 49 // We would like to be able to confine the cursor to that window. However, |
41 // currently, we do not have such functionality in X. So we just confine | 50 // currently, we do not have such functionality in X. So we just confine |
42 // to the root window. This is ok because this option is currently only | 51 // to the root window. This is ok because this option is currently only |
43 // being used in fullscreen mode, so root_window bounds = window bounds. | 52 // being used in fullscreen mode, so root_window bounds = window bounds. |
44 virtual bool ConfineCursorToRootWindow() = 0; | 53 virtual bool ConfineCursorToRootWindow() = 0; |
45 virtual void UnConfineCursor() = 0; | 54 virtual void UnConfineCursor() = 0; |
46 | 55 |
47 virtual void SetRootWindowTransformer( | 56 virtual void SetRootWindowTransformer( |
48 std::unique_ptr<RootWindowTransformer> transformer) = 0; | 57 std::unique_ptr<RootWindowTransformer> transformer) = 0; |
49 | 58 |
50 virtual gfx::Insets GetHostInsets() const = 0; | 59 virtual gfx::Insets GetHostInsets() const = 0; |
51 | 60 |
52 virtual aura::WindowTreeHost* AsWindowTreeHost() = 0; | 61 virtual aura::WindowTreeHost* AsWindowTreeHost() = 0; |
53 | 62 |
54 // Stop listening for events in preparation for shutdown. | 63 // Stop listening for events in preparation for shutdown. |
55 virtual void PrepareForShutdown() {} | 64 virtual void PrepareForShutdown() {} |
56 | 65 |
57 virtual void RegisterMirroringHost(AshWindowTreeHost* mirroring_ash_host) {} | 66 virtual void RegisterMirroringHost(AshWindowTreeHost* mirroring_ash_host) {} |
58 | 67 |
59 protected: | 68 protected: |
60 // Translates the native mouse location into screen coordinates. | 69 // Translates the native mouse location into screen coordinates. |
61 void TranslateLocatedEvent(ui::LocatedEvent* event); | 70 void TranslateLocatedEvent(ui::LocatedEvent* event); |
| 71 |
| 72 private: |
| 73 InputMethodEventHandler* input_method_handler_; |
62 }; | 74 }; |
63 | 75 |
64 } // namespace ash | 76 } // namespace ash |
65 | 77 |
66 #endif // ASH_HOST_ASH_WINDOW_TREE_HOST_H_ | 78 #endif // ASH_HOST_ASH_WINDOW_TREE_HOST_H_ |
OLD | NEW |