 Chromium Code Reviews
 Chromium Code Reviews Issue 11419013:
  Add desktop vs. ash context to ui_controls 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 11419013:
  Add desktop vs. ash context to ui_controls 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: ui/ui_controls/ui_controls_win.cc | 
| diff --git a/ui/ui_controls/ui_controls_win.cc b/ui/ui_controls/ui_controls_win.cc | 
| index e411a1779bcb2c2eeb53baff8fa8272ad09c60d4..516207676d98d10fd8666c50711c61b4669eea45 100644 | 
| --- a/ui/ui_controls/ui_controls_win.cc | 
| +++ b/ui/ui_controls/ui_controls_win.cc | 
| @@ -12,52 +12,64 @@ | 
| namespace ui_controls { | 
| -bool SendKeyPress(gfx::NativeWindow window, | 
| - ui::KeyboardCode key, | 
| - bool control, | 
| - bool shift, | 
| - bool alt, | 
| - bool command) { | 
| - DCHECK(!command); // No command key on Windows | 
| - return internal::SendKeyPressImpl(window, key, control, shift, alt, | 
| - base::Closure()); | 
| -} | 
| +namespace { | 
| -bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, | 
| - ui::KeyboardCode key, | 
| - bool control, | 
| - bool shift, | 
| - bool alt, | 
| - bool command, | 
| - const base::Closure& task) { | 
| - DCHECK(!command); // No command key on Windows | 
| - return internal::SendKeyPressImpl(window, key, control, shift, alt, task); | 
| -} | 
| +class UIControlsWin : public UIControls { | 
| + bool SendKeyPress(gfx::NativeWindow window, | 
| + ui::KeyboardCode key, | 
| + bool control, | 
| + bool shift, | 
| + bool alt, | 
| + bool command) OVERRIDE { | 
| + DCHECK(!command); // No command key on Windows | 
| + return internal::SendKeyPressImpl(window, key, control, shift, alt, | 
| + base::Closure()); | 
| + } | 
| -bool SendMouseMove(long x, long y) { | 
| - return internal::SendMouseMoveImpl(x, y, base::Closure()); | 
| -} | 
| + bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, | 
| + ui::KeyboardCode key, | 
| + bool control, | 
| + bool shift, | 
| + bool alt, | 
| + bool command, | 
| + const base::Closure& task) OVERRIDE { | 
| + DCHECK(!command); // No command key on Windows | 
| + return internal::SendKeyPressImpl(window, key, control, shift, alt, task); | 
| + } | 
| -bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& task) { | 
| - return internal::SendMouseMoveImpl(x, y, task); | 
| -} | 
| + bool SendMouseMove(long x, long y) OVERRIDE { | 
| + return internal::SendMouseMoveImpl(x, y, base::Closure()); | 
| + } | 
| -bool SendMouseEvents(MouseButton type, int state) { | 
| - return internal::SendMouseEventsImpl(type, state, base::Closure()); | 
| -} | 
| + bool SendMouseMoveNotifyWhenDone( | 
| + long x, long y, const base::Closure& task) OVERRIDE { | 
| + return internal::SendMouseMoveImpl(x, y, task); | 
| + } | 
| -bool SendMouseEventsNotifyWhenDone(MouseButton type, int state, | 
| - const base::Closure& task) { | 
| - return internal::SendMouseEventsImpl(type, state, task); | 
| -} | 
| + bool SendMouseEvents(MouseButton type, int state) OVERRIDE { | 
| + return internal::SendMouseEventsImpl(type, state, base::Closure()); | 
| + } | 
| -bool SendMouseClick(MouseButton type) { | 
| - return internal::SendMouseEventsImpl(type, UP | DOWN, base::Closure()); | 
| -} | 
| + bool SendMouseEventsNotifyWhenDone(MouseButton type, int state, | 
| + const base::Closure& task) OVERRIDE { | 
| + return internal::SendMouseEventsImpl(type, state, task); | 
| + } | 
| + | 
| + bool SendMouseClick(MouseButton type) OVERRIDE { | 
| + return internal::SendMouseEventsImpl(type, UP | DOWN, base::Closure()); | 
| + } | 
| + | 
| + void RunClosureAfterAllPendingUIEvents( | 
| + const base::Closure& closure) OVERRIDE { | 
| + // On windows, posting UI events is synchronous so just post the closure. | 
| + MessageLoopForUI::current()->PostTask(FROM_HERE, closure); | 
| + } | 
| +}; | 
| 
oshima
2012/11/15 23:37:41
ditto
 
scottmg
2012/11/16 17:58:54
Done.
 | 
| + | 
| +} // namespace | 
| -void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) { | 
| - // On windows, posting UI events is synchronous so just post the closure. | 
| - MessageLoopForUI::current()->PostTask(FROM_HERE, closure); | 
| +UIControls* CreateNativeUIControls() { | 
| + return new UIControlsWin; | 
| } | 
| } // namespace ui_controls |