| 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 "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Returns the currently playing token. | 55 // Returns the currently playing token. |
| 56 const std::string& PlayingToken(AudioType type) const { | 56 const std::string& PlayingToken(AudioType type) const { |
| 57 return audio_manager_->get_token(type); | 57 return audio_manager_->get_token(type); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void set_audio_manager_for_testing(scoped_ptr<AudioManager> manager) { | 60 void set_audio_manager_for_testing(scoped_ptr<AudioManager> manager) { |
| 61 audio_manager_ = manager.Pass(); | 61 audio_manager_ = manager.Pass(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void set_clock_for_testing(const scoped_refptr<base::TickClock>& clock); |
| 65 void set_timer_for_testing(scoped_ptr<base::Timer> timer); |
| 66 |
| 64 private: | 67 private: |
| 65 friend class AudioDirectiveHandlerTest; | 68 friend class AudioDirectiveHandlerTest; |
| 66 | 69 |
| 67 // Processes the next active instruction, updating our audio manager state | 70 // Processes the next active instruction, updating our audio manager state |
| 68 // accordingly. | 71 // accordingly. |
| 69 void ProcessNextInstruction(); | 72 void ProcessNextInstruction(); |
| 70 | 73 |
| 71 bool GetNextInstructionExpiry(base::TimeTicks* next_event); | 74 bool GetNextInstructionExpiry(base::TimeTicks* next_event); |
| 72 | 75 |
| 73 scoped_ptr<AudioManager> audio_manager_; | 76 scoped_ptr<AudioManager> audio_manager_; |
| 74 | 77 |
| 75 // Audible and inaudible lists. | 78 // Audible and inaudible lists. |
| 76 // AUDIBLE = 0, INAUDIBLE = 1 (see copresence_constants.h). | 79 // AUDIBLE = 0, INAUDIBLE = 1 (see copresence_constants.h). |
| 77 AudioDirectiveList transmits_list_[2]; | 80 AudioDirectiveList transmits_list_[2]; |
| 78 AudioDirectiveList receives_list_[2]; | 81 AudioDirectiveList receives_list_[2]; |
| 79 | 82 |
| 80 scoped_ptr<base::Timer> audio_event_timer_; | 83 scoped_ptr<base::Timer> audio_event_timer_; |
| 81 | 84 |
| 82 scoped_ptr<base::TickClock> clock_; | 85 scoped_refptr<base::TickClock> clock_; |
| 83 | 86 |
| 84 DISALLOW_COPY_AND_ASSIGN(AudioDirectiveHandler); | 87 DISALLOW_COPY_AND_ASSIGN(AudioDirectiveHandler); |
| 85 }; | 88 }; |
| 86 | 89 |
| 87 } // namespace copresence | 90 } // namespace copresence |
| 88 | 91 |
| 89 #endif // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_HANDLER_H_ | 92 #endif // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_AUDIO_DIRECTIVE_HANDLER_H_ |
| OLD | NEW |