| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 void PrepareForShutdown() override; | 42 void PrepareForShutdown() override; |
| 43 void SetRootTransform(const gfx::Transform& transform) override; | 43 void SetRootTransform(const gfx::Transform& transform) override; |
| 44 gfx::Transform GetRootTransform() const override; | 44 gfx::Transform GetRootTransform() const override; |
| 45 gfx::Transform GetInverseRootTransform() const override; | 45 gfx::Transform GetInverseRootTransform() const override; |
| 46 void UpdateRootWindowSize(const gfx::Size& host_size) override; | 46 void UpdateRootWindowSize(const gfx::Size& host_size) override; |
| 47 void OnCursorVisibilityChangedNative(bool show) override; | 47 void OnCursorVisibilityChangedNative(bool show) override; |
| 48 void SetBounds(const gfx::Rect& bounds) override; | 48 void SetBounds(const gfx::Rect& bounds) override; |
| 49 void DispatchEvent(ui::Event* event) override; | 49 void DispatchEvent(ui::Event* event) override; |
| 50 | 50 |
| 51 // ui::internal::InputMethodDelegate: | 51 // ui::internal::InputMethodDelegate: |
| 52 bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override; | 52 ui::EventDispatchDetails DispatchKeyEventPostIME( |
| 53 ui::KeyEvent* event) override; |
| 53 | 54 |
| 54 // Temporarily disable the tap-to-click feature. Used on CrOS. | 55 // Temporarily disable the tap-to-click feature. Used on CrOS. |
| 55 void SetTapToClickPaused(bool state); | 56 void SetTapToClickPaused(bool state); |
| 56 | 57 |
| 57 TransformerHelper transformer_helper_; | 58 TransformerHelper transformer_helper_; |
| 58 | 59 |
| 59 DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostOzone); | 60 DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostOzone); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 AshWindowTreeHostOzone::AshWindowTreeHostOzone(const gfx::Rect& initial_bounds) | 63 AshWindowTreeHostOzone::AshWindowTreeHostOzone(const gfx::Rect& initial_bounds) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 ConfineCursorToRootWindow(); | 131 ConfineCursorToRootWindow(); |
| 131 } | 132 } |
| 132 | 133 |
| 133 void AshWindowTreeHostOzone::DispatchEvent(ui::Event* event) { | 134 void AshWindowTreeHostOzone::DispatchEvent(ui::Event* event) { |
| 134 TRACE_EVENT0("input", "AshWindowTreeHostOzone::DispatchEvent"); | 135 TRACE_EVENT0("input", "AshWindowTreeHostOzone::DispatchEvent"); |
| 135 if (event->IsLocatedEvent()) | 136 if (event->IsLocatedEvent()) |
| 136 TranslateLocatedEvent(static_cast<ui::LocatedEvent*>(event)); | 137 TranslateLocatedEvent(static_cast<ui::LocatedEvent*>(event)); |
| 137 SendEventToProcessor(event); | 138 SendEventToProcessor(event); |
| 138 } | 139 } |
| 139 | 140 |
| 140 bool AshWindowTreeHostOzone::DispatchKeyEventPostIME( | 141 ui::EventDispatchDetails AshWindowTreeHostOzone::DispatchKeyEventPostIME( |
| 141 const ui::KeyEvent& event) { | 142 ui::KeyEvent* event) { |
| 142 ui::KeyEvent event_copy(event); | |
| 143 input_method_handler()->SetPostIME(true); | 143 input_method_handler()->SetPostIME(true); |
| 144 ui::EventDispatchDetails details = | 144 ui::EventDispatchDetails details = |
| 145 event_processor()->OnEventFromSource(&event_copy); | 145 event_processor()->OnEventFromSource(event); |
| 146 if (details.dispatcher_destroyed) | 146 if (!details.dispatcher_destroyed) |
| 147 return true; | 147 input_method_handler()->SetPostIME(false); |
| 148 input_method_handler()->SetPostIME(false); | 148 return details; |
| 149 return event_copy.stopped_propagation(); | |
| 150 } | 149 } |
| 151 | 150 |
| 152 void AshWindowTreeHostOzone::SetTapToClickPaused(bool state) { | 151 void AshWindowTreeHostOzone::SetTapToClickPaused(bool state) { |
| 153 #if defined(OS_CHROMEOS) | 152 #if defined(OS_CHROMEOS) |
| 154 DCHECK(ui::OzonePlatform::GetInstance()->GetInputController()); | 153 DCHECK(ui::OzonePlatform::GetInstance()->GetInputController()); |
| 155 | 154 |
| 156 // Temporarily pause tap-to-click when the cursor is hidden. | 155 // Temporarily pause tap-to-click when the cursor is hidden. |
| 157 ui::OzonePlatform::GetInstance()->GetInputController()->SetTapToClickPaused( | 156 ui::OzonePlatform::GetInstance()->GetInputController()->SetTapToClickPaused( |
| 158 state); | 157 state); |
| 159 #endif | 158 #endif |
| 160 } | 159 } |
| 161 | 160 |
| 162 } // namespace | 161 } // namespace |
| 163 | 162 |
| 164 AshWindowTreeHost* AshWindowTreeHost::Create( | 163 AshWindowTreeHost* AshWindowTreeHost::Create( |
| 165 const AshWindowTreeHostInitParams& init_params) { | 164 const AshWindowTreeHostInitParams& init_params) { |
| 166 if (init_params.offscreen) | 165 if (init_params.offscreen) |
| 167 return new AshWindowTreeHostUnified(init_params.initial_bounds); | 166 return new AshWindowTreeHostUnified(init_params.initial_bounds); |
| 168 return new AshWindowTreeHostOzone(init_params.initial_bounds); | 167 return new AshWindowTreeHostOzone(init_params.initial_bounds); |
| 169 } | 168 } |
| 170 | 169 |
| 171 } // namespace ash | 170 } // namespace ash |
| OLD | NEW |