| 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 "ui/aura/test/event_generator_delegate_aura.h" | 5 #include "ui/aura/test/event_generator_delegate_aura.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "ui/aura/client/screen_position_client.h" | 8 #include "ui/aura/client/screen_position_client.h" |
| 9 #include "ui/aura/window_event_dispatcher.h" | 9 #include "ui/aura/window_event_dispatcher.h" |
| 10 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
| 11 | 11 |
| 12 namespace aura { | 12 namespace aura { |
| 13 namespace test { | 13 namespace test { |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class DefaultEventGeneratorDelegate : public EventGeneratorDelegateAura { | 16 class DefaultEventGeneratorDelegate : public EventGeneratorDelegateAura { |
| 17 public: | 17 public: |
| 18 static DefaultEventGeneratorDelegate* GetInstance() { | 18 static DefaultEventGeneratorDelegate* GetInstance() { |
| 19 return Singleton<DefaultEventGeneratorDelegate>::get(); | 19 return Singleton<DefaultEventGeneratorDelegate>::get(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 // EventGeneratorDelegate: | 22 // EventGeneratorDelegate: |
| 23 virtual void SetContext(ui::test::EventGenerator* owner, | 23 virtual void SetContext(ui::test::EventGenerator* owner, |
| 24 gfx::NativeWindow root_window, | 24 gfx::NativeWindow root_window, |
| 25 gfx::NativeWindow window) OVERRIDE { | 25 gfx::NativeWindow window) override { |
| 26 root_window_ = root_window; | 26 root_window_ = root_window; |
| 27 } | 27 } |
| 28 | 28 |
| 29 // EventGeneratorDelegateAura: | 29 // EventGeneratorDelegateAura: |
| 30 virtual WindowTreeHost* GetHostAt(const gfx::Point& point) const OVERRIDE { | 30 virtual WindowTreeHost* GetHostAt(const gfx::Point& point) const override { |
| 31 return root_window_->GetHost(); | 31 return root_window_->GetHost(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual client::ScreenPositionClient* GetScreenPositionClient( | 34 virtual client::ScreenPositionClient* GetScreenPositionClient( |
| 35 const aura::Window* window) const OVERRIDE { | 35 const aura::Window* window) const override { |
| 36 return NULL; | 36 return NULL; |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 friend struct DefaultSingletonTraits<DefaultEventGeneratorDelegate>; | 40 friend struct DefaultSingletonTraits<DefaultEventGeneratorDelegate>; |
| 41 | 41 |
| 42 DefaultEventGeneratorDelegate() : root_window_(NULL) { | 42 DefaultEventGeneratorDelegate() : root_window_(NULL) { |
| 43 DCHECK(!ui::test::EventGenerator::default_delegate); | 43 DCHECK(!ui::test::EventGenerator::default_delegate); |
| 44 ui::test::EventGenerator::default_delegate = this; | 44 ui::test::EventGenerator::default_delegate = this; |
| 45 } | 45 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 void EventGeneratorDelegateAura::ConvertPointFromHost( | 120 void EventGeneratorDelegateAura::ConvertPointFromHost( |
| 121 const ui::EventTarget* hosted_target, | 121 const ui::EventTarget* hosted_target, |
| 122 gfx::Point* point) const { | 122 gfx::Point* point) const { |
| 123 const Window* window = WindowFromTarget(hosted_target); | 123 const Window* window = WindowFromTarget(hosted_target); |
| 124 window->GetHost()->ConvertPointFromHost(point); | 124 window->GetHost()->ConvertPointFromHost(point); |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace test | 127 } // namespace test |
| 128 } // namespace aura | 128 } // namespace aura |
| OLD | NEW |