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

Unified Diff: components/copresence/handlers/directive_handler.h

Issue 433283002: Adding the Copresence RpcHandler and HttpPost helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@directive-handler
Patch Set: Addressing nits 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 side-by-side diff with in-line comments
Download patch
Index: components/copresence/handlers/directive_handler.h
diff --git a/components/copresence/handlers/directive_handler.h b/components/copresence/handlers/directive_handler.h
index 8a415f1dbb77cda9b70dfce35cd6ad2550d1e822..457d74af9daefd6b77c56e9c9682f331a5ec7e11 100644
--- a/components/copresence/handlers/directive_handler.h
+++ b/components/copresence/handlers/directive_handler.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_
-#define COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_
+#ifndef COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_
+#define COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_
#include <string>
@@ -18,18 +18,23 @@ namespace copresence {
class AudioDirectiveHandler;
class Directive;
-// The directive handler manages transmit and receive directives given to it
-// by the client.
+// The directive handler manages transmit and receive directives
+// given to it by the client.
class DirectiveHandler {
public:
- DirectiveHandler(const AudioRecorder::DecodeSamplesCallback& decode_cb,
- const AudioDirectiveList::EncodeTokenCallback& encode_cb);
- ~DirectiveHandler();
+ DirectiveHandler();
+ virtual ~DirectiveHandler();
+
+ // Initialize the |audio_handler_| with the appropriate callbacks.
+ // This function must be called before any others.
willchan no longer on Chromium 2014/08/08 01:05:59 If it's not safe to use this object before Initial
Charlie 2014/08/08 21:57:52 We explicitly don't want these to be constructor p
willchan no longer on Chromium 2014/08/08 22:53:34 Can you explain further? Can't subclasses just cal
Charlie 2014/08/08 23:38:30 Yes, but this is easier than passing in a bunch of
+ virtual void Initialize(
+ const AudioRecorder::DecodeSamplesCallback& decode_cb,
+ const AudioDirectiveList::EncodeTokenCallback& encode_cb);
// Adds a directive to handle.
- void AddDirective(const copresence::Directive& directive);
+ virtual void AddDirective(const copresence::Directive& directive);
willchan no longer on Chromium 2014/08/08 01:05:58 Why are these virtual?
Charlie 2014/08/08 21:57:52 So the FakeDirectiveHandler can override them. See
willchan no longer on Chromium 2014/08/08 22:53:33 Got it, that makes sense. My personal suggestion,
Charlie 2014/08/08 23:38:30 Not a bad idea. This is also what we do in the cli
// Removes any directives associated with the given operation id.
- void RemoveDirectives(const std::string& op_id);
+ virtual void RemoveDirectives(const std::string& op_id);
private:
scoped_ptr<AudioDirectiveHandler> audio_handler_;
@@ -39,4 +44,4 @@ class DirectiveHandler {
} // namespace copresence
-#endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_
+#endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698