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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 ash_exit); | 142 ash_exit); |
143 } | 143 } |
144 | 144 |
145 void HandleMetroExit() { | 145 void HandleMetroExit() { |
146 DCHECK(aura::RemoteWindowTreeHostWin::Instance()); | 146 DCHECK(aura::RemoteWindowTreeHostWin::Instance()); |
147 aura::RemoteWindowTreeHostWin::Instance()->HandleMetroExit(); | 147 aura::RemoteWindowTreeHostWin::Instance()->HandleMetroExit(); |
148 } | 148 } |
149 | 149 |
150 RemoteWindowTreeHostWin* g_instance = NULL; | 150 RemoteWindowTreeHostWin* g_instance = NULL; |
151 | 151 |
| 152 // static |
152 RemoteWindowTreeHostWin* RemoteWindowTreeHostWin::Instance() { | 153 RemoteWindowTreeHostWin* RemoteWindowTreeHostWin::Instance() { |
153 if (g_instance) | 154 if (!g_instance) |
154 return g_instance; | 155 g_instance = new RemoteWindowTreeHostWin(gfx::Rect()); |
155 return Create(gfx::Rect()); | |
156 } | |
157 | |
158 RemoteWindowTreeHostWin* RemoteWindowTreeHostWin::Create( | |
159 const gfx::Rect& bounds) { | |
160 g_instance = g_instance ? g_instance : new RemoteWindowTreeHostWin(bounds); | |
161 return g_instance; | 156 return g_instance; |
162 } | 157 } |
163 | 158 |
| 159 // static |
| 160 void RemoteWindowTreeHostWin::SetInstance(RemoteWindowTreeHostWin* instance) { |
| 161 CHECK(!g_instance); |
| 162 g_instance = instance; |
| 163 } |
| 164 |
164 RemoteWindowTreeHostWin::RemoteWindowTreeHostWin(const gfx::Rect& bounds) | 165 RemoteWindowTreeHostWin::RemoteWindowTreeHostWin(const gfx::Rect& bounds) |
165 : remote_window_(NULL), | 166 : remote_window_(NULL), |
166 host_(NULL), | 167 host_(NULL), |
167 ignore_mouse_moves_until_set_cursor_ack_(false), | 168 ignore_mouse_moves_until_set_cursor_ack_(false), |
168 event_flags_(0), | 169 event_flags_(0), |
169 window_size_(aura::WindowTreeHost::GetNativeScreenSize()) { | 170 window_size_(aura::WindowTreeHost::GetNativeScreenSize()) { |
170 prop_.reset(new ui::ViewProp(NULL, kWindowTreeHostWinKey, this)); | 171 prop_.reset(new ui::ViewProp(NULL, kWindowTreeHostWinKey, this)); |
171 CreateCompositor(GetAcceleratedWidget()); | 172 CreateCompositor(GetAcceleratedWidget()); |
172 } | 173 } |
173 | 174 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 ui::RemoteInputMethodPrivateWin* remote_input_method_private = | 384 ui::RemoteInputMethodPrivateWin* remote_input_method_private = |
384 GetRemoteInputMethodPrivate(); | 385 GetRemoteInputMethodPrivate(); |
385 if (remote_input_method_private) | 386 if (remote_input_method_private) |
386 remote_input_method_private->SetRemoteDelegate(this); | 387 remote_input_method_private->SetRemoteDelegate(this); |
387 } | 388 } |
388 | 389 |
389 void RemoteWindowTreeHostWin::Hide() { | 390 void RemoteWindowTreeHostWin::Hide() { |
390 NOTIMPLEMENTED(); | 391 NOTIMPLEMENTED(); |
391 } | 392 } |
392 | 393 |
393 void RemoteWindowTreeHostWin::ToggleFullScreen() { | |
394 } | |
395 | |
396 gfx::Rect RemoteWindowTreeHostWin::GetBounds() const { | 394 gfx::Rect RemoteWindowTreeHostWin::GetBounds() const { |
397 return gfx::Rect(window_size_); | 395 return gfx::Rect(window_size_); |
398 } | 396 } |
399 | 397 |
400 void RemoteWindowTreeHostWin::SetBounds(const gfx::Rect& bounds) { | 398 void RemoteWindowTreeHostWin::SetBounds(const gfx::Rect& bounds) { |
401 window_size_ = bounds.size(); | 399 window_size_ = bounds.size(); |
402 OnHostResized(bounds.size()); | 400 OnHostResized(bounds.size()); |
403 } | 401 } |
404 | 402 |
405 gfx::Insets RemoteWindowTreeHostWin::GetInsets() const { | |
406 return gfx::Insets(); | |
407 } | |
408 | |
409 void RemoteWindowTreeHostWin::SetInsets(const gfx::Insets& insets) { | |
410 } | |
411 | |
412 gfx::Point RemoteWindowTreeHostWin::GetLocationOnNativeScreen() const { | 403 gfx::Point RemoteWindowTreeHostWin::GetLocationOnNativeScreen() const { |
413 return gfx::Point(0, 0); | 404 return gfx::Point(0, 0); |
414 } | 405 } |
415 | 406 |
416 void RemoteWindowTreeHostWin::SetCapture() { | 407 void RemoteWindowTreeHostWin::SetCapture() { |
417 } | 408 } |
418 | 409 |
419 void RemoteWindowTreeHostWin::ReleaseCapture() { | 410 void RemoteWindowTreeHostWin::ReleaseCapture() { |
420 } | 411 } |
421 | 412 |
422 bool RemoteWindowTreeHostWin::QueryMouseLocation(gfx::Point* location_return) { | 413 bool RemoteWindowTreeHostWin::QueryMouseLocation(gfx::Point* location_return) { |
423 aura::client::CursorClient* cursor_client = | 414 aura::client::CursorClient* cursor_client = |
424 aura::client::GetCursorClient(window()); | 415 aura::client::GetCursorClient(window()); |
425 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { | 416 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { |
426 *location_return = gfx::Point(0, 0); | 417 *location_return = gfx::Point(0, 0); |
427 return false; | 418 return false; |
428 } | 419 } |
429 POINT pt; | 420 POINT pt; |
430 GetCursorPos(&pt); | 421 GetCursorPos(&pt); |
431 *location_return = | 422 *location_return = |
432 gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y)); | 423 gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y)); |
433 return true; | 424 return true; |
434 } | 425 } |
435 | 426 |
436 bool RemoteWindowTreeHostWin::ConfineCursorToRootWindow() { | |
437 return true; | |
438 } | |
439 | |
440 void RemoteWindowTreeHostWin::UnConfineCursor() { | |
441 } | |
442 | |
443 void RemoteWindowTreeHostWin::SetCursorNative(gfx::NativeCursor native_cursor) { | 427 void RemoteWindowTreeHostWin::SetCursorNative(gfx::NativeCursor native_cursor) { |
444 if (!host_) | 428 if (!host_) |
445 return; | 429 return; |
446 host_->Send( | 430 host_->Send( |
447 new MetroViewerHostMsg_SetCursor(uint64(native_cursor.platform()))); | 431 new MetroViewerHostMsg_SetCursor(uint64(native_cursor.platform()))); |
448 } | 432 } |
449 | 433 |
450 void RemoteWindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) { | 434 void RemoteWindowTreeHostWin::MoveCursorToNative(const gfx::Point& location) { |
451 VLOG(1) << "In MoveCursorTo: " << location.x() << ", " << location.y(); | 435 VLOG(1) << "In MoveCursorTo: " << location.x() << ", " << location.y(); |
452 if (!host_) | 436 if (!host_) |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 } | 749 } |
766 | 750 |
767 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { | 751 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { |
768 if (flags == event_flags_) | 752 if (flags == event_flags_) |
769 return; | 753 return; |
770 event_flags_ = flags; | 754 event_flags_ = flags; |
771 SetVirtualKeyStates(event_flags_); | 755 SetVirtualKeyStates(event_flags_); |
772 } | 756 } |
773 | 757 |
774 } // namespace aura | 758 } // namespace aura |
OLD | NEW |