| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "ash/shell_factory.h" | 6 #include "ash/shell_factory.h" |
| 7 #include "ash/wm/aura/wm_window_aura.h" | 7 #include "ash/wm/aura/wm_window_aura.h" |
| 8 #include "ash/wm/common/root_window_finder.h" | 8 #include "ash/wm/common/root_window_finder.h" |
| 9 #include "ash/wm/window_properties.h" | 9 #include "ash/wm/window_properties.h" |
| 10 #include "ui/aura/client/capture_client.h" | 10 #include "ui/aura/client/capture_client.h" |
| 11 #include "ui/aura/client/screen_position_client.h" | 11 #include "ui/aura/client/screen_position_client.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/test/ui_controls_factory_aura.h" | 13 #include "ui/aura/test/ui_controls_factory_aura.h" |
| 14 #include "ui/aura/window_property.h" | 14 #include "ui/aura/window_property.h" |
| 15 #include "ui/aura/window_tree_host.h" | 15 #include "ui/aura/window_tree_host.h" |
| 16 #include "ui/base/test/ui_controls.h" | 16 #include "ui/base/test/ui_controls.h" |
| 17 #include "ui/base/test/ui_controls_aura.h" | 17 #include "ui/base/test/ui_controls_aura.h" |
| 18 #include "ui/gfx/screen.h" | 18 #include "ui/display/screen.h" |
| 19 | 19 |
| 20 DECLARE_WINDOW_PROPERTY_TYPE(ui_controls::UIControlsAura*) | 20 DECLARE_WINDOW_PROPERTY_TYPE(ui_controls::UIControlsAura*) |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 namespace test { | 23 namespace test { |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 using ui_controls::UIControlsAura; | 26 using ui_controls::UIControlsAura; |
| 27 using ui_controls::MouseButton; | 27 using ui_controls::MouseButton; |
| 28 | 28 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 bool SendMouseMoveNotifyWhenDone(long x, | 92 bool SendMouseMoveNotifyWhenDone(long x, |
| 93 long y, | 93 long y, |
| 94 const base::Closure& closure) override { | 94 const base::Closure& closure) override { |
| 95 gfx::Point p(x, y); | 95 gfx::Point p(x, y); |
| 96 UIControlsAura* ui_controls = GetUIControlsAt(p); | 96 UIControlsAura* ui_controls = GetUIControlsAt(p); |
| 97 return ui_controls && | 97 return ui_controls && |
| 98 ui_controls->SendMouseMoveNotifyWhenDone(p.x(), p.y(), closure); | 98 ui_controls->SendMouseMoveNotifyWhenDone(p.x(), p.y(), closure); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool SendMouseEvents(MouseButton type, int state) override { | 101 bool SendMouseEvents(MouseButton type, int state) override { |
| 102 gfx::Point p(gfx::Screen::GetScreen()->GetCursorScreenPoint()); | 102 gfx::Point p(display::Screen::GetScreen()->GetCursorScreenPoint()); |
| 103 UIControlsAura* ui_controls = GetUIControlsAt(p); | 103 UIControlsAura* ui_controls = GetUIControlsAt(p); |
| 104 return ui_controls && ui_controls->SendMouseEvents(type, state); | 104 return ui_controls && ui_controls->SendMouseEvents(type, state); |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool SendMouseEventsNotifyWhenDone(MouseButton type, | 107 bool SendMouseEventsNotifyWhenDone(MouseButton type, |
| 108 int state, | 108 int state, |
| 109 const base::Closure& closure) override { | 109 const base::Closure& closure) override { |
| 110 gfx::Point p(aura::Env::GetInstance()->last_mouse_location()); | 110 gfx::Point p(aura::Env::GetInstance()->last_mouse_location()); |
| 111 UIControlsAura* ui_controls = GetUIControlsAt(p); | 111 UIControlsAura* ui_controls = GetUIControlsAt(p); |
| 112 return ui_controls && ui_controls->SendMouseEventsNotifyWhenDone( | 112 return ui_controls && ui_controls->SendMouseEventsNotifyWhenDone( |
| 113 type, state, closure); | 113 type, state, closure); |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool SendMouseClick(MouseButton type) override { | 116 bool SendMouseClick(MouseButton type) override { |
| 117 gfx::Point p(gfx::Screen::GetScreen()->GetCursorScreenPoint()); | 117 gfx::Point p(display::Screen::GetScreen()->GetCursorScreenPoint()); |
| 118 UIControlsAura* ui_controls = GetUIControlsAt(p); | 118 UIControlsAura* ui_controls = GetUIControlsAt(p); |
| 119 return ui_controls && ui_controls->SendMouseClick(type); | 119 return ui_controls && ui_controls->SendMouseClick(type); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void RunClosureAfterAllPendingUIEvents( | 122 void RunClosureAfterAllPendingUIEvents( |
| 123 const base::Closure& closure) override { | 123 const base::Closure& closure) override { |
| 124 UIControlsAura* ui_controls = GetUIControlsForRootWindow( | 124 UIControlsAura* ui_controls = GetUIControlsForRootWindow( |
| 125 ash::Shell::GetTargetRootWindow()); | 125 ash::Shell::GetTargetRootWindow()); |
| 126 if (ui_controls) | 126 if (ui_controls) |
| 127 ui_controls->RunClosureAfterAllPendingUIEvents(closure); | 127 ui_controls->RunClosureAfterAllPendingUIEvents(closure); |
| 128 } | 128 } |
| 129 | 129 |
| 130 private: | 130 private: |
| 131 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); | 131 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 ui_controls::UIControlsAura* CreateAshUIControls() { | 134 ui_controls::UIControlsAura* CreateAshUIControls() { |
| 135 return new ash::test::UIControlsAsh(); | 135 return new ash::test::UIControlsAsh(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace test | 138 } // namespace test |
| 139 } // namespace ash | 139 } // namespace ash |
| OLD | NEW |