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

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

Issue 460743004: Improve audible token detection. (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') | components/copresence/rpc/rpc_handler_unittest.cc » ('j') | 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 c6c3d3c563174cb80a78b0d0eadef2803b3b8a48..2ca127ea7955fca154b1e9750389a24db0e5695b 100644
--- a/components/copresence/rpc/rpc_handler.cc
+++ b/components/copresence/rpc/rpc_handler.cc
@@ -262,14 +262,12 @@ void RpcHandler::SendReportRequest(scoped_ptr<ReportRequest> request,
status_callback));
}
-void RpcHandler::ReportTokens(TokenMedium medium,
- const std::vector<std::string>& tokens) {
- DCHECK_EQ(medium, AUDIO_ULTRASOUND_PASSBAND);
+void RpcHandler::ReportTokens(const std::vector<FullToken>& tokens) {
DCHECK(!tokens.empty());
scoped_ptr<ReportRequest> request(new ReportRequest);
for (size_t i = 0; i < tokens.size(); ++i) {
- const std::string& token = ToUrlSafe(tokens[i]);
+ const std::string& token = ToUrlSafe(tokens[i].token);
if (invalid_audio_token_cache_.HasKey(token))
continue;
@@ -280,7 +278,8 @@ void RpcHandler::ReportTokens(TokenMedium medium,
token_observation->set_token_id(token);
TokenSignals* signals = token_observation->add_signals();
- signals->set_medium(medium);
+ signals->set_medium(tokens[i].audible ? AUDIO_AUDIBLE_DTMF
+ : AUDIO_ULTRASOUND_PASSBAND);
signals->set_observed_time_millis(base::Time::Now().ToJsTime());
}
SendReportRequest(request.Pass());
@@ -300,8 +299,7 @@ void RpcHandler::ConnectToWhispernet() {
whispernet_client->RegisterTokensCallback(
base::Bind(&RpcHandler::ReportTokens,
// On destruction, this callback will be disconnected.
- base::Unretained(this),
- AUDIO_ULTRASOUND_PASSBAND));
+ base::Unretained(this)));
}
// Private methods
« no previous file with comments | « components/copresence/rpc/rpc_handler.h ('k') | components/copresence/rpc/rpc_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698