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 #include "ash/host/ash_window_tree_host.h" | 5 #include "ash/host/ash_window_tree_host.h" |
6 | 6 |
7 #include "ash/host/ash_window_tree_host_init_params.h" | 7 #include "ash/host/ash_window_tree_host_init_params.h" |
8 #include "ash/host/ash_window_tree_host_unified.h" | 8 #include "ash/host/ash_window_tree_host_unified.h" |
9 #include "ash/host/root_window_transformer.h" | 9 #include "ash/host/root_window_transformer.h" |
10 #include "ash/host/transformer_helper.h" | 10 #include "ash/host/transformer_helper.h" |
| 11 #include "ash/ime/input_method_event_handler.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
14 #include "ui/aura/window_tree_host_ozone.h" | 15 #include "ui/aura/window_tree_host_ozone.h" |
15 #include "ui/events/null_event_targeter.h" | 16 #include "ui/events/null_event_targeter.h" |
16 #include "ui/gfx/geometry/insets.h" | 17 #include "ui/gfx/geometry/insets.h" |
17 #include "ui/gfx/transform.h" | 18 #include "ui/gfx/transform.h" |
18 #include "ui/ozone/public/input_controller.h" | 19 #include "ui/ozone/public/input_controller.h" |
19 #include "ui/ozone/public/ozone_platform.h" | 20 #include "ui/ozone/public/ozone_platform.h" |
20 #include "ui/platform_window/platform_window.h" | 21 #include "ui/platform_window/platform_window.h" |
(...skipping 18 matching lines...) Expand all Loading... |
39 aura::WindowTreeHost* AsWindowTreeHost() override; | 40 aura::WindowTreeHost* AsWindowTreeHost() override; |
40 void PrepareForShutdown() override; | 41 void PrepareForShutdown() override; |
41 void SetRootTransform(const gfx::Transform& transform) override; | 42 void SetRootTransform(const gfx::Transform& transform) override; |
42 gfx::Transform GetRootTransform() const override; | 43 gfx::Transform GetRootTransform() const override; |
43 gfx::Transform GetInverseRootTransform() const override; | 44 gfx::Transform GetInverseRootTransform() const override; |
44 void UpdateRootWindowSize(const gfx::Size& host_size) override; | 45 void UpdateRootWindowSize(const gfx::Size& host_size) override; |
45 void OnCursorVisibilityChangedNative(bool show) override; | 46 void OnCursorVisibilityChangedNative(bool show) override; |
46 void SetBounds(const gfx::Rect& bounds) override; | 47 void SetBounds(const gfx::Rect& bounds) override; |
47 void DispatchEvent(ui::Event* event) override; | 48 void DispatchEvent(ui::Event* event) override; |
48 | 49 |
| 50 // ui::internal::InputMethodDelegate: |
| 51 bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override; |
| 52 |
| 53 // ui::EventSource: |
| 54 ui::EventDispatchDetails DeliverEventToProcessor(ui::Event* event) override { |
| 55 return ui::EventSource::DeliverEventToProcessor(event); |
| 56 } |
| 57 |
49 // Temporarily disable the tap-to-click feature. Used on CrOS. | 58 // Temporarily disable the tap-to-click feature. Used on CrOS. |
50 void SetTapToClickPaused(bool state); | 59 void SetTapToClickPaused(bool state); |
51 | 60 |
52 TransformerHelper transformer_helper_; | 61 TransformerHelper transformer_helper_; |
53 | 62 |
54 DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostOzone); | 63 DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostOzone); |
55 }; | 64 }; |
56 | 65 |
57 AshWindowTreeHostOzone::AshWindowTreeHostOzone(const gfx::Rect& initial_bounds) | 66 AshWindowTreeHostOzone::AshWindowTreeHostOzone(const gfx::Rect& initial_bounds) |
58 : aura::WindowTreeHostOzone(initial_bounds), transformer_helper_(this) { | 67 : aura::WindowTreeHostOzone(initial_bounds), transformer_helper_(this) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 ConfineCursorToRootWindow(); | 134 ConfineCursorToRootWindow(); |
126 } | 135 } |
127 | 136 |
128 void AshWindowTreeHostOzone::DispatchEvent(ui::Event* event) { | 137 void AshWindowTreeHostOzone::DispatchEvent(ui::Event* event) { |
129 TRACE_EVENT0("input", "AshWindowTreeHostOzone::DispatchEvent"); | 138 TRACE_EVENT0("input", "AshWindowTreeHostOzone::DispatchEvent"); |
130 if (event->IsLocatedEvent()) | 139 if (event->IsLocatedEvent()) |
131 TranslateLocatedEvent(static_cast<ui::LocatedEvent*>(event)); | 140 TranslateLocatedEvent(static_cast<ui::LocatedEvent*>(event)); |
132 SendEventToProcessor(event); | 141 SendEventToProcessor(event); |
133 } | 142 } |
134 | 143 |
| 144 bool AshWindowTreeHostOzone::DispatchKeyEventPostIME( |
| 145 const ui::KeyEvent& event) { |
| 146 ui::KeyEvent event_copy(event); |
| 147 input_method_handler()->SetPostIME(true); |
| 148 ui::EventSource::DeliverEventToProcessor(&event_copy); |
| 149 input_method_handler()->SetPostIME(false); |
| 150 return event_copy.handled(); |
| 151 } |
| 152 |
135 void AshWindowTreeHostOzone::SetTapToClickPaused(bool state) { | 153 void AshWindowTreeHostOzone::SetTapToClickPaused(bool state) { |
136 #if defined(OS_CHROMEOS) | 154 #if defined(OS_CHROMEOS) |
137 DCHECK(ui::OzonePlatform::GetInstance()->GetInputController()); | 155 DCHECK(ui::OzonePlatform::GetInstance()->GetInputController()); |
138 | 156 |
139 // Temporarily pause tap-to-click when the cursor is hidden. | 157 // Temporarily pause tap-to-click when the cursor is hidden. |
140 ui::OzonePlatform::GetInstance()->GetInputController()->SetTapToClickPaused( | 158 ui::OzonePlatform::GetInstance()->GetInputController()->SetTapToClickPaused( |
141 state); | 159 state); |
142 #endif | 160 #endif |
143 } | 161 } |
144 | 162 |
145 } // namespace | 163 } // namespace |
146 | 164 |
147 AshWindowTreeHost* AshWindowTreeHost::Create( | 165 AshWindowTreeHost* AshWindowTreeHost::Create( |
148 const AshWindowTreeHostInitParams& init_params) { | 166 const AshWindowTreeHostInitParams& init_params) { |
149 if (init_params.offscreen) | 167 if (init_params.offscreen) |
150 return new AshWindowTreeHostUnified(init_params.initial_bounds); | 168 return new AshWindowTreeHostUnified(init_params.initial_bounds); |
151 return new AshWindowTreeHostOzone(init_params.initial_bounds); | 169 return new AshWindowTreeHostOzone(init_params.initial_bounds); |
152 } | 170 } |
153 | 171 |
154 } // namespace ash | 172 } // namespace ash |
OLD | NEW |