| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "components/copresence/handlers/audio/audio_directive_handler.h" | 10 #include "components/copresence/handlers/audio/audio_directive_handler_impl.h" |
| 11 #include "components/copresence/proto/data.pb.h" | 11 #include "components/copresence/proto/data.pb.h" |
| 12 | 12 |
| 13 namespace copresence { | 13 namespace copresence { |
| 14 | 14 |
| 15 // Public functions | 15 // Public functions |
| 16 | 16 |
| 17 DirectiveHandler::DirectiveHandler() | 17 DirectiveHandler::DirectiveHandler() |
| 18 : audio_handler_(new AudioDirectiveHandler), | 18 : audio_handler_(new AudioDirectiveHandlerImpl), |
| 19 whispernet_client_(nullptr) {} | 19 whispernet_client_(nullptr) {} |
| 20 | 20 |
| 21 DirectiveHandler::~DirectiveHandler() {} | 21 DirectiveHandler::~DirectiveHandler() {} |
| 22 | 22 |
| 23 void DirectiveHandler::Start(WhispernetClient* whispernet_client) { | 23 void DirectiveHandler::Start(WhispernetClient* whispernet_client) { |
| 24 DCHECK(whispernet_client); | 24 DCHECK(whispernet_client); |
| 25 whispernet_client_ = whispernet_client; | 25 whispernet_client_ = whispernet_client; |
| 26 | 26 |
| 27 // TODO(ckehoe): Just pass Whispernet all the way down to the AudioManager. | 27 // TODO(ckehoe): Just pass Whispernet all the way down to the AudioManager. |
| 28 // We shouldn't be concerned with these details here. | 28 // We shouldn't be concerned with these details here. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 DCHECK(type == AUDIBLE || type == INAUDIBLE); | 103 DCHECK(type == AUDIBLE || type == INAUDIBLE); |
| 104 // TODO(ckehoe): This null check shouldn't be necessary. | 104 // TODO(ckehoe): This null check shouldn't be necessary. |
| 105 // It's only here for tests. | 105 // It's only here for tests. |
| 106 if (whispernet_client_) { | 106 if (whispernet_client_) { |
| 107 whispernet_client_->RegisterSamplesCallback(samples_callback); | 107 whispernet_client_->RegisterSamplesCallback(samples_callback); |
| 108 whispernet_client_->EncodeToken(token, type); | 108 whispernet_client_->EncodeToken(token, type); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace copresence | 112 } // namespace copresence |
| OLD | NEW |