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

Unified Diff: components/copresence/handlers/directive_handler_impl.cc

Issue 824593003: Revert of Adding CopresenceState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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: components/copresence/handlers/directive_handler_impl.cc
diff --git a/components/copresence/handlers/directive_handler_impl.cc b/components/copresence/handlers/directive_handler_impl.cc
index d2f8aa2d1d45efcb51f8410d001a02f01b3084b6..26ce733ac0aca3df3cdb49a9b263c85cb02541f2 100644
--- a/components/copresence/handlers/directive_handler_impl.cc
+++ b/components/copresence/handlers/directive_handler_impl.cc
@@ -19,19 +19,11 @@
namespace copresence {
-// Public functions.
+// Public functions
DirectiveHandlerImpl::DirectiveHandlerImpl(
- const DirectivesCallback& update_directives_callback)
- : DirectiveHandlerImpl(update_directives_callback,
- make_scoped_ptr(new AudioDirectiveHandlerImpl(
- update_directives_callback))) {}
-
-DirectiveHandlerImpl::DirectiveHandlerImpl(
- const DirectivesCallback& update_directives_callback,
scoped_ptr<AudioDirectiveHandler> audio_handler)
- : audio_handler_(audio_handler.Pass()),
- is_started_(false) {}
+ : audio_handler_(audio_handler.Pass()), is_started_(false) {}
DirectiveHandlerImpl::~DirectiveHandlerImpl() {}
@@ -103,18 +95,21 @@
return is_started_ ? audio_handler_->IsPlayingTokenHeard(type) : false;
}
-
-// Private functions.
+// Private functions
void DirectiveHandlerImpl::StartDirective(const std::string& op_id,
const Directive& directive) {
DCHECK(is_started_);
- DLOG_IF(WARNING, directive.delay_millis() > 0)
- << "Ignoring " << directive.delay_millis() << " delay for directive";
- const TokenMedium& medium = directive.token_instruction().medium();
- DCHECK(medium == AUDIO_ULTRASOUND_PASSBAND || medium == AUDIO_AUDIBLE_DTMF)
- << "Received directive for unimplemented medium " << medium;
- audio_handler_->AddInstruction(directive, op_id);
+ const TokenInstruction& ti = directive.token_instruction();
+ if (ti.medium() == AUDIO_ULTRASOUND_PASSBAND ||
+ ti.medium() == AUDIO_AUDIBLE_DTMF) {
+ audio_handler_->AddInstruction(
+ ti, op_id, base::TimeDelta::FromMilliseconds(directive.ttl_millis()));
+ } else {
+ // We should only get audio directives.
+ NOTREACHED() << "Received directive for unimplemented medium "
+ << ti.medium();
+ }
}
} // namespace copresence
« no previous file with comments | « components/copresence/handlers/directive_handler_impl.h ('k') | components/copresence/handlers/directive_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698