| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 RemoteWindowTreeHostWin::RemoteWindowTreeHostWin() | 92 RemoteWindowTreeHostWin::RemoteWindowTreeHostWin() |
| 93 : remote_window_(NULL), | 93 : remote_window_(NULL), |
| 94 host_(NULL), | 94 host_(NULL), |
| 95 ignore_mouse_moves_until_set_cursor_ack_(0), | 95 ignore_mouse_moves_until_set_cursor_ack_(0), |
| 96 event_flags_(0), | 96 event_flags_(0), |
| 97 window_size_(aura::WindowTreeHost::GetNativeScreenSize()) { | 97 window_size_(aura::WindowTreeHost::GetNativeScreenSize()) { |
| 98 CHECK(!g_instance); | 98 CHECK(!g_instance); |
| 99 g_instance = this; | 99 g_instance = this; |
| 100 prop_.reset(new ui::ViewProp(NULL, kWindowTreeHostWinKey, this)); | 100 prop_.reset(new ui::ViewProp(NULL, kWindowTreeHostWinKey, this)); |
| 101 CreateCompositor(GetAcceleratedWidget()); | 101 CreateCompositor(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 RemoteWindowTreeHostWin::~RemoteWindowTreeHostWin() { | 104 RemoteWindowTreeHostWin::~RemoteWindowTreeHostWin() { |
| 105 DestroyCompositor(); | 105 DestroyCompositor(); |
| 106 DestroyDispatcher(); | 106 DestroyDispatcher(); |
| 107 DCHECK_EQ(g_instance, this); | 107 DCHECK_EQ(g_instance, this); |
| 108 g_instance = NULL; | 108 g_instance = NULL; |
| 109 } | 109 } |
| 110 | 110 |
| 111 // static | 111 // static |
| 112 bool RemoteWindowTreeHostWin::IsValid() { | 112 bool RemoteWindowTreeHostWin::IsValid() { |
| 113 return Instance()->remote_window_ != NULL; | 113 return Instance()->remote_window_ != NULL; |
| 114 } | 114 } |
| 115 | 115 |
| 116 void RemoteWindowTreeHostWin::SetRemoteWindowHandle(HWND remote_window) { | 116 void RemoteWindowTreeHostWin::SetRemoteWindowHandle(HWND remote_window) { |
| 117 remote_window_ = remote_window; | 117 remote_window_ = remote_window; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void RemoteWindowTreeHostWin::Connected(IPC::Sender* host) { | 120 void RemoteWindowTreeHostWin::Connected(IPC::Sender* host) { |
| 121 CHECK(host_ == NULL); | 121 CHECK(host_ == NULL); |
| 122 DCHECK(remote_window_); | 122 DCHECK(remote_window_); |
| 123 host_ = host; | 123 host_ = host; |
| 124 // Recreate the compositor for the target surface represented by the | 124 // Recreate the compositor for the target surface represented by the |
| 125 // remote_window HWND. | 125 // remote_window HWND. |
| 126 CreateCompositor(remote_window_); | 126 CreateCompositor(); |
| 127 OnAcceleratedWidgetAvailable(); |
| 127 InitCompositor(); | 128 InitCompositor(); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void RemoteWindowTreeHostWin::Disconnected() { | 131 void RemoteWindowTreeHostWin::Disconnected() { |
| 131 // Don't CHECK here, Disconnected is called on a channel error which can | 132 // Don't CHECK here, Disconnected is called on a channel error which can |
| 132 // happen before we're successfully Connected. | 133 // happen before we're successfully Connected. |
| 133 if (!host_) | 134 if (!host_) |
| 134 return; | 135 return; |
| 135 ui::RemoteInputMethodPrivateWin* remote_input_method_private = | 136 ui::RemoteInputMethodPrivateWin* remote_input_method_private = |
| 136 GetRemoteInputMethodPrivate(); | 137 GetRemoteInputMethodPrivate(); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 506 } |
| 506 | 507 |
| 507 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { | 508 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { |
| 508 if (flags == event_flags_) | 509 if (flags == event_flags_) |
| 509 return; | 510 return; |
| 510 event_flags_ = flags; | 511 event_flags_ = flags; |
| 511 SetVirtualKeyStates(event_flags_); | 512 SetVirtualKeyStates(event_flags_); |
| 512 } | 513 } |
| 513 | 514 |
| 514 } // namespace aura | 515 } // namespace aura |
| OLD | NEW |