| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/media/desktop_capture_access_handler.h" | 5 #include "chrome/browser/media/desktop_capture_access_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 request.audio_type == content::MEDIA_DESKTOP_AUDIO_CAPTURE; | 359 request.audio_type == content::MEDIA_DESKTOP_AUDIO_CAPTURE; |
| 360 | 360 |
| 361 // This value shows for a given capture type, whether the system or our code | 361 // This value shows for a given capture type, whether the system or our code |
| 362 // can support audio sharing. Currently audio is only supported for screen and | 362 // can support audio sharing. Currently audio is only supported for screen and |
| 363 // tab/webcontents capture streams. | 363 // tab/webcontents capture streams. |
| 364 const bool audio_supported = | 364 const bool audio_supported = |
| 365 (media_id.type == content::DesktopMediaID::TYPE_SCREEN && | 365 (media_id.type == content::DesktopMediaID::TYPE_SCREEN && |
| 366 loopback_audio_supported) || | 366 loopback_audio_supported) || |
| 367 media_id.type == content::DesktopMediaID::TYPE_WEB_CONTENTS; | 367 media_id.type == content::DesktopMediaID::TYPE_WEB_CONTENTS; |
| 368 | 368 |
| 369 const bool has_flag = base::CommandLine::ForCurrentProcess()->HasSwitch( | 369 const bool check_audio_permission = |
| 370 extensions::switches::kEnableDesktopCaptureAudio); | 370 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 371 extensions::switches::kDisableDesktopCaptureAudio); |
| 371 const bool capture_audio = | 372 const bool capture_audio = |
| 372 (has_flag ? audio_permitted : true) && audio_requested && audio_supported; | 373 (check_audio_permission ? audio_permitted : true) && audio_requested && |
| 374 audio_supported; |
| 373 | 375 |
| 374 ui = GetDevicesForDesktopCapture(&devices, media_id, capture_audio, true, | 376 ui = GetDevicesForDesktopCapture(&devices, media_id, capture_audio, true, |
| 375 GetApplicationTitle(web_contents, extension), | 377 GetApplicationTitle(web_contents, extension), |
| 376 base::UTF8ToUTF16(original_extension_name)); | 378 base::UTF8ToUTF16(original_extension_name)); |
| 377 | 379 |
| 378 callback.Run(devices, content::MEDIA_DEVICE_OK, std::move(ui)); | 380 callback.Run(devices, content::MEDIA_DEVICE_OK, std::move(ui)); |
| 379 } | 381 } |
| 380 | 382 |
| 381 void DesktopCaptureAccessHandler::UpdateMediaRequestState( | 383 void DesktopCaptureAccessHandler::UpdateMediaRequestState( |
| 382 int render_process_id, | 384 int render_process_id, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 405 desktop_capture_sessions_.erase(it); | 407 desktop_capture_sessions_.erase(it); |
| 406 break; | 408 break; |
| 407 } | 409 } |
| 408 } | 410 } |
| 409 } | 411 } |
| 410 } | 412 } |
| 411 | 413 |
| 412 bool DesktopCaptureAccessHandler::IsCaptureInProgress() { | 414 bool DesktopCaptureAccessHandler::IsCaptureInProgress() { |
| 413 return desktop_capture_sessions_.size() > 0; | 415 return desktop_capture_sessions_.size() > 0; |
| 414 } | 416 } |
| OLD | NEW |