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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_FileSaveAsDone, | 149 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_FileSaveAsDone, |
150 OnFileSaveAsDone) | 150 OnFileSaveAsDone) |
151 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_FileOpenDone, | 151 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_FileOpenDone, |
152 OnFileOpenDone) | 152 OnFileOpenDone) |
153 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MultiFileOpenDone, | 153 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MultiFileOpenDone, |
154 OnMultiFileOpenDone) | 154 OnMultiFileOpenDone) |
155 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SelectFolderDone, | 155 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SelectFolderDone, |
156 OnSelectFolderDone) | 156 OnSelectFolderDone) |
157 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_WindowActivated, | 157 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_WindowActivated, |
158 OnWindowActivated) | 158 OnWindowActivated) |
| 159 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_WindowSizeChanged, |
| 160 OnWindowSizeChanged) |
159 IPC_MESSAGE_UNHANDLED(handled = false) | 161 IPC_MESSAGE_UNHANDLED(handled = false) |
160 IPC_END_MESSAGE_MAP() | 162 IPC_END_MESSAGE_MAP() |
161 return handled; | 163 return handled; |
162 } | 164 } |
163 | 165 |
164 void RemoteRootWindowHostWin::HandleOpenFile( | 166 void RemoteRootWindowHostWin::HandleOpenFile( |
165 const string16& title, | 167 const string16& title, |
166 const base::FilePath& default_path, | 168 const base::FilePath& default_path, |
167 const string16& filter, | 169 const string16& filter, |
168 const OpenFileCompletion& callback) { | 170 const OpenFileCompletion& callback) { |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 if (success) { | 456 if (success) { |
455 select_folder_completion_callback_.Run(base::FilePath(folder), 0, NULL); | 457 select_folder_completion_callback_.Run(base::FilePath(folder), 0, NULL); |
456 } | 458 } |
457 select_folder_completion_callback_.Reset(); | 459 select_folder_completion_callback_.Reset(); |
458 } | 460 } |
459 | 461 |
460 void RemoteRootWindowHostWin::OnWindowActivated(bool active) { | 462 void RemoteRootWindowHostWin::OnWindowActivated(bool active) { |
461 active ? GetRootWindow()->Focus() : GetRootWindow()->Blur(); | 463 active ? GetRootWindow()->Focus() : GetRootWindow()->Blur(); |
462 } | 464 } |
463 | 465 |
| 466 void RemoteRootWindowHostWin::OnWindowSizeChanged(int32 width, int32 height) { |
| 467 SetBounds(gfx::Rect(0, 0, width, height)); |
| 468 } |
| 469 |
464 void RemoteRootWindowHostWin::DispatchKeyboardMessage(ui::EventType type, | 470 void RemoteRootWindowHostWin::DispatchKeyboardMessage(ui::EventType type, |
465 uint32 vkey, | 471 uint32 vkey, |
466 uint32 repeat_count, | 472 uint32 repeat_count, |
467 uint32 scan_code, | 473 uint32 scan_code, |
468 uint32 flags, | 474 uint32 flags, |
469 bool is_character) { | 475 bool is_character) { |
470 if (base::MessageLoop::current()->IsNested()) { | 476 if (base::MessageLoop::current()->IsNested()) { |
471 SetVirtualKeyStates(flags); | 477 SetVirtualKeyStates(flags); |
472 | 478 |
473 uint32 message = is_character ? WM_CHAR : | 479 uint32 message = is_character ? WM_CHAR : |
474 (type == ui::ET_KEY_PRESSED ? WM_KEYDOWN : WM_KEYUP); | 480 (type == ui::ET_KEY_PRESSED ? WM_KEYDOWN : WM_KEYUP); |
475 ::PostThreadMessage(::GetCurrentThreadId(), | 481 ::PostThreadMessage(::GetCurrentThreadId(), |
476 message, | 482 message, |
477 vkey, | 483 vkey, |
478 repeat_count | scan_code >> 15); | 484 repeat_count | scan_code >> 15); |
479 } else { | 485 } else { |
480 ui::KeyEvent event(type, | 486 ui::KeyEvent event(type, |
481 ui::KeyboardCodeForWindowsKeyCode(vkey), | 487 ui::KeyboardCodeForWindowsKeyCode(vkey), |
482 flags, | 488 flags, |
483 is_character); | 489 is_character); |
484 delegate_->OnHostKeyEvent(&event); | 490 delegate_->OnHostKeyEvent(&event); |
485 } | 491 } |
486 } | 492 } |
487 | 493 |
488 } // namespace aura | 494 } // namespace aura |
OLD | NEW |