Skip to content

Commit

Permalink
Bring Audio Share and Tab Share Default On
Browse files Browse the repository at this point in the history
Desktop share with audio and Desktop share using a chrome tab
as source are two new functionality developed.

Previously the functionalities are behind the flags
--enable-audio-support-for-desktop-share
--enable-tab-for-desktop-share

This CL changes the flags to be disable flags, namely:
--disable-audio-support-for-desktop-share
--disable-tab-for-desktop-share

In another word, we bring the functionalities on by default.

BUG=597539,597540

Review URL: https://codereview.chromium.org/1838623002

Cr-Commit-Position: refs/heads/master@{#384656}
  • Loading branch information
qiangchen authored and Commit bot committed Apr 1, 2016
1 parent 7a9e836 commit 85ce71f
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 38 deletions.
16 changes: 8 additions & 8 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -6002,17 +6002,17 @@ Keep your key file in a safe place. You will need it to create new versions of y
This is to be used in conjunction with the enable-navigation-tracing flag.
Please select the label that best describes the recorded traces. This will choose the destination the traces are uploaded to. If you are not sure, select other. If left empty, no traces will be uploaded.
</message>
<message name="IDS_FLAG_ENABLE_AUDIO_FOR_DESKTOP_SHARE" desc="Title for the flag to enable Audio Sharing.">
Enable Audio For Desktop Share
<message name="IDS_FLAG_DISABLE_AUDIO_FOR_DESKTOP_SHARE" desc="Title for the flag to disable Audio Sharing.">
Disable Audio For Desktop Share
</message>
<message name="IDS_FLAG_ENABLE_AUDIO_FOR_DESKTOP_SHARE_DESCRIPTION" desc="Description for the flag to enable Audio Sharing.">
With this flag on, desktop share picker window will let the user to choose whether to share audio.
<message name="IDS_FLAG_DISABLE_AUDIO_FOR_DESKTOP_SHARE_DESCRIPTION" desc="Description for the flag to disable Audio Sharing.">
With this flag on, desktop share picker window will not let the user choose whether to share audio.
</message>
<message name="IDS_FLAG_ENABLE_TAB_FOR_DESKTOP_SHARE" desc="Title for the flag to enable tab for desktop share.">
Enable tab For Desktop Share.
<message name="IDS_FLAG_DISABLE_TAB_FOR_DESKTOP_SHARE" desc="Title for the flag to disable tab for desktop share.">
Desktop Share with tab source
</message>
<message name="IDS_FLAG_ENABLE_TAB_FOR_DESKTOP_SHARE_DESCRIPTION" desc="Description for the flag to enable tab for desktop share.">
Enables user to chose a tab for desktop share.
<message name="IDS_FLAG_DISABLE_TAB_FOR_DESKTOP_SHARE_DESCRIPTION" desc="Description for the flag to disable tab for desktop share.">
This flag controls whether users can choose a tab for desktop share.
</message>
<message name="IDS_TRACE_UPLOAD_URL_CHOICE_OTHER">
Other
Expand Down
16 changes: 9 additions & 7 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1775,14 +1775,16 @@ const FeatureEntry kFeatureEntries[] = {
{"enable-scroll-anchoring", IDS_FLAGS_ENABLE_SCROLL_ANCHORING_NAME,
IDS_FLAGS_ENABLE_SCROLL_ANCHORING_DESCRIPTION, kOsAll,
FEATURE_VALUE_TYPE(features::kScrollAnchoring)},
{"enable-audio-support-for-desktop-share",
IDS_FLAG_ENABLE_AUDIO_FOR_DESKTOP_SHARE,
IDS_FLAG_ENABLE_AUDIO_FOR_DESKTOP_SHARE_DESCRIPTION, kOsAll,
SINGLE_VALUE_TYPE(switches::kEnableAudioSupportForDesktopShare)},
{"disable-audio-support-for-desktop-share",
IDS_FLAG_DISABLE_AUDIO_FOR_DESKTOP_SHARE,
IDS_FLAG_DISABLE_AUDIO_FOR_DESKTOP_SHARE_DESCRIPTION, kOsAll,
SINGLE_VALUE_TYPE(switches::kDisableAudioSupportForDesktopShare)},
#if defined(ENABLE_EXTENSIONS)
{"enable-tab-for-desktop-share", IDS_FLAG_ENABLE_TAB_FOR_DESKTOP_SHARE,
IDS_FLAG_ENABLE_TAB_FOR_DESKTOP_SHARE_DESCRIPTION, kOsAll,
SINGLE_VALUE_TYPE(extensions::switches::kEnableTabForDesktopShare)},
{"tab-for-desktop-share", IDS_FLAG_DISABLE_TAB_FOR_DESKTOP_SHARE,
IDS_FLAG_DISABLE_TAB_FOR_DESKTOP_SHARE_DESCRIPTION, kOsAll,
ENABLE_DISABLE_VALUE_TYPE(
extensions::switches::kEnableTabForDesktopShare,
extensions::switches::kDisableTabForDesktopShare)},
#endif
#if defined(OS_ANDROID)
{"enable-ntp-snippets", IDS_FLAGS_ENABLE_NTP_SNIPPETS_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,9 @@ class DesktopCaptureApiTest : public ExtensionApiTest {
#define MAYBE_ChooseDesktopMedia ChooseDesktopMedia
#endif
IN_PROC_BROWSER_TEST_F(DesktopCaptureApiTest, MAYBE_ChooseDesktopMedia) {
// For tab and audio share, we need to turn on the flag, because the
// functionality is currently behind the flags.
// For tabshare, we need to turn on the flag.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
extensions::switches::kEnableTabForDesktopShare);
base::CommandLine::ForCurrentProcess()->AppendSwitch(
extensions::switches::kEnableDesktopCaptureAudio);

// Each element in the following array corresponds to one test in
// chrome/test/data/extensions/api_test/desktop_capture/test.js .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "chrome/browser/media/native_desktop_media_list.h"
#include "chrome/browser/media/tab_desktop_media_list.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/common/channel_info.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
Expand Down Expand Up @@ -100,13 +102,19 @@ bool DesktopCaptureChooseDesktopMediaFunctionBase::Execute(
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
extensions::switches::kEnableTabForDesktopShare)) {
show_tabs = true;
} else if (base::CommandLine::ForCurrentProcess()->HasSwitch(
extensions::switches::kDisableTabForDesktopShare)) {
show_tabs = false;
} else {
const version_info::Channel channel = chrome::GetChannel();
show_tabs = (channel != version_info::Channel::STABLE);
}
break;

case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_AUDIO:
bool has_flag = base::CommandLine::ForCurrentProcess()->HasSwitch(
extensions::switches::kEnableDesktopCaptureAudio);
request_audio = has_flag;
extensions::switches::kDisableDesktopCaptureAudio);
request_audio = !has_flag;
break;
}
}
Expand Down
8 changes: 5 additions & 3 deletions chrome/browser/media/desktop_capture_access_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,12 @@ void DesktopCaptureAccessHandler::HandleRequest(
loopback_audio_supported) ||
media_id.type == content::DesktopMediaID::TYPE_WEB_CONTENTS;

