Chromium Code Reviews| Index: components/copresence/handlers/directive_handler.h |
| diff --git a/components/copresence/handlers/directive_handler.h b/components/copresence/handlers/directive_handler.h |
| index 75761286d13eb6330ebcf0f06ad11b4083177ab7..73feaf21765e1bfaf9c274821a5e032519a24d39 100644 |
| --- a/components/copresence/handlers/directive_handler.h |
| +++ b/components/copresence/handlers/directive_handler.h |
| @@ -11,12 +11,13 @@ |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| -#include "components/copresence/public/whispernet_client.h" |
| +#include "components/copresence/public/copresence_constants.h" |
| namespace copresence { |
| class AudioDirectiveHandler; |
| class Directive; |
| +class WhispernetClient; |
| // The directive handler manages transmit and receive directives. |
| // TODO(ckehoe): Add tests for this class. |
| @@ -28,9 +29,11 @@ class DirectiveHandler { |
| // Starts processing directives with the provided Whispernet client. |
| // Directives will be queued until this function is called. |
| - // |whispernet_client| is owned by the caller |
| - // and must outlive the DirectiveHandler. |
| - virtual void Start(WhispernetClient* whispernet_client); |
| + // |whispernet_client| is owned by the caller and must outlive the |
| + // DirectiveHandler. |
| + // |tokens_cb| is called for all audio tokens found in recorded audio. |
| + virtual void Start(WhispernetClient* whispernet_client, |
| + const TokensCallback& tokens_cb); |
| // Adds a directive to handle. |
| virtual void AddDirective(const Directive& directive); |
| @@ -38,24 +41,19 @@ class DirectiveHandler { |
| // Removes any directives associated with the given operation id. |
| virtual void RemoveDirectives(const std::string& op_id); |
| + // TODO(rkc): Too many audio specific functions here, find a better way to |
|
Charlie
2014/11/06 17:28:23
CopresenceManagerImpl::CheckForAudio() probably be
rkc
2014/11/06 19:58:24
It doesn't solve the problem. If we put it in the
Charlie
2014/11/06 21:53:14
I don't actually think the AudioManager should be
rkc
2014/11/06 21:58:34
We can discuss this offline if you wish. I think t
|
| + // get this information to the copresence manager. |
| virtual const std::string GetCurrentAudioToken(AudioType type) const; |
| + virtual bool IsAudioTokenHeard(AudioType type) const; |
| private: |
| // Starts actually running a directive. |
| void StartDirective(const std::string& op_id, const Directive& directive); |
| - // Forwards the request to encode a token to whispernet, |
| - // and instructs it to call samples_callback when encoding is complete. |
| - void EncodeToken( |
| - const std::string& token, |
| - AudioType type, |
| - const WhispernetClient::SamplesCallback& samples_callback); |
| - |
| scoped_ptr<AudioDirectiveHandler> audio_handler_; |
| std::map<std::string, std::vector<Directive>> pending_directives_; |
| - // Belongs to the caller. |
| - WhispernetClient* whispernet_client_; |
| + bool is_started_; |
| DISALLOW_COPY_AND_ASSIGN(DirectiveHandler); |
| }; |