Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1022)

Side by Side Diff: ui/aura/remote_root_window_host_win.cc

Issue 11194044: Add keyboard events to metro aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ui/aura/remote_root_window_host_win.h" 5 #include "ui/aura/remote_root_window_host_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "ui/aura/client/capture_client.h" 12 #include "ui/aura/client/capture_client.h"
13 #include "ui/aura/env.h" 13 #include "ui/aura/env.h"
14 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
15 #include "ui/base/cursor/cursor_loader_win.h" 15 #include "ui/base/cursor/cursor_loader_win.h"
16 #include "ui/base/events/event.h" 16 #include "ui/base/events/event.h"
17 #include "ui/base/keycodes/keyboard_code_conversion_win.h"
17 #include "ui/base/view_prop.h" 18 #include "ui/base/view_prop.h"
18 19
19 using std::max; 20 using std::max;
20 using std::min; 21 using std::min;
21 22
22 namespace aura { 23 namespace aura {
23 24
24 namespace { 25 namespace {
25 26
26 const char* kRootWindowHostWinKey = "__AURA_REMOTE_ROOT_WINDOW_HOST_WIN__"; 27 const char* kRootWindowHostWinKey = "__AURA_REMOTE_ROOT_WINDOW_HOST_WIN__";
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 130
130 void RemoteRootWindowHostWin::OnDeviceScaleFactorChanged( 131 void RemoteRootWindowHostWin::OnDeviceScaleFactorChanged(
131 float device_scale_factor) { 132 float device_scale_factor) {
132 NOTIMPLEMENTED(); 133 NOTIMPLEMENTED();
133 } 134 }
134 135
135 void RemoteRootWindowHostWin::PrepareForShutdown() { 136 void RemoteRootWindowHostWin::PrepareForShutdown() {
136 NOTIMPLEMENTED(); 137 NOTIMPLEMENTED();
137 } 138 }
138 139
139 void RemoteRootWindowHostWin::OnMouseMoved(int x, int y, int extra) { 140 void RemoteRootWindowHostWin::OnMouseMoved(int32 x, int32 y, int32 extra) {
140 gfx::Point location(x, y); 141 gfx::Point location(x, y);
141 ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, 0); 142 ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, 0);
142 delegate_->OnHostMouseEvent(&event); 143 delegate_->OnHostMouseEvent(&event);
143 } 144 }
144 145
145 void RemoteRootWindowHostWin::OnMouseClick(int x, int y, int extra) { 146 void RemoteRootWindowHostWin::OnMouseClick(int32 x, int32 y, int32 extra) {
146 gfx::Point location(x, y); 147 gfx::Point location(x, y);
147 ui::EventType type = (extra == 1) ? 148 ui::EventType type = (extra == 1) ?
148 ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED; 149 ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED;
149 ui::MouseEvent event(type, location, location, 0); 150 ui::MouseEvent event(type, location, location, 0);
150 event.SetClickCount(1); 151 event.SetClickCount(1);
151 event.set_flags(ui::EF_LEFT_MOUSE_BUTTON); 152 event.set_flags(ui::EF_LEFT_MOUSE_BUTTON);
152 delegate_->OnHostMouseEvent(&event); 153 delegate_->OnHostMouseEvent(&event);
153 } 154 }
154 155
156 void RemoteRootWindowHostWin::OnKeyDown(uint32 vkey,
157 uint32 repeat_count,
158 uint32 scan_code) {
159 ui::KeyEvent event(ui::ET_KEY_PRESSED,
160 ui::KeyboardCodeForWindowsKeyCode(vkey),
161 0);
162 delegate_->OnHostKeyEvent(&event);
163 }
164
165 void RemoteRootWindowHostWin::OnKeyUp(uint32 vkey,
166 uint32 repeat_count,
167 uint32 scan_code) {
168 ui::KeyEvent event(ui::ET_KEY_RELEASED,
169 ui::KeyboardCodeForWindowsKeyCode(vkey),
170 0);
171 delegate_->OnHostKeyEvent(&event);
172 }
173
155 } // namespace aura 174 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698