| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ | 5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ |
| 6 #define COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ | 6 #define COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/copresence/public/copresence_constants.h" | 11 #include "components/copresence/public/copresence_constants.h" |
| 12 | 12 |
| 13 namespace copresence { | 13 namespace copresence { |
| 14 | 14 |
| 15 class Directive; | 15 class Directive; |
| 16 class WhispernetClient; | 16 class WhispernetClient; |
| 17 | 17 |
| 18 // The directive handler manages transmit and receive directives. | 18 // The directive handler manages transmit and receive directives. |
| 19 class DirectiveHandler { | 19 class DirectiveHandler { |
| 20 public: | 20 public: |
| 21 DirectiveHandler() {} | 21 DirectiveHandler() {} |
| 22 virtual ~DirectiveHandler() {} | 22 virtual ~DirectiveHandler() {} |
| 23 | 23 |
| 24 // Starts processing directives with the provided Whispernet client. | 24 // Starts processing directives with the provided Whispernet client. |
| 25 // Directives will be queued until this function is called. | 25 // Directives will be queued until this function is called. |
| 26 // |whispernet_client| is owned by the caller and must outlive the | 26 // |whispernet_client| is owned by the caller and must outlive the |
| 27 // DirectiveHandler. | 27 // DirectiveHandler. |
| 28 // |tokens_cb| is called for all audio tokens found in recorded audio. | 28 // |tokens_cb| is called for all audio tokens found in recorded audio. |
| 29 // TODO(ckehoe): This is no longer needed. Merge into the constructor. |
| 29 virtual void Start(WhispernetClient* whispernet_client, | 30 virtual void Start(WhispernetClient* whispernet_client, |
| 30 const TokensCallback& tokens_cb) = 0; | 31 const TokensCallback& tokens_cb) = 0; |
| 31 | 32 |
| 32 // Adds a directive to handle. | 33 // Adds a directive to handle. |
| 33 virtual void AddDirective(const Directive& directive) = 0; | 34 virtual void AddDirective(const Directive& directive) = 0; |
| 34 | 35 |
| 35 // Removes any directives associated with the given operation id. | 36 // Removes any directives associated with the given operation id. |
| 36 virtual void RemoveDirectives(const std::string& op_id) = 0; | 37 virtual void RemoveDirectives(const std::string& op_id) = 0; |
| 37 | 38 |
| 38 // TODO(rkc): Too many audio specific functions here. | 39 // TODO(rkc): Too many audio specific functions here. |
| 39 // Find a better way to get this information to the copresence manager. | 40 // Find a better way to get this information to the copresence manager. |
| 40 virtual const std::string GetCurrentAudioToken(AudioType type) const = 0; | 41 virtual const std::string GetCurrentAudioToken(AudioType type) const = 0; |
| 41 virtual bool IsAudioTokenHeard(AudioType type) const = 0; | 42 virtual bool IsAudioTokenHeard(AudioType type) const = 0; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(DirectiveHandler); | 45 DISALLOW_COPY_AND_ASSIGN(DirectiveHandler); |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace copresence | 48 } // namespace copresence |
| 48 | 49 |
| 49 #endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ | 50 #endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ |
| OLD | NEW |