| 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/coordinate_conversion.h" | 7 #include "ash/wm/coordinate_conversion.h" |
| 8 #include "ash/wm/window_properties.h" | 8 #include "ash/wm/window_properties.h" |
| 9 #include "ui/aura/client/capture_client.h" | 9 #include "ui/aura/client/capture_client.h" |
| 10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 virtual ~UIControlsAsh() { | 57 virtual ~UIControlsAsh() { |
| 58 } | 58 } |
| 59 | 59 |
| 60 // UIControslAura overrides: | 60 // UIControslAura overrides: |
| 61 virtual bool SendKeyPress(gfx::NativeWindow window, | 61 virtual bool SendKeyPress(gfx::NativeWindow window, |
| 62 ui::KeyboardCode key, | 62 ui::KeyboardCode key, |
| 63 bool control, | 63 bool control, |
| 64 bool shift, | 64 bool shift, |
| 65 bool alt, | 65 bool alt, |
| 66 bool command) OVERRIDE { | 66 bool command) override { |
| 67 return SendKeyPressNotifyWhenDone( | 67 return SendKeyPressNotifyWhenDone( |
| 68 window, key, control, shift, alt, command, base::Closure()); | 68 window, key, control, shift, alt, command, base::Closure()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual bool SendKeyPressNotifyWhenDone( | 71 virtual bool SendKeyPressNotifyWhenDone( |
| 72 gfx::NativeWindow window, | 72 gfx::NativeWindow window, |
| 73 ui::KeyboardCode key, | 73 ui::KeyboardCode key, |
| 74 bool control, | 74 bool control, |
| 75 bool shift, | 75 bool shift, |
| 76 bool alt, | 76 bool alt, |
| 77 bool command, | 77 bool command, |
| 78 const base::Closure& closure) OVERRIDE { | 78 const base::Closure& closure) override { |
| 79 aura::Window* root = | 79 aura::Window* root = |
| 80 window ? window->GetRootWindow() : ash::Shell::GetTargetRootWindow(); | 80 window ? window->GetRootWindow() : ash::Shell::GetTargetRootWindow(); |
| 81 UIControlsAura* ui_controls = GetUIControlsForRootWindow(root); | 81 UIControlsAura* ui_controls = GetUIControlsForRootWindow(root); |
| 82 return ui_controls && ui_controls->SendKeyPressNotifyWhenDone( | 82 return ui_controls && ui_controls->SendKeyPressNotifyWhenDone( |
| 83 window, key, control, shift, alt, command, closure); | 83 window, key, control, shift, alt, command, closure); |
| 84 } | 84 } |
| 85 | 85 |
| 86 virtual bool SendMouseMove(long x, long y) OVERRIDE { | 86 virtual bool SendMouseMove(long x, long y) override { |
| 87 gfx::Point p(x, y); | 87 gfx::Point p(x, y); |
| 88 UIControlsAura* ui_controls = GetUIControlsAt(p); | 88 UIControlsAura* ui_controls = GetUIControlsAt(p); |
| 89 return ui_controls && ui_controls->SendMouseMove(p.x(), p.y()); | 89 return ui_controls && ui_controls->SendMouseMove(p.x(), p.y()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 virtual bool SendMouseMoveNotifyWhenDone( | 92 virtual bool SendMouseMoveNotifyWhenDone( |
| 93 long x, | 93 long x, |
| 94 long y, | 94 long y, |
| 95 const base::Closure& closure) OVERRIDE { | 95 const base::Closure& closure) override { |
| 96 gfx::Point p(x, y); | 96 gfx::Point p(x, y); |
| 97 UIControlsAura* ui_controls = GetUIControlsAt(p); | 97 UIControlsAura* ui_controls = GetUIControlsAt(p); |
| 98 return ui_controls && | 98 return ui_controls && |
| 99 ui_controls->SendMouseMoveNotifyWhenDone(p.x(), p.y(), closure); | 99 ui_controls->SendMouseMoveNotifyWhenDone(p.x(), p.y(), closure); |
| 100 } | 100 } |
| 101 | 101 |
| 102 virtual bool SendMouseEvents(MouseButton type, int state) OVERRIDE { | 102 virtual bool SendMouseEvents(MouseButton type, int state) override { |
| 103 gfx::Point p(ash::Shell::GetScreen()->GetCursorScreenPoint()); | 103 gfx::Point p(ash::Shell::GetScreen()->GetCursorScreenPoint()); |
| 104 UIControlsAura* ui_controls = GetUIControlsAt(p); | 104 UIControlsAura* ui_controls = GetUIControlsAt(p); |
| 105 return ui_controls && ui_controls->SendMouseEvents(type, state); | 105 return ui_controls && ui_controls->SendMouseEvents(type, state); |
| 106 } | 106 } |
| 107 | 107 |
| 108 virtual bool SendMouseEventsNotifyWhenDone( | 108 virtual bool SendMouseEventsNotifyWhenDone( |
| 109 MouseButton type, int state, const base::Closure& closure) OVERRIDE { | 109 MouseButton type, int state, 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 virtual bool SendMouseClick(MouseButton type) OVERRIDE { | 116 virtual bool SendMouseClick(MouseButton type) override { |
| 117 gfx::Point p(ash::Shell::GetScreen()->GetCursorScreenPoint()); | 117 gfx::Point p(ash::Shell::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 virtual void RunClosureAfterAllPendingUIEvents( | 122 virtual 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 |