Chromium Code Reviews| 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_window_tree_host_win.h" | 5 #include "ui/aura/remote_window_tree_host_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 RemoteWindowTreeHostWin* g_instance = NULL; | 86 RemoteWindowTreeHostWin* g_instance = NULL; |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 RemoteWindowTreeHostWin* RemoteWindowTreeHostWin::Instance() { | 89 RemoteWindowTreeHostWin* RemoteWindowTreeHostWin::Instance() { |
| 90 return g_instance; | 90 return g_instance; |
| 91 } | 91 } |
| 92 | 92 |
| 93 RemoteWindowTreeHostWin::RemoteWindowTreeHostWin() | 93 RemoteWindowTreeHostWin::RemoteWindowTreeHostWin() |
| 94 : remote_window_(NULL), | 94 : remote_window_(NULL), |
| 95 host_(NULL), | 95 host_(NULL), |
| 96 ignore_mouse_moves_until_set_cursor_ack_(false), | 96 ignore_mouse_moves_until_set_cursor_ack_(0), |
| 97 event_flags_(0), | 97 event_flags_(0), |
| 98 window_size_(aura::WindowTreeHost::GetNativeScreenSize()) { | 98 window_size_(aura::WindowTreeHost::GetNativeScreenSize()) { |
| 99 CHECK(!g_instance); | 99 CHECK(!g_instance); |
| 100 g_instance = this; | 100 g_instance = this; |
| 101 prop_.reset(new ui::ViewProp(NULL, kWindowTreeHostWinKey, this)); | 101 prop_.reset(new ui::ViewProp(NULL, kWindowTreeHostWinKey, this)); |
| 102 CreateCompositor(GetAcceleratedWidget()); | 102 CreateCompositor(GetAcceleratedWidget()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 RemoteWindowTreeHostWin::~RemoteWindowTreeHostWin() { | 105 RemoteWindowTreeHostWin::~RemoteWindowTreeHostWin() { |
| 106 DestroyCompositor(); | 106 DestroyCompositor(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 // Other cases which don't expect this behavior should continue to work | 255 // Other cases which don't expect this behavior should continue to work |
| 256 // without issues. | 256 // without issues. |
| 257 | 257 |
| 258 // The mouse events are received by the viewer process and sent to the | 258 // The mouse events are received by the viewer process and sent to the |
| 259 // browser. If we invoke the SetCursor API here we continue to receive | 259 // browser. If we invoke the SetCursor API here we continue to receive |
| 260 // mouse messages from the viewer which were posted before the SetCursor | 260 // mouse messages from the viewer which were posted before the SetCursor |
| 261 // API executes which messes up the state in the browser. To workaround | 261 // API executes which messes up the state in the browser. To workaround |
| 262 // this we invoke the SetCursor API in the viewer process and ignore | 262 // this we invoke the SetCursor API in the viewer process and ignore |
| 263 // mouse messages until we received an ACK from the viewer indicating that | 263 // mouse messages until we received an ACK from the viewer indicating that |
| 264 // the SetCursor operation completed. | 264 // the SetCursor operation completed. |
| 265 ignore_mouse_moves_until_set_cursor_ack_ = true; | 265 ignore_mouse_moves_until_set_cursor_ack_++; |
| 266 VLOG(1) << "In MoveCursorTo. Sending IPC"; | 266 VLOG(1) << "In MoveCursorTo. Sending IPC"; |
| 267 host_->Send(new MetroViewerHostMsg_SetCursorPos(location.x(), location.y())); | 267 host_->Send(new MetroViewerHostMsg_SetCursorPos(location.x(), location.y())); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void RemoteWindowTreeHostWin::OnCursorVisibilityChangedNative(bool show) { | 270 void RemoteWindowTreeHostWin::OnCursorVisibilityChangedNative(bool show) { |
| 271 NOTIMPLEMENTED(); | 271 NOTIMPLEMENTED(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void RemoteWindowTreeHostWin::PostNativeEvent( | 274 void RemoteWindowTreeHostWin::PostNativeEvent( |
| 275 const base::NativeEvent& native_event) { | 275 const base::NativeEvent& native_event) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 uint32 pointer_id) { | 423 uint32 pointer_id) { |
| 424 gfx::Point location = PointFromNativeEvent(x, y); | 424 gfx::Point location = PointFromNativeEvent(x, y); |
| 425 ui::TouchEvent event(ui::ET_TOUCH_MOVED, | 425 ui::TouchEvent event(ui::ET_TOUCH_MOVED, |
| 426 location, | 426 location, |
| 427 pointer_id, | 427 pointer_id, |
| 428 base::TimeDelta::FromMicroseconds(timestamp)); | 428 base::TimeDelta::FromMicroseconds(timestamp)); |
| 429 SendEventToProcessor(&event); | 429 SendEventToProcessor(&event); |
| 430 } | 430 } |
| 431 | 431 |
| 432 void RemoteWindowTreeHostWin::OnSetCursorPosAck() { | 432 void RemoteWindowTreeHostWin::OnSetCursorPosAck() { |
| 433 DCHECK(ignore_mouse_moves_until_set_cursor_ack_); | 433 if (ignore_mouse_moves_until_set_cursor_ack_ > 0) { |
|
sky
2014/09/09 23:34:18
DCHECK?
ananta
2014/09/09 23:39:17
Done.
| |
| 434 ignore_mouse_moves_until_set_cursor_ack_ = false; | 434 ignore_mouse_moves_until_set_cursor_ack_--; |
| 435 } else { | |
| 436 NOTREACHED() << "Received unexpected SetCursorPos ACK"; | |
| 437 } | |
| 435 } | 438 } |
| 436 | 439 |
| 437 ui::RemoteInputMethodPrivateWin* | 440 ui::RemoteInputMethodPrivateWin* |
| 438 RemoteWindowTreeHostWin::GetRemoteInputMethodPrivate() { | 441 RemoteWindowTreeHostWin::GetRemoteInputMethodPrivate() { |
| 439 ui::InputMethod* input_method = GetAshWindow()->GetProperty( | 442 ui::InputMethod* input_method = GetAshWindow()->GetProperty( |
| 440 aura::client::kRootWindowInputMethodKey); | 443 aura::client::kRootWindowInputMethodKey); |
| 441 return ui::RemoteInputMethodPrivateWin::Get(input_method); | 444 return ui::RemoteInputMethodPrivateWin::Get(input_method); |
| 442 } | 445 } |
| 443 | 446 |
| 444 void RemoteWindowTreeHostWin::OnImeCandidatePopupChanged(bool visible) { | 447 void RemoteWindowTreeHostWin::OnImeCandidatePopupChanged(bool visible) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 } | 518 } |
| 516 | 519 |
| 517 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { | 520 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { |
| 518 if (flags == event_flags_) | 521 if (flags == event_flags_) |
| 519 return; | 522 return; |
| 520 event_flags_ = flags; | 523 event_flags_ = flags; |
| 521 SetVirtualKeyStates(event_flags_); | 524 SetVirtualKeyStates(event_flags_); |
| 522 } | 525 } |
| 523 | 526 |
| 524 } // namespace aura | 527 } // namespace aura |
| OLD | NEW |