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 "ui/aura/root_window_host_win.h" | 5 #include "ui/aura/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/event.h" | |
15 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
| 15 #include "ui/base/event.h" |
16 #include "ui/base/view_prop.h" | 16 #include "ui/base/view_prop.h" |
17 | 17 |
18 using std::max; | 18 using std::max; |
19 using std::min; | 19 using std::min; |
20 | 20 |
21 namespace aura { | 21 namespace aura { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 const char* kRootWindowHostWinKey = "__AURA_ROOT_WINDOW_HOST_WIN__"; | 25 const char* kRootWindowHostWinKey = "__AURA_ROOT_WINDOW_HOST_WIN__"; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 void RootWindowHostWin::OnClose() { | 303 void RootWindowHostWin::OnClose() { |
304 // TODO: this obviously shouldn't be here. | 304 // TODO: this obviously shouldn't be here. |
305 MessageLoopForUI::current()->Quit(); | 305 MessageLoopForUI::current()->Quit(); |
306 } | 306 } |
307 | 307 |
308 LRESULT RootWindowHostWin::OnKeyEvent(UINT message, | 308 LRESULT RootWindowHostWin::OnKeyEvent(UINT message, |
309 WPARAM w_param, | 309 WPARAM w_param, |
310 LPARAM l_param) { | 310 LPARAM l_param) { |
311 MSG msg = { hwnd(), message, w_param, l_param }; | 311 MSG msg = { hwnd(), message, w_param, l_param }; |
312 KeyEvent keyev(msg, message == WM_CHAR); | 312 ui::KeyEvent keyev(msg, message == WM_CHAR); |
313 SetMsgHandled(delegate_->OnHostKeyEvent(&keyev)); | 313 SetMsgHandled(delegate_->OnHostKeyEvent(&keyev)); |
314 return 0; | 314 return 0; |
315 } | 315 } |
316 | 316 |
317 LRESULT RootWindowHostWin::OnMouseRange(UINT message, | 317 LRESULT RootWindowHostWin::OnMouseRange(UINT message, |
318 WPARAM w_param, | 318 WPARAM w_param, |
319 LPARAM l_param) { | 319 LPARAM l_param) { |
320 MSG msg = { hwnd(), message, w_param, l_param, 0, | 320 MSG msg = { hwnd(), message, w_param, l_param, 0, |
321 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; | 321 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; |
322 MouseEvent event(msg); | 322 ui::MouseEvent event(msg); |
323 bool handled = false; | 323 bool handled = false; |
324 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) | 324 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) |
325 handled = delegate_->OnHostMouseEvent(&event); | 325 handled = delegate_->OnHostMouseEvent(&event); |
326 SetMsgHandled(handled); | 326 SetMsgHandled(handled); |
327 return 0; | 327 return 0; |
328 } | 328 } |
329 | 329 |
330 LRESULT RootWindowHostWin::OnCaptureChanged(UINT message, | 330 LRESULT RootWindowHostWin::OnCaptureChanged(UINT message, |
331 WPARAM w_param, | 331 WPARAM w_param, |
332 LPARAM l_param) { | 332 LPARAM l_param) { |
(...skipping 10 matching lines...) Expand all Loading... |
343 } | 343 } |
344 | 344 |
345 void RootWindowHostWin::OnSize(UINT param, const CSize& size) { | 345 void RootWindowHostWin::OnSize(UINT param, const CSize& size) { |
346 // Minimizing resizes the window to 0x0 which causes our layout to go all | 346 // Minimizing resizes the window to 0x0 which causes our layout to go all |
347 // screwy, so we just ignore it. | 347 // screwy, so we just ignore it. |
348 if (param != SIZE_MINIMIZED) | 348 if (param != SIZE_MINIMIZED) |
349 delegate_->OnHostResized(gfx::Size(size.cx, size.cy)); | 349 delegate_->OnHostResized(gfx::Size(size.cx, size.cy)); |
350 } | 350 } |
351 | 351 |
352 } // namespace aura | 352 } // namespace aura |
OLD | NEW |