Chromium Code Reviews| Index: components/copresence/public/copresence_constants.h |
| diff --git a/components/copresence/public/copresence_constants.h b/components/copresence/public/copresence_constants.h |
| index 07c38cf0bcca34fe10d168d36fdf504c9a148b7d..8172e56cf6660c4b70e7208ce2ba3e5a5a43c89e 100644 |
| --- a/components/copresence/public/copresence_constants.h |
| +++ b/components/copresence/public/copresence_constants.h |
| @@ -5,8 +5,17 @@ |
| #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_ |
| #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_ |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/callback_forward.h" |
| +#include "base/memory/ref_counted.h" |
| #include "media/base/channel_layout.h" |
| +namespace media { |
| +class AudioBusRefCounted; |
| +} |
| + |
| namespace copresence { |
| // Audio constants. Currently used from the AudioPlayer/AudioRecorder. |
| @@ -38,6 +47,31 @@ enum AudioType { |
| AUDIO_TYPE_UNKNOWN = 3, |
| }; |
| +struct AudioToken { |
| + AudioToken(const std::string& token, bool audible) |
| + : token(token), audible(audible) {} |
| + std::string token; |
| + bool audible; |
| +}; |
| + |
| +// These callbacks are used from various places in Copresence. |
| + |
| +// Generic callback to indicate a boolean success or failure. |
| +using SuccessCallback = base::Callback<void(bool)>; |
|
xiyuan
2014/11/06 21:27:50
Are we allowed to use "using" in this scoped in a
rkc
2014/11/06 21:45:05
New C++11 rules (http://chromium-cpp.appspot.com/)
xiyuan
2014/11/06 21:51:12
Good to know. Apparently, I don't follow chromium-
|
| + |
| +// Callback to pass around found tokens. |
| +// Arguments: |
| +// const std::vector<AudioToken>& tokens - List of found tokens. |
| +using TokensCallback = base::Callback<void(const std::vector<AudioToken>&)>; |
| + |
| +// Callback to receive encoded samples from Whispernet. |
| +// AudioType type: Type of audio encoding - AUDIBLE or INAUDIBLE. |
| +// const std::string& token: The token that we encoded. |
| +// const scoped_refptr<media::AudioBusRefCounted>& samples - Encoded samples. |
| +using SamplesCallback = |
| + base::Callback<void(AudioType, |
| + const std::string&, |
| + const scoped_refptr<media::AudioBusRefCounted>&)>; |
| } // namespace copresence |
| #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CONSTANTS_ |