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_AUDIO_AUDIO_DIRECTIVE_HANDLER_H_ | 5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_HANDLER_H_ |
6 #define COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_HANDLER_H_ | 6 #define COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/copresence/mediums/audio/audio_manager.h" | 10 #include "components/copresence/mediums/audio/audio_manager.h" |
11 #include "components/copresence/public/copresence_constants.h" | 11 #include "components/copresence/public/copresence_constants.h" |
12 | 12 |
13 namespace base { | |
14 class TimeDelta; | |
15 } | |
16 | |
17 namespace copresence { | 13 namespace copresence { |
18 | 14 |
19 class TokenInstruction; | 15 class Directive; |
20 class WhispernetClient; | 16 class WhispernetClient; |
21 | 17 |
22 // The AudioDirectiveHandler handles audio transmit and receive instructions. | 18 // The AudioDirectiveHandler handles audio transmit and receive instructions. |
23 class AudioDirectiveHandler { | 19 class AudioDirectiveHandler { |
24 public: | 20 public: |
25 virtual ~AudioDirectiveHandler() {} | 21 virtual ~AudioDirectiveHandler() {} |
26 | 22 |
27 // Do not use this class before calling this. | 23 // Do not use this class before calling this. |
28 virtual void Initialize(WhispernetClient* whispernet_client, | 24 virtual void Initialize(WhispernetClient* whispernet_client, |
29 const TokensCallback& tokens_cb) = 0; | 25 const TokensCallback& tokens_cb) = 0; |
30 | 26 |
31 // Adds an instruction to our handler. The instruction will execute and be | 27 // Adds an instruction to our handler. The instruction will execute and be |
32 // removed after the ttl expires. | 28 // removed after the ttl expires. |
33 virtual void AddInstruction(const TokenInstruction& instruction, | 29 virtual void AddInstruction(const Directive& directive, |
34 const std::string& op_id, | 30 const std::string& op_id) = 0; |
35 base::TimeDelta ttl) = 0; | |
36 | 31 |
37 // Removes all instructions associated with this operation id. | 32 // Removes all instructions associated with this operation id. |
38 virtual void RemoveInstructions(const std::string& op_id) = 0; | 33 virtual void RemoveInstructions(const std::string& op_id) = 0; |
39 | 34 |
40 // Returns the currently playing token. | 35 // Returns the currently playing token. |
41 virtual const std::string PlayingToken(AudioType type) const = 0; | 36 virtual const std::string PlayingToken(AudioType type) const = 0; |
42 | 37 |
43 // Returns if we have heard the currently playing audio token. | 38 // Returns if we have heard the currently playing audio token. |
44 virtual bool IsPlayingTokenHeard(AudioType type) const = 0; | 39 virtual bool IsPlayingTokenHeard(AudioType type) const = 0; |
45 }; | 40 }; |
46 | 41 |
47 } // namespace copresence | 42 } // namespace copresence |
48 | 43 |
49 #endif // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_HANDLER_H_ | 44 #endif // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_HANDLER_H_ |
OLD | NEW |