OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/media/capture/aura_window_capture_machine.h" | 5 #include "content/browser/media/capture/aura_window_capture_machine.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // Update capture size. | 78 // Update capture size. |
79 UpdateCaptureSize(); | 79 UpdateCaptureSize(); |
80 | 80 |
81 // Start observing compositor updates. | 81 // Start observing compositor updates. |
82 aura::WindowTreeHost* const host = desktop_window_->GetHost(); | 82 aura::WindowTreeHost* const host = desktop_window_->GetHost(); |
83 ui::Compositor* const compositor = host ? host->compositor() : nullptr; | 83 ui::Compositor* const compositor = host ? host->compositor() : nullptr; |
84 if (!compositor) | 84 if (!compositor) |
85 return false; | 85 return false; |
86 compositor->AddAnimationObserver(this); | 86 compositor->AddAnimationObserver(this); |
87 | 87 |
88 power_save_blocker_.reset( | 88 power_save_blocker_.reset(new device::PowerSaveBlocker( |
89 device::PowerSaveBlocker::CreateWithTaskRunners( | 89 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
90 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 90 device::PowerSaveBlocker::kReasonOther, "DesktopCaptureDevice is running", |
91 device::PowerSaveBlocker::kReasonOther, | 91 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
92 "DesktopCaptureDevice is running", | 92 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); |
93 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | |
94 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)) | |
95 .release()); | |
96 | 93 |
97 return true; | 94 return true; |
98 } | 95 } |
99 | 96 |
100 void AuraWindowCaptureMachine::Stop(const base::Closure& callback) { | 97 void AuraWindowCaptureMachine::Stop(const base::Closure& callback) { |
101 // Stops the capture machine asynchronously. | 98 // Stops the capture machine asynchronously. |
102 BrowserThread::PostTask( | 99 BrowserThread::PostTask( |
103 BrowserThread::UI, FROM_HERE, base::Bind( | 100 BrowserThread::UI, FROM_HERE, base::Bind( |
104 &AuraWindowCaptureMachine::InternalStop, | 101 &AuraWindowCaptureMachine::InternalStop, |
105 base::Unretained(this), | 102 base::Unretained(this), |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 Capture(timestamp); | 411 Capture(timestamp); |
415 } | 412 } |
416 | 413 |
417 void AuraWindowCaptureMachine::OnCompositingShuttingDown( | 414 void AuraWindowCaptureMachine::OnCompositingShuttingDown( |
418 ui::Compositor* compositor) { | 415 ui::Compositor* compositor) { |
419 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 416 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
420 compositor->RemoveAnimationObserver(this); | 417 compositor->RemoveAnimationObserver(this); |
421 } | 418 } |
422 | 419 |
423 } // namespace content | 420 } // namespace content |
OLD | NEW |