Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: components/copresence/handlers/directive_handler.cc

Issue 690213004: Refactoring AudioDirectiveHandler to support testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/copresence/handlers/audio/tick_clock_ref_counted.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « components/copresence/handlers/audio/tick_clock_ref_counted.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698