Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: chrome/browser/media/desktop_capture_access_handler.cc

Issue 1838623002: Bring Audio Share and Tab Share Default On (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Three value flag for Tab Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698