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 #include "components/copresence/handlers/directive_handler.h" | 5 #include "components/copresence/handlers/directive_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "components/copresence/handlers/audio/audio_directive_handler.h" | 9 #include "components/copresence/handlers/audio/audio_directive_handler_impl.h" |
10 #include "components/copresence/proto/data.pb.h" | 10 #include "components/copresence/proto/data.pb.h" |
11 | 11 |
12 namespace copresence { | 12 namespace copresence { |
13 | 13 |
14 DirectiveHandler::DirectiveHandler() {} | 14 DirectiveHandler::DirectiveHandler() {} |
15 | 15 |
16 void DirectiveHandler::Initialize( | 16 void DirectiveHandler::Initialize( |
17 const AudioManager::DecodeSamplesCallback& decode_cb, | 17 const AudioManager::DecodeSamplesCallback& decode_cb, |
18 const AudioManager::EncodeTokenCallback& encode_cb) { | 18 const AudioManager::EncodeTokenCallback& encode_cb) { |
19 audio_handler_.reset(new AudioDirectiveHandler()); | 19 audio_handler_.reset(new AudioDirectiveHandlerImpl); |
20 audio_handler_->Initialize(decode_cb, encode_cb); | 20 audio_handler_->Initialize(decode_cb, encode_cb); |
21 } | 21 } |
22 | 22 |
23 DirectiveHandler::~DirectiveHandler() { | 23 DirectiveHandler::~DirectiveHandler() { |
24 } | 24 } |
25 | 25 |
26 void DirectiveHandler::AddDirective(const Directive& directive) { | 26 void DirectiveHandler::AddDirective(const Directive& directive) { |
27 // We only handle Token directives; wifi/ble requests aren't implemented. | 27 // We only handle Token directives; wifi/ble requests aren't implemented. |
28 DCHECK_EQ(directive.instruction_type(), TOKEN); | 28 DCHECK_EQ(directive.instruction_type(), TOKEN); |
29 | 29 |
(...skipping 22 matching lines...) Expand all Loading... |
52 DCHECK(audio_handler_.get()) << "Clients must call Initialize() before " | 52 DCHECK(audio_handler_.get()) << "Clients must call Initialize() before " |
53 << "any other DirectiveHandler methods."; | 53 << "any other DirectiveHandler methods."; |
54 audio_handler_->RemoveInstructions(op_id); | 54 audio_handler_->RemoveInstructions(op_id); |
55 } | 55 } |
56 | 56 |
57 const std::string DirectiveHandler::GetCurrentAudioToken(AudioType type) const { | 57 const std::string DirectiveHandler::GetCurrentAudioToken(AudioType type) const { |
58 return audio_handler_->PlayingToken(type); | 58 return audio_handler_->PlayingToken(type); |
59 } | 59 } |
60 | 60 |
61 } // namespace copresence | 61 } // namespace copresence |
OLD | NEW |