| 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" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "content/browser/media/capture/aura_window_capture_machine.h" | 12 #include "content/browser/media/capture/aura_window_capture_machine.h" |
| 13 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 void SetCaptureSource(AuraWindowCaptureMachine* machine, | 21 void SetCaptureSource(AuraWindowCaptureMachine* machine, |
| 21 const DesktopMediaID& source) { | 22 const DesktopMediaID& source) { |
| 22 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 23 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 23 | 24 |
| 24 aura::Window* window = DesktopMediaID::GetAuraWindowById(source); | 25 aura::Window* window = DesktopMediaID::GetAuraWindowById(source); |
| 25 if (window) | 26 if (window) { |
| 26 machine->SetWindow(window); | 27 machine->SetWindow(window); |
| 28 if (source.type == DesktopMediaID::TYPE_SCREEN) { |
| 29 if (source.audio_share) |
| 30 IncrementDesktopCaptureCounter(SCREEN_CAPTURER_CREATED_WITH_AUDIO); |
| 31 else |
| 32 IncrementDesktopCaptureCounter(SCREEN_CAPTURER_CREATED_WITHOUT_AUDIO); |
| 33 } |
| 34 } |
| 27 } | 35 } |
| 28 | 36 |
| 29 } // namespace | 37 } // namespace |
| 30 | 38 |
| 31 DesktopCaptureDeviceAura::DesktopCaptureDeviceAura( | 39 DesktopCaptureDeviceAura::DesktopCaptureDeviceAura( |
| 32 const DesktopMediaID& source) { | 40 const DesktopMediaID& source) { |
| 33 AuraWindowCaptureMachine* machine = new AuraWindowCaptureMachine(); | 41 AuraWindowCaptureMachine* machine = new AuraWindowCaptureMachine(); |
| 34 core_.reset(new media::ScreenCaptureDeviceCore(base::WrapUnique(machine))); | 42 core_.reset(new media::ScreenCaptureDeviceCore(base::WrapUnique(machine))); |
| 35 // |core_| owns |machine| and deletes it on UI thread so passing the raw | 43 // |core_| owns |machine| and deletes it on UI thread so passing the raw |
| 36 // pointer to the UI thread is safe here. | 44 // pointer to the UI thread is safe here. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 60 | 68 |
| 61 void DesktopCaptureDeviceAura::RequestRefreshFrame() { | 69 void DesktopCaptureDeviceAura::RequestRefreshFrame() { |
| 62 core_->RequestRefreshFrame(); | 70 core_->RequestRefreshFrame(); |
| 63 } | 71 } |
| 64 | 72 |
| 65 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 73 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
| 66 core_->StopAndDeAllocate(); | 74 core_->StopAndDeAllocate(); |
| 67 } | 75 } |
| 68 | 76 |
| 69 } // namespace content | 77 } // namespace content |
| OLD | NEW |