OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chromecast/graphics/cast_window_manager_aura.h" | 5 #include "chromecast/graphics/cast_window_manager_aura.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "chromecast/graphics/cast_focus_client_aura.h" | 8 #include "chromecast/graphics/cast_focus_client_aura.h" |
9 #include "ui/aura/client/default_capture_client.h" | 9 #include "ui/aura/client/default_capture_client.h" |
10 #include "ui/aura/client/focus_change_observer.h" | 10 #include "ui/aura/client/focus_change_observer.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 focus_client_.reset(new CastFocusClientAura()); | 205 focus_client_.reset(new CastFocusClientAura()); |
206 aura::client::SetFocusClient(window_tree_host_->window(), | 206 aura::client::SetFocusClient(window_tree_host_->window(), |
207 focus_client_.get()); | 207 focus_client_.get()); |
208 aura::client::SetActivationClient(window_tree_host_->window(), | 208 aura::client::SetActivationClient(window_tree_host_->window(), |
209 focus_client_.get()); | 209 focus_client_.get()); |
210 aura::client::SetWindowParentingClient(window_tree_host_->window(), this); | 210 aura::client::SetWindowParentingClient(window_tree_host_->window(), this); |
211 capture_client_.reset( | 211 capture_client_.reset( |
212 new aura::client::DefaultCaptureClient(window_tree_host_->window())); | 212 new aura::client::DefaultCaptureClient(window_tree_host_->window())); |
213 | 213 |
214 CastVSyncSettings::GetInstance()->AddObserver(this); | |
215 window_tree_host_->compositor()->SetAuthoritativeVSyncInterval( | |
216 CastVSyncSettings::GetInstance()->GetVSyncInterval()); | |
217 | |
218 window_tree_host_->Show(); | 214 window_tree_host_->Show(); |
219 } | 215 } |
220 | 216 |
221 void CastWindowManagerAura::TearDown() { | 217 void CastWindowManagerAura::TearDown() { |
222 if (!window_tree_host_) { | 218 if (!window_tree_host_) { |
223 return; | 219 return; |
224 } | 220 } |
225 CastVSyncSettings::GetInstance()->RemoveObserver(this); | |
226 capture_client_.reset(); | 221 capture_client_.reset(); |
227 aura::client::SetWindowParentingClient(window_tree_host_->window(), nullptr); | 222 aura::client::SetWindowParentingClient(window_tree_host_->window(), nullptr); |
228 aura::client::SetActivationClient(window_tree_host_->window(), nullptr); | 223 aura::client::SetActivationClient(window_tree_host_->window(), nullptr); |
229 aura::client::SetFocusClient(window_tree_host_->window(), nullptr); | 224 aura::client::SetFocusClient(window_tree_host_->window(), nullptr); |
230 focus_client_.reset(); | 225 focus_client_.reset(); |
231 window_tree_host_.reset(); | 226 window_tree_host_.reset(); |
232 } | 227 } |
233 | 228 |
234 void CastWindowManagerAura::SetWindowId(gfx::NativeView window, | 229 void CastWindowManagerAura::SetWindowId(gfx::NativeView window, |
235 WindowId window_id) { | 230 WindowId window_id) { |
(...skipping 15 matching lines...) Expand all Loading... |
251 LOG(INFO) << "Adding window: " << child->id() << ": " << child->GetName(); | 246 LOG(INFO) << "Adding window: " << child->id() << ": " << child->GetName(); |
252 Setup(); | 247 Setup(); |
253 | 248 |
254 DCHECK(child); | 249 DCHECK(child); |
255 aura::Window* parent = window_tree_host_->window(); | 250 aura::Window* parent = window_tree_host_->window(); |
256 if (!parent->Contains(child)) { | 251 if (!parent->Contains(child)) { |
257 parent->AddChild(child); | 252 parent->AddChild(child); |
258 } | 253 } |
259 } | 254 } |
260 | 255 |
261 void CastWindowManagerAura::OnVSyncIntervalChanged(base::TimeDelta interval) { | |
262 DCHECK(window_tree_host_.get()); | |
263 window_tree_host_->compositor()->SetAuthoritativeVSyncInterval(interval); | |
264 } | |
265 | |
266 } // namespace chromecast | 256 } // namespace chromecast |
OLD | NEW |