OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ | 5 #ifndef UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ |
6 #define UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ | 6 #define UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "services/service_manager/public/cpp/connector.h" | 14 #include "services/service_manager/public/cpp/connector.h" |
15 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 15 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
16 #include "ui/aura/aura_export.h" | 16 #include "ui/aura/aura_export.h" |
17 #include "ui/aura/window_tree_host_platform.h" | 17 #include "ui/aura/window_tree_host_platform.h" |
18 | 18 |
19 namespace display { | 19 namespace display { |
20 class Display; | 20 class Display; |
21 } | 21 } |
22 | 22 |
| 23 namespace ui { |
| 24 class InputMethodChromeOS; |
| 25 } |
| 26 |
23 namespace aura { | 27 namespace aura { |
24 | 28 |
25 class InputMethodMus; | 29 class InputMethodMus; |
26 class WindowTreeClient; | 30 class WindowTreeClient; |
27 class WindowTreeHostMusDelegate; | 31 class WindowTreeHostMusDelegate; |
28 | 32 |
29 struct WindowTreeHostMusInitParams; | 33 struct WindowTreeHostMusInitParams; |
30 | 34 |
31 class AURA_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform { | 35 class AURA_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform { |
32 public: | 36 public: |
33 explicit WindowTreeHostMus(WindowTreeHostMusInitParams init_params); | 37 explicit WindowTreeHostMus(WindowTreeHostMusInitParams init_params); |
34 | 38 |
35 ~WindowTreeHostMus() override; | 39 ~WindowTreeHostMus() override; |
36 | 40 |
37 // Returns the WindowTreeHostMus for |window|. This returns null if |window| | 41 // Returns the WindowTreeHostMus for |window|. This returns null if |window| |
38 // is null, or not in a WindowTreeHostMus. | 42 // is null, or not in a WindowTreeHostMus. |
39 static WindowTreeHostMus* ForWindow(aura::Window* window); | 43 static WindowTreeHostMus* ForWindow(aura::Window* window); |
40 | 44 |
41 // Sets the bounds in pixels. | 45 // Sets the bounds in pixels. |
42 void SetBoundsFromServer(const gfx::Rect& bounds_in_pixels); | 46 void SetBoundsFromServer(const gfx::Rect& bounds_in_pixels); |
43 | 47 |
44 ui::EventDispatchDetails SendEventToSink(ui::Event* event) { | 48 ui::EventDispatchDetails SendEventToSink(ui::Event* event) { |
45 return aura::WindowTreeHostPlatform::SendEventToSink(event); | 49 return aura::WindowTreeHostPlatform::SendEventToSink(event); |
46 } | 50 } |
47 | 51 |
48 InputMethodMus* input_method() { return input_method_.get(); } | 52 InputMethodMus* input_method_mus_for_testing() { |
| 53 return input_method_mus_.get(); |
| 54 } |
| 55 |
| 56 void DispatchEventToInputMethod( |
| 57 ui::KeyEvent* event, |
| 58 std::unique_ptr<base::Callback<void(bool)>> ack_callback); |
49 | 59 |
50 // Sets the client area on the underlying mus window. | 60 // Sets the client area on the underlying mus window. |
51 void SetClientArea(const gfx::Insets& insets, | 61 void SetClientArea(const gfx::Insets& insets, |
52 const std::vector<gfx::Rect>& additional_client_area); | 62 const std::vector<gfx::Rect>& additional_client_area); |
53 | 63 |
54 // Sets the hit test mask on the underlying mus window. Pass base::nullopt to | 64 // Sets the hit test mask on the underlying mus window. Pass base::nullopt to |
55 // clear. | 65 // clear. |
56 void SetHitTestMask(const base::Optional<gfx::Rect>& rect); | 66 void SetHitTestMask(const base::Optional<gfx::Rect>& rect); |
57 | 67 |
58 // Sets the opacity of the underlying mus window. | 68 // Sets the opacity of the underlying mus window. |
(...skipping 30 matching lines...) Expand all Loading... |
89 void SetBoundsInPixels(const gfx::Rect& bounds) override; | 99 void SetBoundsInPixels(const gfx::Rect& bounds) override; |
90 void DispatchEvent(ui::Event* event) override; | 100 void DispatchEvent(ui::Event* event) override; |
91 void OnClosed() override; | 101 void OnClosed() override; |
92 void OnActivationChanged(bool active) override; | 102 void OnActivationChanged(bool active) override; |
93 void OnCloseRequest() override; | 103 void OnCloseRequest() override; |
94 gfx::ICCProfile GetICCProfileForCurrentDisplay() override; | 104 gfx::ICCProfile GetICCProfileForCurrentDisplay() override; |
95 void MoveCursorToScreenLocationInPixels( | 105 void MoveCursorToScreenLocationInPixels( |
96 const gfx::Point& location_in_pixels) override; | 106 const gfx::Point& location_in_pixels) override; |
97 | 107 |
98 private: | 108 private: |
| 109 void InitInputMethod(WindowTreeHostMusInitParams* init_params); |
| 110 |
99 int64_t display_id_; | 111 int64_t display_id_; |
100 | 112 |
101 WindowTreeHostMusDelegate* delegate_; | 113 WindowTreeHostMusDelegate* delegate_; |
102 | 114 |
103 bool in_set_bounds_from_server_ = false; | 115 bool in_set_bounds_from_server_ = false; |
104 | 116 |
105 std::unique_ptr<InputMethodMus> input_method_; | 117 std::unique_ptr<InputMethodMus> input_method_mus_; |
| 118 |
| 119 #if defined(OS_CHROMEOS) |
| 120 std::unique_ptr<ui::InputMethodChromeOS> input_method_chromeos_; |
| 121 #endif |
106 | 122 |
107 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus); | 123 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus); |
108 }; | 124 }; |
109 | 125 |
110 } // namespace aura | 126 } // namespace aura |
111 | 127 |
112 #endif // UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ | 128 #endif // UI_AURA_MUS_WINDOW_TREE_HOST_MUS_H_ |
OLD | NEW |