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/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 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_FileOpenDone, | 154 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_FileOpenDone, |
155 OnFileOpenDone) | 155 OnFileOpenDone) |
156 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MultiFileOpenDone, | 156 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MultiFileOpenDone, |
157 OnMultiFileOpenDone) | 157 OnMultiFileOpenDone) |
158 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SelectFolderDone, | 158 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SelectFolderDone, |
159 OnSelectFolderDone) | 159 OnSelectFolderDone) |
160 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_WindowActivated, | 160 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_WindowActivated, |
161 OnWindowActivated) | 161 OnWindowActivated) |
162 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPosAck, | 162 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPosAck, |
163 OnSetCursorPosAck) | 163 OnSetCursorPosAck) |
| 164 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_WindowSizeChanged, |
| 165 OnWindowSizeChanged) |
164 IPC_MESSAGE_UNHANDLED(handled = false) | 166 IPC_MESSAGE_UNHANDLED(handled = false) |
165 IPC_END_MESSAGE_MAP() | 167 IPC_END_MESSAGE_MAP() |
166 return handled; | 168 return handled; |
167 } | 169 } |
168 | 170 |
169 void RemoteRootWindowHostWin::HandleOpenFile( | 171 void RemoteRootWindowHostWin::HandleOpenFile( |
170 const string16& title, | 172 const string16& title, |
171 const base::FilePath& default_path, | 173 const base::FilePath& default_path, |
172 const string16& filter, | 174 const string16& filter, |
173 const OpenFileCompletion& callback) { | 175 const OpenFileCompletion& callback) { |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 497 |
496 void RemoteRootWindowHostWin::OnWindowActivated(bool active) { | 498 void RemoteRootWindowHostWin::OnWindowActivated(bool active) { |
497 active ? GetRootWindow()->Focus() : GetRootWindow()->Blur(); | 499 active ? GetRootWindow()->Focus() : GetRootWindow()->Blur(); |
498 } | 500 } |
499 | 501 |
500 void RemoteRootWindowHostWin::OnSetCursorPosAck() { | 502 void RemoteRootWindowHostWin::OnSetCursorPosAck() { |
501 DCHECK(ignore_mouse_moves_until_set_cursor_ack_); | 503 DCHECK(ignore_mouse_moves_until_set_cursor_ack_); |
502 ignore_mouse_moves_until_set_cursor_ack_ = false; | 504 ignore_mouse_moves_until_set_cursor_ack_ = false; |
503 } | 505 } |
504 | 506 |
| 507 void RemoteRootWindowHostWin::OnWindowSizeChanged(uint32 width, uint32 height) { |
| 508 SetBounds(gfx::Rect(0, 0, width, height)); |
| 509 } |
| 510 |
505 void RemoteRootWindowHostWin::DispatchKeyboardMessage(ui::EventType type, | 511 void RemoteRootWindowHostWin::DispatchKeyboardMessage(ui::EventType type, |
506 uint32 vkey, | 512 uint32 vkey, |
507 uint32 repeat_count, | 513 uint32 repeat_count, |
508 uint32 scan_code, | 514 uint32 scan_code, |
509 uint32 flags, | 515 uint32 flags, |
510 bool is_character) { | 516 bool is_character) { |
511 if (base::MessageLoop::current()->IsNested()) { | 517 if (base::MessageLoop::current()->IsNested()) { |
512 SetVirtualKeyStates(flags); | 518 SetVirtualKeyStates(flags); |
513 | 519 |
514 uint32 message = is_character ? WM_CHAR : | 520 uint32 message = is_character ? WM_CHAR : |
515 (type == ui::ET_KEY_PRESSED ? WM_KEYDOWN : WM_KEYUP); | 521 (type == ui::ET_KEY_PRESSED ? WM_KEYDOWN : WM_KEYUP); |
516 ::PostThreadMessage(::GetCurrentThreadId(), | 522 ::PostThreadMessage(::GetCurrentThreadId(), |
517 message, | 523 message, |
518 vkey, | 524 vkey, |
519 repeat_count | scan_code >> 15); | 525 repeat_count | scan_code >> 15); |
520 } else { | 526 } else { |
521 ui::KeyEvent event(type, | 527 ui::KeyEvent event(type, |
522 ui::KeyboardCodeForWindowsKeyCode(vkey), | 528 ui::KeyboardCodeForWindowsKeyCode(vkey), |
523 flags, | 529 flags, |
524 is_character); | 530 is_character); |
525 delegate_->OnHostKeyEvent(&event); | 531 delegate_->OnHostKeyEvent(&event); |
526 } | 532 } |
527 } | 533 } |
528 | 534 |
529 } // namespace aura | 535 } // namespace aura |
OLD | NEW |