| 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/desktop_capture_device_aura.h" | 5 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 aura::Window* window = DesktopMediaID::GetAuraWindowById(source); | 24 aura::Window* window = DesktopMediaID::GetAuraWindowById(source); |
| 25 if (window) | 25 if (window) |
| 26 machine->SetWindow(window); | 26 machine->SetWindow(window); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 DesktopCaptureDeviceAura::DesktopCaptureDeviceAura( | 31 DesktopCaptureDeviceAura::DesktopCaptureDeviceAura( |
| 32 const DesktopMediaID& source) { | 32 const DesktopMediaID& source) { |
| 33 AuraWindowCaptureMachine* machine = new AuraWindowCaptureMachine(); | 33 AuraWindowCaptureMachine* machine = new AuraWindowCaptureMachine(); |
| 34 core_.reset(new media::ScreenCaptureDeviceCore(base::WrapUnique(machine))); | 34 core_.reset(new device::ScreenCaptureDeviceCore(base::WrapUnique(machine))); |
| 35 // |core_| owns |machine| and deletes it on UI thread so passing the raw | 35 // |core_| owns |machine| and deletes it on UI thread so passing the raw |
| 36 // pointer to the UI thread is safe here. | 36 // pointer to the UI thread is safe here. |
| 37 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 37 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 38 base::Bind(&SetCaptureSource, machine, source)); | 38 base::Bind(&SetCaptureSource, machine, source)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 DesktopCaptureDeviceAura::~DesktopCaptureDeviceAura() { | 41 DesktopCaptureDeviceAura::~DesktopCaptureDeviceAura() { |
| 42 DVLOG(2) << "DesktopCaptureDeviceAura@" << this << " destroying."; | 42 DVLOG(2) << "DesktopCaptureDeviceAura@" << this << " destroying."; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // static | 45 // static |
| 46 std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDeviceAura::Create( | 46 std::unique_ptr<device::VideoCaptureDevice> DesktopCaptureDeviceAura::Create( |
| 47 const DesktopMediaID& source) { | 47 const DesktopMediaID& source) { |
| 48 if (source.aura_id == DesktopMediaID::kNullId) | 48 if (source.aura_id == DesktopMediaID::kNullId) |
| 49 return nullptr; | 49 return nullptr; |
| 50 return std::unique_ptr<media::VideoCaptureDevice>( | 50 return std::unique_ptr<device::VideoCaptureDevice>( |
| 51 new DesktopCaptureDeviceAura(source)); | 51 new DesktopCaptureDeviceAura(source)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void DesktopCaptureDeviceAura::AllocateAndStart( | 54 void DesktopCaptureDeviceAura::AllocateAndStart( |
| 55 const media::VideoCaptureParams& params, | 55 const media::VideoCaptureParams& params, |
| 56 std::unique_ptr<Client> client) { | 56 std::unique_ptr<Client> client) { |
| 57 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 57 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
| 58 core_->AllocateAndStart(params, std::move(client)); | 58 core_->AllocateAndStart(params, std::move(client)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void DesktopCaptureDeviceAura::RequestRefreshFrame() { | 61 void DesktopCaptureDeviceAura::RequestRefreshFrame() { |
| 62 core_->RequestRefreshFrame(); | 62 core_->RequestRefreshFrame(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 65 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
| 66 core_->StopAndDeAllocate(); | 66 core_->StopAndDeAllocate(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace content | 69 } // namespace content |
| OLD | NEW |