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

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

Issue 461803003: Stop playing/recording when not needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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 | Annotate | Revision Log
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 #ifndef COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ 5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_
6 #define COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ 6 #define COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "components/copresence/handlers/audio/audio_directive_list.h" 13 #include "components/copresence/handlers/audio/audio_directive_handler.h"
14 #include "components/copresence/mediums/audio/audio_recorder.h" 14 #include "components/copresence/mediums/audio/audio_recorder.h"
15 15
16 namespace copresence { 16 namespace copresence {
17 17
18 class AudioDirectiveHandler;
19 class Directive; 18 class Directive;
20 19
21 // The directive handler manages transmit and receive directives 20 // The directive handler manages transmit and receive directives
22 // given to it by the client. 21 // given to it by the client.
23 class DirectiveHandler { 22 class DirectiveHandler {
24 public: 23 public:
25 DirectiveHandler(); 24 DirectiveHandler();
26 virtual ~DirectiveHandler(); 25 virtual ~DirectiveHandler();
27 26
28 // Initialize the |audio_handler_| with the appropriate callbacks. 27 // Initialize the |audio_handler_| with the appropriate callbacks.
29 // This function must be called before any others. 28 // This function must be called before any others.
30 // TODO(ckehoe): Instead of this, use a static Create() method 29 // TODO(ckehoe): Instead of this, use a static Create() method
31 // and make the constructor private. 30 // and make the constructor private.
32 virtual void Initialize( 31 virtual void Initialize(
33 const AudioRecorder::DecodeSamplesCallback& decode_cb, 32 const AudioRecorder::DecodeSamplesCallback& decode_cb,
34 const AudioDirectiveList::EncodeTokenCallback& encode_cb); 33 const AudioDirectiveHandler::EncodeTokenCallback& encode_cb);
35 34
36 // Adds a directive to handle. 35 // Adds a directive to handle.
37 virtual void AddDirective(const copresence::Directive& directive); 36 virtual void AddDirective(const copresence::Directive& directive);
38 // Removes any directives associated with the given operation id. 37 // Removes any directives associated with the given operation id.
39 virtual void RemoveDirectives(const std::string& op_id); 38 virtual void RemoveDirectives(const std::string& op_id);
40 39
40 const std::string& CurrentAudibleToken() const;
41 const std::string& CurrentInaudibleToken() const;
42
41 private: 43 private:
42 scoped_ptr<AudioDirectiveHandler> audio_handler_; 44 scoped_ptr<AudioDirectiveHandler> audio_handler_;
43 45
44 DISALLOW_COPY_AND_ASSIGN(DirectiveHandler); 46 DISALLOW_COPY_AND_ASSIGN(DirectiveHandler);
45 }; 47 };
46 48
47 } // namespace copresence 49 } // namespace copresence
48 50
49 #endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_ 51 #endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698