| 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/common/wm/root_window_finder.h" | 5 #include "ash/common/wm/root_window_finder.h" |
| 6 #include "ash/common/wm_window.h" | 6 #include "ash/common/wm_window.h" |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 base::Closure()); | 66 base::Closure()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, | 69 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, |
| 70 ui::KeyboardCode key, | 70 ui::KeyboardCode key, |
| 71 bool control, | 71 bool control, |
| 72 bool shift, | 72 bool shift, |
| 73 bool alt, | 73 bool alt, |
| 74 bool command, | 74 bool command, |
| 75 const base::Closure& closure) override { | 75 const base::Closure& closure) override { |
| 76 aura::Window* root = | 76 aura::Window* root = window ? window->GetRootWindow() |
| 77 window ? window->GetRootWindow() : ash::Shell::GetTargetRootWindow(); | 77 : ash::Shell::GetRootWindowForNewWindows(); |
| 78 UIControlsAura* ui_controls = GetUIControlsForRootWindow(root); | 78 UIControlsAura* ui_controls = GetUIControlsForRootWindow(root); |
| 79 return ui_controls && | 79 return ui_controls && |
| 80 ui_controls->SendKeyPressNotifyWhenDone(window, key, control, shift, | 80 ui_controls->SendKeyPressNotifyWhenDone(window, key, control, shift, |
| 81 alt, command, closure); | 81 alt, command, closure); |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool SendMouseMove(long x, long y) override { | 84 bool SendMouseMove(long x, long y) override { |
| 85 gfx::Point p(x, y); | 85 gfx::Point p(x, y); |
| 86 UIControlsAura* ui_controls = GetUIControlsAt(p); | 86 UIControlsAura* ui_controls = GetUIControlsAt(p); |
| 87 return ui_controls && ui_controls->SendMouseMove(p.x(), p.y()); | 87 return ui_controls && ui_controls->SendMouseMove(p.x(), p.y()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 113 | 113 |
| 114 bool SendMouseClick(MouseButton type) override { | 114 bool SendMouseClick(MouseButton type) override { |
| 115 gfx::Point p(display::Screen::GetScreen()->GetCursorScreenPoint()); | 115 gfx::Point p(display::Screen::GetScreen()->GetCursorScreenPoint()); |
| 116 UIControlsAura* ui_controls = GetUIControlsAt(p); | 116 UIControlsAura* ui_controls = GetUIControlsAt(p); |
| 117 return ui_controls && ui_controls->SendMouseClick(type); | 117 return ui_controls && ui_controls->SendMouseClick(type); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void RunClosureAfterAllPendingUIEvents( | 120 void RunClosureAfterAllPendingUIEvents( |
| 121 const base::Closure& closure) override { | 121 const base::Closure& closure) override { |
| 122 UIControlsAura* ui_controls = | 122 UIControlsAura* ui_controls = |
| 123 GetUIControlsForRootWindow(ash::Shell::GetTargetRootWindow()); | 123 GetUIControlsForRootWindow(ash::Shell::GetRootWindowForNewWindows()); |
| 124 if (ui_controls) | 124 if (ui_controls) |
| 125 ui_controls->RunClosureAfterAllPendingUIEvents(closure); | 125 ui_controls->RunClosureAfterAllPendingUIEvents(closure); |
| 126 } | 126 } |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); | 129 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 ui_controls::UIControlsAura* CreateAshUIControls() { | 132 ui_controls::UIControlsAura* CreateAshUIControls() { |
| 133 return new ash::test::UIControlsAsh(); | 133 return new ash::test::UIControlsAsh(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace test | 136 } // namespace test |
| 137 } // namespace ash | 137 } // namespace ash |
| OLD | NEW |