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; | |
27 class RootWindowTransformer; | 26 class RootWindowTransformer; |
28 | 27 |
29 class ASH_EXPORT AshWindowTreeHost { | 28 class ASH_EXPORT AshWindowTreeHost { |
30 public: | 29 public: |
31 AshWindowTreeHost(); | 30 AshWindowTreeHost(); |
32 virtual ~AshWindowTreeHost(); | 31 virtual ~AshWindowTreeHost(); |
33 | 32 |
34 static std::unique_ptr<AshWindowTreeHost> Create( | 33 static std::unique_ptr<AshWindowTreeHost> Create( |
35 const AshWindowTreeHostInitParams& init_params); | 34 const AshWindowTreeHostInitParams& init_params); |
36 | 35 |
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 | |
45 // Toggles the host's full screen state. | 36 // Toggles the host's full screen state. |
46 virtual void ToggleFullScreen() = 0; | 37 virtual void ToggleFullScreen() = 0; |
47 | 38 |
48 // Clips the cursor to the bounds of the root window until UnConfineCursor(). | 39 // Clips the cursor to the bounds of the root window until UnConfineCursor(). |
49 // We would like to be able to confine the cursor to that window. However, | 40 // We would like to be able to confine the cursor to that window. However, |
50 // currently, we do not have such functionality in X. So we just confine | 41 // currently, we do not have such functionality in X. So we just confine |
51 // to the root window. This is ok because this option is currently only | 42 // to the root window. This is ok because this option is currently only |
52 // being used in fullscreen mode, so root_window bounds = window bounds. | 43 // being used in fullscreen mode, so root_window bounds = window bounds. |
53 virtual bool ConfineCursorToRootWindow() = 0; | 44 virtual bool ConfineCursorToRootWindow() = 0; |
54 virtual void UnConfineCursor() = 0; | 45 virtual void UnConfineCursor() = 0; |
55 | 46 |
56 virtual void SetRootWindowTransformer( | 47 virtual void SetRootWindowTransformer( |
57 std::unique_ptr<RootWindowTransformer> transformer) = 0; | 48 std::unique_ptr<RootWindowTransformer> transformer) = 0; |
58 | 49 |
59 virtual gfx::Insets GetHostInsets() const = 0; | 50 virtual gfx::Insets GetHostInsets() const = 0; |
60 | 51 |
61 virtual aura::WindowTreeHost* AsWindowTreeHost() = 0; | 52 virtual aura::WindowTreeHost* AsWindowTreeHost() = 0; |
62 | 53 |
63 // Stop listening for events in preparation for shutdown. | 54 // Stop listening for events in preparation for shutdown. |
64 virtual void PrepareForShutdown() {} | 55 virtual void PrepareForShutdown() {} |
65 | 56 |
66 virtual void RegisterMirroringHost(AshWindowTreeHost* mirroring_ash_host) {} | 57 virtual void RegisterMirroringHost(AshWindowTreeHost* mirroring_ash_host) {} |
67 | 58 |
68 protected: | 59 protected: |
69 // Translates the native mouse location into screen coordinates. | 60 // Translates the native mouse location into screen coordinates. |
70 void TranslateLocatedEvent(ui::LocatedEvent* event); | 61 void TranslateLocatedEvent(ui::LocatedEvent* event); |
71 | |
72 private: | |
73 InputMethodEventHandler* input_method_handler_; | |
74 }; | 62 }; |
75 | 63 |
76 } // namespace ash | 64 } // namespace ash |
77 | 65 |
78 #endif // ASH_HOST_ASH_WINDOW_TREE_HOST_H_ | 66 #endif // ASH_HOST_ASH_WINDOW_TREE_HOST_H_ |
OLD | NEW |