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

Unified Diff: components/copresence/rpc/rpc_handler.cc

Issue 453793002: Add audible support to the copresence API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/copresence/rpc/rpc_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/copresence/rpc/rpc_handler.cc
diff --git a/components/copresence/rpc/rpc_handler.cc b/components/copresence/rpc/rpc_handler.cc
index eb84c0d937f0c628d6eae003b6ff0b2936e04dc2..c6c3d3c563174cb80a78b0d0eadef2803b3b8a48 100644
--- a/components/copresence/rpc/rpc_handler.cc
+++ b/components/copresence/rpc/rpc_handler.cc
@@ -140,6 +140,24 @@ BroadcastScanConfiguration ExtractTokenExchangeStrategy(
return BROADCAST_AND_SCAN;
}
+// TODO(rkc): Fix this hack once the server supports setting strategies per
+// operation.
+bool ExtractIsAudibleStrategy(const ReportRequest& request) {
+ if (request.has_manage_messages_request()) {
+ const RepeatedPtrField<PublishedMessage> messages =
+ request.manage_messages_request().message_to_publish();
+ for (int i = 0; i < messages.size(); ++i) {
+ const PublishedMessage& msg = messages.Get(i);
+ if (msg.has_token_exchange_strategy() &&
+ msg.token_exchange_strategy().has_use_audible() &&
+ msg.token_exchange_strategy().use_audible()) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
scoped_ptr<DeviceState> GetDeviceCapabilities(const ReportRequest& request) {
scoped_ptr<DeviceState> state(new DeviceState);
@@ -148,6 +166,8 @@ scoped_ptr<DeviceState> GetDeviceCapabilities(const ReportRequest& request) {
TokenTechnology* token_technology =
state->mutable_capabilities()->add_token_technology();
token_technology->set_medium(AUDIO_ULTRASOUND_PASSBAND);
+ if (ExtractIsAudibleStrategy(request))
+ token_technology->set_medium(AUDIO_AUDIBLE_DTMF);
BroadcastScanConfiguration config =
ExtractTokenExchangeStrategy(request);
@@ -479,11 +499,12 @@ void RpcHandler::SendHttpPost(net::URLRequestContextGetter* url_context_getter,
void RpcHandler::AudioDirectiveListToWhispernetConnector(
const std::string& token,
+ bool audible,
const WhispernetClient::SamplesCallback& samples_callback) {
WhispernetClient* whispernet_client = delegate_->GetWhispernetClient();
if (whispernet_client) {
whispernet_client->RegisterSamplesCallback(samples_callback);
- whispernet_client->EncodeToken(token, false);
+ whispernet_client->EncodeToken(token, audible);
}
}
« no previous file with comments | « components/copresence/rpc/rpc_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698