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

Unified Diff: chrome/browser/copresence/chrome_whispernet_client.cc

Issue 637223011: Redesign the copresence audio handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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
Index: chrome/browser/copresence/chrome_whispernet_client.cc
diff --git a/chrome/browser/copresence/chrome_whispernet_client.cc b/chrome/browser/copresence/chrome_whispernet_client.cc
index 6cffe0383343a1b5597b2913cc5b806369d5e83c..35b22f782eda7ee64d826f1b72f8a6d7e96c1fb2 100644
--- a/chrome/browser/copresence/chrome_whispernet_client.cc
+++ b/chrome/browser/copresence/chrome_whispernet_client.cc
@@ -63,7 +63,7 @@ void ChromeWhispernetClient::Shutdown() {
// Fire an event to request a token encode.
void ChromeWhispernetClient::EncodeToken(const std::string& token,
- bool audible) {
+ copresence::AudioType type) {
DCHECK(extension_loaded_);
DCHECK(browser_context_);
DCHECK(extensions::EventRouter::Get(browser_context_));
@@ -71,7 +71,7 @@ void ChromeWhispernetClient::EncodeToken(const std::string& token,
scoped_ptr<extensions::Event> event(new extensions::Event(
extensions::api::copresence_private::OnEncodeTokenRequest::kEventName,
extensions::api::copresence_private::OnEncodeTokenRequest::Create(
- token, audible),
+ token, type == copresence::AUDIBLE),
browser_context_));
extensions::EventRouter::Get(browser_context_)
@@ -79,15 +79,22 @@ void ChromeWhispernetClient::EncodeToken(const std::string& token,
}
// Fire an event to request a decode for the given samples.
-void ChromeWhispernetClient::DecodeSamples(const std::string& samples) {
+void ChromeWhispernetClient::DecodeSamples(copresence::AudioType type,
+ const std::string& samples) {
DCHECK(extension_loaded_);
DCHECK(browser_context_);
DCHECK(extensions::EventRouter::Get(browser_context_));
+ extensions::api::copresence_private::DecodeSamplesParameters request_type;
+ request_type.decode_audible =
+ type == copresence::AUDIBLE || type == copresence::BOTH;
+ request_type.decode_inaudible =
+ type == copresence::INAUDIBLE || type == copresence::BOTH;
+
scoped_ptr<extensions::Event> event(new extensions::Event(
extensions::api::copresence_private::OnDecodeSamplesRequest::kEventName,
extensions::api::copresence_private::OnDecodeSamplesRequest::Create(
- samples),
+ samples, request_type),
browser_context_));
extensions::EventRouter::Get(browser_context_)

Powered by Google App Engine
This is Rietveld 408576698