Commit 9742c6fc authored by Himanshu Jaju's avatar Himanshu Jaju Committed by Commit Bot

Add peer connection capability for Sharing Device.

Peer connection sharing capability is added to SharingSpecifics which
determines if a remote peer is capable of receiving an incoming request
to start a webrtc connection. This helps us to filter out M80+ devices
from older devices and reduce failure rates.

Bug: 1022288
Change-Id: If23506d07be0532a3e04a30fbd97d28fddd4d9c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903348Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarRichard Knoll <knollr@chromium.org>
Commit-Queue: Himanshu Jaju <himanshujaju@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713383}
parent 24a75c57
......@@ -18,6 +18,7 @@
#include "chrome/browser/sharing/sharing_sync_preference.h"
#include "chrome/browser/sharing/sms/sms_flags.h"
#include "chrome/browser/sharing/vapid_key_manager.h"
#include "chrome/browser/sharing/webrtc/webrtc_flags.h"
#include "chrome/common/pref_names.h"
#include "components/gcm_driver/crypto/p256_key_util.h"
#include "components/gcm_driver/instance_id/instance_id_driver.h"
......@@ -204,6 +205,8 @@ SharingDeviceRegistration::GetEnabledFeatures() const {
enabled_features.insert(SharingSpecificFields::SMS_FETCHER);
if (IsRemoteCopySupported())
enabled_features.insert(SharingSpecificFields::REMOTE_COPY);
if (IsPeerConnectionSupported())
enabled_features.insert(SharingSpecificFields::PEER_CONNECTION);
return enabled_features;
}
......@@ -245,6 +248,10 @@ bool SharingDeviceRegistration::IsRemoteCopySupported() const {
return false;
}
bool SharingDeviceRegistration::IsPeerConnectionSupported() const {
return base::FeatureList::IsEnabled(kSharingPeerConnectionReceiver);
}
void SharingDeviceRegistration::SetEnabledFeaturesForTesting(
std::set<SharingSpecificFields::EnabledFeatures> enabled_features) {
enabled_features_testing_value_ = std::move(enabled_features);
......
......@@ -57,6 +57,9 @@ class SharingDeviceRegistration {
// Returns if device can handle receiving of remote copy contents.
virtual bool IsRemoteCopySupported() const;
// Returns if device can handle an incoming webrtc peer connection request.
bool IsPeerConnectionSupported() const;
// For testing
void SetEnabledFeaturesForTesting(
std::set<sync_pb::SharingSpecificFields_EnabledFeatures>
......
......@@ -97,6 +97,7 @@ message SharingSpecificFields {
SHARED_CLIPBOARD = 2;
SMS_FETCHER = 3;
REMOTE_COPY = 4;
PEER_CONNECTION = 5;
}
// A list of enabled Sharing features.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment