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