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

Side by Side Diff: components/copresence/public/whispernet_client.h

Issue 438513002: Add the whispernet proxy. (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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_COPRESENCE_INTERFACE_WHISPERNET_CLIENT_H_
6 #define COMPONENTS_COPRESENCE_INTERFACE_WHISPERNET_CLIENT_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
xiyuan 2014/07/31 19:22:23 not used?
rkc 2014/07/31 23:12:54 Done.
14
15 namespace media {
16 class AudioBusRefCounted;
17 }
18
19 namespace copresence {
20
21 // The interface that the whispernet client needs to implement. These methods
22 // provide us the ability to use the audio medium in copresence. Currently since
23 // the only medium that copresence uses is audio, the implementation of this
24 // interface is required.
25 class WhispernetClient {
26 public:
27 // Generic callback to indicate a boolean success or failure.
28 typedef base::Callback<void(bool)> SuccessCallback;
29 // Callback that returns detected tokens.
30 typedef base::Callback<void(const std::vector<std::string>&)> TokensCallback;
31 // Callback that returns encoded samples for a given token.
32 typedef base::Callback<
33 void(const std::string&, const scoped_refptr<media::AudioBusRefCounted>&)>
xiyuan 2014/07/31 19:22:23 nit: #include "base/memory/ref_counted.h"
rkc 2014/07/31 23:12:53 Done.
34 SamplesCallback;
35
36 // Initialize the whispernet client and call the callback when done. The
37 // parameter indicates whether we succeeded or failed.
38 virtual void Initialize(const SuccessCallback& init_callback) = 0;
39 // Copresence will call this before making any calls to its destructors.
40 virtual void Shutdown() = 0;
41
42 // Fires an event to request a token encode.
43 virtual void EncodeToken(const std::string& token) = 0;
44 // Fires an event to request a decode for the given samples.
45 virtual void DecodeSamples(const std::string& samples) = 0;
46 // Fires an event to request detection of a whispernet broadcast.
47 virtual void DetectBroadcast() = 0;
48
49 // Callback registreation methods. These are the callbacks that will be
50 // registered by Copresence to receive data.
51 virtual void RegisterTokensCallback(
52 const TokensCallback& tokens_callback) = 0;
53 virtual void RegisterSamplesCallback(
54 const SamplesCallback& samples_callback) = 0;
55 virtual void RegisterDetectBroadcastCallback(
56 const SuccessCallback& db_callback) = 0;
57
58 // Don't cache these callbacks, as they may become invalid at any time.
59 // Always invoke callbacks directly through these accessors.
60 virtual TokensCallback GetTokensCallback() = 0;
61 virtual SamplesCallback GetSamplesCallback() = 0;
62 virtual SuccessCallback GetDetectBroadcastCallback() = 0;
63 virtual SuccessCallback GetInitializedCallback() = 0;
64
65 virtual ~WhispernetClient() {};
66 };
67
68 } // namespace copresence
69
70 #endif // COMPONENTS_COPRESENCE_INTERFACE_WHISPERNET_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698