OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 long y, | 100 long y, |
101 const base::Closure& closure) OVERRIDE { | 101 const base::Closure& closure) OVERRIDE { |
102 gfx::Point p(x, y); | 102 gfx::Point p(x, y); |
103 ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p); | 103 ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p); |
104 return ui_controls && | 104 return ui_controls && |
105 ui_controls->SendMouseMoveNotifyWhenDone(p.x(), p.y(), closure); | 105 ui_controls->SendMouseMoveNotifyWhenDone(p.x(), p.y(), closure); |
106 } | 106 } |
107 | 107 |
108 virtual bool SendMouseEvents(ui_controls::MouseButton type, | 108 virtual bool SendMouseEvents(ui_controls::MouseButton type, |
109 int state) OVERRIDE { | 109 int state) OVERRIDE { |
110 gfx::Point p(gfx::Screen::GetCursorScreenPoint()); | 110 gfx::Point p(gfx::Screen::GetCursorScreenPoint( |
| 111 ash::Shell::GetRootNativeView())); |
111 ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p); | 112 ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p); |
112 return ui_controls && ui_controls->SendMouseEvents(type, state); | 113 return ui_controls && ui_controls->SendMouseEvents(type, state); |
113 } | 114 } |
114 | 115 |
115 virtual bool SendMouseEventsNotifyWhenDone( | 116 virtual bool SendMouseEventsNotifyWhenDone( |
116 ui_controls::MouseButton type, | 117 ui_controls::MouseButton type, |
117 int state, | 118 int state, |
118 const base::Closure& closure) OVERRIDE { | 119 const base::Closure& closure) OVERRIDE { |
119 gfx::Point p(gfx::Screen::GetCursorScreenPoint()); | 120 gfx::Point p(gfx::Screen::GetCursorScreenPoint( |
| 121 ash::Shell::GetRootNativeView())); |
120 ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p); | 122 ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p); |
121 return ui_controls && ui_controls->SendMouseEventsNotifyWhenDone( | 123 return ui_controls && ui_controls->SendMouseEventsNotifyWhenDone( |
122 type, state, closure); | 124 type, state, closure); |
123 } | 125 } |
124 | 126 |
125 virtual bool SendMouseClick(ui_controls::MouseButton type) OVERRIDE { | 127 virtual bool SendMouseClick(ui_controls::MouseButton type) OVERRIDE { |
126 gfx::Point p(gfx::Screen::GetCursorScreenPoint()); | 128 gfx::Point p(gfx::Screen::GetCursorScreenPoint( |
| 129 ash::Shell::GetRootNativeView())); |
127 ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p); | 130 ui_controls::UIControlsAura* ui_controls = GetUIControlsAt(&p); |
128 return ui_controls && ui_controls->SendMouseClick(type); | 131 return ui_controls && ui_controls->SendMouseClick(type); |
129 } | 132 } |
130 | 133 |
131 virtual void RunClosureAfterAllPendingUIEvents( | 134 virtual void RunClosureAfterAllPendingUIEvents( |
132 const base::Closure& closure) OVERRIDE { | 135 const base::Closure& closure) OVERRIDE { |
133 ui_controls::UIControlsAura* ui_controls = GetUIControlsForRootWindow( | 136 ui_controls::UIControlsAura* ui_controls = GetUIControlsForRootWindow( |
134 Shell::GetActiveRootWindow()); | 137 Shell::GetActiveRootWindow()); |
135 if (ui_controls) | 138 if (ui_controls) |
136 ui_controls->RunClosureAfterAllPendingUIEvents(closure); | 139 ui_controls->RunClosureAfterAllPendingUIEvents(closure); |
137 } | 140 } |
138 | 141 |
139 private: | 142 private: |
140 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); | 143 DISALLOW_COPY_AND_ASSIGN(UIControlsAsh); |
141 }; | 144 }; |
142 | 145 |
143 ui_controls::UIControlsAura* CreateUIControls() { | 146 ui_controls::UIControlsAura* CreateUIControls() { |
144 return new UIControlsAsh(); | 147 return new UIControlsAsh(); |
145 } | 148 } |
146 | 149 |
147 } // namespace internal | 150 } // namespace internal |
148 } // namespace ash | 151 } // namespace ash |
OLD | NEW |