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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // static |
153 RemoteWindowTreeHostWin* RemoteWindowTreeHostWin::Instance() { | 153 RemoteWindowTreeHostWin* RemoteWindowTreeHostWin::Instance() { |
154 return g_instance; | 154 return g_instance; |
155 } | 155 } |
156 | 156 |
157 RemoteWindowTreeHostWin::RemoteWindowTreeHostWin() | 157 RemoteWindowTreeHostWin::RemoteWindowTreeHostWin( |
| 158 ui::ContextFactory* context_factory) |
158 : remote_window_(NULL), | 159 : remote_window_(NULL), |
159 host_(NULL), | 160 host_(NULL), |
160 ignore_mouse_moves_until_set_cursor_ack_(false), | 161 ignore_mouse_moves_until_set_cursor_ack_(false), |
161 event_flags_(0), | 162 event_flags_(0), |
162 window_size_(aura::WindowTreeHost::GetNativeScreenSize()) { | 163 window_size_(aura::WindowTreeHost::GetNativeScreenSize()) { |
163 CHECK(!g_instance); | 164 CHECK(!g_instance); |
164 g_instance = this; | 165 g_instance = this; |
165 prop_.reset(new ui::ViewProp(NULL, kWindowTreeHostWinKey, this)); | 166 prop_.reset(new ui::ViewProp(NULL, kWindowTreeHostWinKey, this)); |
166 CreateCompositor(GetAcceleratedWidget()); | 167 CreateCompositor(GetAcceleratedWidget(), context_factory); |
167 } | 168 } |
168 | 169 |
169 RemoteWindowTreeHostWin::~RemoteWindowTreeHostWin() { | 170 RemoteWindowTreeHostWin::~RemoteWindowTreeHostWin() { |
170 DestroyCompositor(); | 171 DestroyCompositor(); |
171 DestroyDispatcher(); | 172 DestroyDispatcher(); |
172 DCHECK_EQ(g_instance, this); | 173 DCHECK_EQ(g_instance, this); |
173 g_instance = NULL; | 174 g_instance = NULL; |
174 } | 175 } |
175 | 176 |
176 // static | 177 // static |
177 bool RemoteWindowTreeHostWin::IsValid() { | 178 bool RemoteWindowTreeHostWin::IsValid() { |
178 return Instance()->remote_window_ != NULL; | 179 return Instance()->remote_window_ != NULL; |
179 } | 180 } |
180 | 181 |
181 void RemoteWindowTreeHostWin::SetRemoteWindowHandle(HWND remote_window) { | 182 void RemoteWindowTreeHostWin::SetRemoteWindowHandle(HWND remote_window) { |
182 remote_window_ = remote_window; | 183 remote_window_ = remote_window; |
183 } | 184 } |
184 | 185 |
185 void RemoteWindowTreeHostWin::Connected(IPC::Sender* host) { | 186 void RemoteWindowTreeHostWin::Connected(IPC::Sender* host) { |
186 CHECK(host_ == NULL); | 187 CHECK(host_ == NULL); |
187 DCHECK(remote_window_); | 188 DCHECK(remote_window_); |
188 host_ = host; | 189 host_ = host; |
189 // Recreate the compositor for the target surface represented by the | 190 // Recreate the compositor for the target surface represented by the |
190 // remote_window HWND. | 191 // remote_window HWND. |
191 CreateCompositor(remote_window_); | 192 CreateCompositor(remote_window_, compositor()->context_factory()); |
192 InitCompositor(); | 193 InitCompositor(); |
193 } | 194 } |
194 | 195 |
195 void RemoteWindowTreeHostWin::Disconnected() { | 196 void RemoteWindowTreeHostWin::Disconnected() { |
196 // Don't CHECK here, Disconnected is called on a channel error which can | 197 // Don't CHECK here, Disconnected is called on a channel error which can |
197 // happen before we're successfully Connected. | 198 // happen before we're successfully Connected. |
198 if (!host_) | 199 if (!host_) |
199 return; | 200 return; |
200 ui::RemoteInputMethodPrivateWin* remote_input_method_private = | 201 ui::RemoteInputMethodPrivateWin* remote_input_method_private = |
201 GetRemoteInputMethodPrivate(); | 202 GetRemoteInputMethodPrivate(); |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 } | 733 } |
733 | 734 |
734 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { | 735 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { |
735 if (flags == event_flags_) | 736 if (flags == event_flags_) |
736 return; | 737 return; |
737 event_flags_ = flags; | 738 event_flags_ = flags; |
738 SetVirtualKeyStates(event_flags_); | 739 SetVirtualKeyStates(event_flags_); |
739 } | 740 } |
740 | 741 |
741 } // namespace aura | 742 } // namespace aura |
OLD | NEW |