| 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/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "components/copresence/handlers/audio/audio_directive_handler.h" | 13 #include "components/copresence/handlers/audio/audio_directive_handler.h" |
| 14 #include "components/copresence/mediums/audio/audio_recorder.h" | 14 #include "components/copresence/mediums/audio/audio_manager.h" |
| 15 | 15 |
| 16 namespace copresence { | 16 namespace copresence { |
| 17 | 17 |
| 18 class Directive; | 18 class Directive; |
| 19 | 19 |
| 20 // The directive handler manages transmit and receive directives | 20 // The directive handler manages transmit and receive directives |
| 21 // given to it by the manager. | 21 // given to it by the manager. |
| 22 class DirectiveHandler { | 22 class DirectiveHandler { |
| 23 public: | 23 public: |
| 24 DirectiveHandler(); | 24 DirectiveHandler(); |
| 25 virtual ~DirectiveHandler(); | 25 virtual ~DirectiveHandler(); |
| 26 | 26 |
| 27 // Initialize the |audio_handler_| with the appropriate callbacks. | 27 // Initialize the |audio_handler_| with the appropriate callbacks. |
| 28 // This function must be called before any others. | 28 // This function must be called before any others. |
| 29 // TODO(ckehoe): Instead of this, use a static Create() method | 29 // TODO(ckehoe): Instead of this, use a static Create() method |
| 30 // and make the constructor private. | 30 // and make the constructor private. |
| 31 virtual void Initialize( | 31 virtual void Initialize(const AudioManager::DecodeSamplesCallback& decode_cb, |
| 32 const AudioRecorder::DecodeSamplesCallback& decode_cb, | 32 const AudioManager::EncodeTokenCallback& encode_cb); |
| 33 const AudioDirectiveHandler::EncodeTokenCallback& encode_cb); | |
| 34 | 33 |
| 35 // Adds a directive to handle. | 34 // Adds a directive to handle. |
| 36 virtual void AddDirective(const copresence::Directive& directive); | 35 virtual void AddDirective(const copresence::Directive& directive); |
| 37 // Removes any directives associated with the given operation id. | 36 // Removes any directives associated with the given operation id. |
| 38 virtual void RemoveDirectives(const std::string& op_id); | 37 virtual void RemoveDirectives(const std::string& op_id); |
| 39 | 38 |
| 40 const std::string& CurrentAudibleToken() const; | 39 const std::string& GetCurrentAudioToken(AudioType type) const; |
| 41 const std::string& CurrentInaudibleToken() const; | |
| 42 | 40 |
| 43 private: | 41 private: |
| 44 scoped_ptr<AudioDirectiveHandler> audio_handler_; | 42 scoped_ptr<AudioDirectiveHandler> audio_handler_; |
| 45 | 43 |
| 46 DISALLOW_COPY_AND_ASSIGN(DirectiveHandler); | 44 DISALLOW_COPY_AND_ASSIGN(DirectiveHandler); |
| 47 }; | 45 }; |
| 48 | 46 |
| 49 } // namespace copresence | 47 } // namespace copresence |
| 50 | 48 |
| 51 #endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ | 49 #endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ |
| OLD | NEW |