const bool has_flag = base::CommandLine::ForCurrentProcess()->HasSwitch(
extensions::switches::kEnableDesktopCaptureAudio);
const bool check_audio_permission =
!base::CommandLine::ForCurrentProcess()->HasSwitch(
extensions::switches::kDisableDesktopCaptureAudio);
const bool capture_audio =
(has_flag ? audio_permitted : true) && audio_requested && audio_supported;
(check_audio_permission ? audio_permitted : true) && audio_requested &&
audio_supported;

ui = GetDevicesForDesktopCapture(&devices, media_id, capture_audio, true,
GetApplicationTitle(web_contents, extension),
Expand Down
4 changes: 2 additions & 2 deletions content/browser/renderer_host/media/media_stream_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ void ParseStreamType(const StreamControls& controls,
*audio_type = MEDIA_NO_SERVICE;
*video_type = MEDIA_NO_SERVICE;
const bool audio_support_flag_for_desktop_share =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableAudioSupportForDesktopShare);
!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableAudioSupportForDesktopShare);
if (controls.audio.requested) {
if (!controls.audio.stream_source.empty()) {
// This is tab or screen capture.
Expand Down
16 changes: 10 additions & 6 deletions content/public/browser/desktop_media_id.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,25 @@ aura::Window* DesktopMediaID::GetAuraWindowById(const DesktopMediaID& id) {

bool DesktopMediaID::operator<(const DesktopMediaID& other) const {
#if defined(USE_AURA)
return std::tie(type, id, aura_id, web_contents_id) <
std::tie(other.type, other.id, other.aura_id, other.web_contents_id);
return std::tie(type, id, aura_id, web_contents_id, audio_share) <
std::tie(other.type, other.id, other.aura_id, other.web_contents_id,
other.audio_share);
#else
return std::tie(type, id, web_contents_id) <
std::tie(other.type, other.id, other.web_contents_id);
return std::tie(type, id, web_contents_id, audio_share) <
std::tie(other.type, other.id, other.web_contents_id,
other.audio_share);
#endif
}

bool DesktopMediaID::operator==(const DesktopMediaID& other) const {
#if defined(USE_AURA)
return type == other.type && id == other.id && aura_id == other.aura_id &&
web_contents_id == other.web_contents_id;
web_contents_id == other.web_contents_id &&
audio_share == other.audio_share;
#else
return type == other.type && id == other.id &&
web_contents_id == other.web_contents_id;
web_contents_id == other.web_contents_id &&
audio_share == other.audio_share;
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions content/public/common/content_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -970,8 +970,8 @@ const char kEnableAggressiveDOMStorageFlushing[] =
"enable-aggressive-domstorage-flushing";

// Enable audio for desktop share.
const char kEnableAudioSupportForDesktopShare[] =
"enable-audio-support-for-desktop-share";
const char kDisableAudioSupportForDesktopShare[] =
"disable-audio-support-for-desktop-share";

#if defined(OS_CHROMEOS)
// Disables panel fitting (used for mirror mode).
Expand Down
2 changes: 1 addition & 1 deletion content/public/common/content_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ CONTENT_EXPORT extern const char kDisableAccelerated2dCanvas[];
CONTENT_EXPORT extern const char kDisableAcceleratedJpegDecoding[];
CONTENT_EXPORT extern const char kDisableAcceleratedMjpegDecode[];
CONTENT_EXPORT extern const char kDisableAcceleratedVideoDecode[];
CONTENT_EXPORT extern const char kDisableAudioSupportForDesktopShare[];
extern const char kDisableBackingStoreLimit[];
CONTENT_EXPORT extern const char
kDisableBackgroundingOccludedWindowsForTesting[];
Expand Down Expand Up @@ -103,7 +104,6 @@ CONTENT_EXPORT extern const char kDomAutomationController[];
CONTENT_EXPORT extern const char kDownloadProcess[];
extern const char kEnable2dCanvasClipAntialiasing[];
CONTENT_EXPORT extern const char kEnableAggressiveDOMStorageFlushing[];
CONTENT_EXPORT extern const char kEnableAudioSupportForDesktopShare[];
CONTENT_EXPORT extern const char kEnablePreferCompositingToLCDText[];
CONTENT_EXPORT extern const char kEnableBlinkFeatures[];
CONTENT_EXPORT extern const char kEnableBrowserSideNavigation[];
Expand Down
5 changes: 3 additions & 2 deletions extensions/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const char kEnableAppWindowControls[] = "enable-app-window-controls";
// Enable BLE Advertisiing in apps.
const char kEnableBLEAdvertising[] = "enable-ble-advertising-in-apps";

const char kEnableDesktopCaptureAudio[] =
"enable-audio-support-for-desktop-share";
const char kDisableDesktopCaptureAudio[] =
"disable-audio-support-for-desktop-share";

// Hack so that feature switch can work with about_flags. See
// kEnableScriptsRequireAction.
Expand All @@ -55,6 +55,7 @@ const char kEnableMojoSerialService[] = "enable-mojo-serial-service";
const char kEnableOverrideBookmarksUI[] = "enable-override-bookmarks-ui";

// Enables tab for desktop sharing.
const char kDisableTabForDesktopShare[] = "disable-tab-for-desktop-share";
const char kEnableTabForDesktopShare[] = "enable-tab-for-desktop-share";

// Allows the ErrorConsole to collect runtime and manifest errors, and display
Expand Down
3 changes: 2 additions & 1 deletion extensions/common/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ namespace switches {

extern const char kAllowHTTPBackgroundPage[];
extern const char kAllowLegacyExtensionManifests[];
extern const char kDisableDesktopCaptureAudio[];
extern const char kDisableTabForDesktopShare[];
extern const char kEmbeddedExtensionOptions[];
extern const char kEnableAppsShowOnFirstPaint[];
extern const char kEnableAppWindowControls[];
extern const char kEnableDesktopCaptureAudio[];
extern const char kEnableEmbeddedExtensionOptions[];
extern const char kEnableExperimentalExtensionApis[];
extern const char kEnableExtensionActionRedesign[];
Expand Down
2 changes: 2 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74393,6 +74393,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="730024226" label="enable-out-of-process-pdf"/>
<int value="732703958" label="enable-gesture-tap-highlight"/>
<int value="752194066" label="enable-app-window-cycling"/>
<int value="752939691" label="disable-tab-for-desktop-share"/>
<int value="773919225" label="disable-office-editing-component-extension"/>
<int value="779086132" label="enable-data-reduction-proxy-alt"/>
<int value="782167080" label="enable-new-qp-input-view"/>
Expand Down Expand Up @@ -74562,6 +74563,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="1861251313"
label="enable-message-center-always-scroll-up-upon-notification-removal"/>
<int value="1862207743" label="enable-android-spellchecker"/>
<int value="1865068568" label="disable-audio-support-for-desktop-share"/>
<int value="1865799183" label="javascript-harmony"/>
<int value="1881036528" label="disable-multilingual-spellchecker"/>
<int value="1881174782" label="disable-brotli"/>
Expand Down

0 comments on commit 85ce71f

Please sign in to comment.