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

Side by Side Diff: chrome/browser/copresence/chrome_whispernet_client.h

Issue 865483005: Creating the audio_modem component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fixes Created 5 years, 10 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
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 CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_ 5 #ifndef CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_
6 #define CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_ 6 #define CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/copresence/public/copresence_constants.h" 13 #include "chrome/browser/copresence/chrome_whispernet_config.h"
14 #include "components/copresence/public/whispernet_client.h" 14 #include "components/audio_modem/public/whispernet_client.h"
15 15
16 namespace content { 16 namespace content {
17 class BrowserContext; 17 class BrowserContext;
18 } 18 }
19 19
20 namespace extensions { 20 namespace extensions {
21 namespace api { 21 namespace api {
22 namespace copresence_private { 22 namespace copresence_private {
23 struct AudioParameters; 23 struct AudioParameters;
24 } 24 }
25 } 25 }
26 } 26 }
27 27
28 namespace media { 28 namespace media {
29 class AudioBusRefCounted; 29 class AudioBusRefCounted;
30 } 30 }
31 31
32 // This class is responsible for communication with our ledger_proxy extension 32 // This class is responsible for communication with our whispernet_proxy
33 // that talks to the whispernet audio library. 33 // extension that talks to the whispernet audio library.
34 class ChromeWhispernetClient final : public copresence::WhispernetClient { 34 class ChromeWhispernetClient final : public audio_modem::WhispernetClient {
35 public: 35 public:
36 // The browser context needs to outlive this class. 36 // The browser context needs to outlive this class.
37 explicit ChromeWhispernetClient(content::BrowserContext* browser_context); 37 explicit ChromeWhispernetClient(content::BrowserContext* browser_context);
38 ~ChromeWhispernetClient() override; 38 ~ChromeWhispernetClient() override;
39 39
40 // WhispernetClient overrides: 40 // WhispernetClient overrides:
41 void Initialize(const copresence::SuccessCallback& init_callback) override; 41 void Initialize(const audio_modem::SuccessCallback& init_callback) override;
42 void Shutdown() override;
43 void EncodeToken(const std::string& token_str, 42 void EncodeToken(const std::string& token_str,
44 copresence::AudioType type) override; 43 audio_modem::AudioType type) override;
45 void DecodeSamples(copresence::AudioType type, 44 void DecodeSamples(audio_modem::AudioType type,
46 const std::string& samples, 45 const std::string& samples,
47 const size_t token_length[2]) override; 46 const size_t token_length[2]) override;
48 void DetectBroadcast() override; 47 void DetectBroadcast() override;
49 void RegisterTokensCallback( 48 void RegisterTokensCallback(
50 const copresence::TokensCallback& tokens_callback) override; 49 const audio_modem::TokensCallback& tokens_callback) override;
51 void RegisterSamplesCallback( 50 void RegisterSamplesCallback(
52 const copresence::SamplesCallback& samples_callback) override; 51 const audio_modem::SamplesCallback& samples_callback) override;
53 void RegisterDetectBroadcastCallback( 52 void RegisterDetectBroadcastCallback(
54 const copresence::SuccessCallback& db_callback) override; 53 const audio_modem::SuccessCallback& db_callback) override;
55 54
56 copresence::TokensCallback GetTokensCallback() override; 55 audio_modem::TokensCallback GetTokensCallback() override;
57 copresence::SamplesCallback GetSamplesCallback() override; 56 audio_modem::SamplesCallback GetSamplesCallback() override;
58 copresence::SuccessCallback GetDetectBroadcastCallback() override; 57 audio_modem::SuccessCallback GetDetectBroadcastCallback() override;
59 copresence::SuccessCallback GetInitializedCallback() override; 58 audio_modem::SuccessCallback GetInitializedCallback() override;
60 59
61 static const char kWhispernetProxyExtensionId[]; 60 static const char kWhispernetProxyExtensionId[];
62 61
63 private: 62 private:
64 // Fire an event to configure whispernet with the given audio parameters. 63 // Fire an event to configure whispernet with the given audio parameters.
65 void AudioConfiguration(const copresence::config::AudioParamData& params); 64 void AudioConfiguration(const AudioParamData& params);
66 65
67 // This gets called twice; once when the proxy extension loads, the second 66 // This gets called twice; once when the proxy extension loads, the second
68 // time when we have initialized the proxy extension's encoder and decoder. 67 // time when we have initialized the proxy extension's encoder and decoder.
69 void OnExtensionLoaded(bool success); 68 void OnExtensionLoaded(bool success);
70 69
71 content::BrowserContext* browser_context_; 70 content::BrowserContext* browser_context_;
72 71
73 copresence::SuccessCallback extension_loaded_callback_; 72 audio_modem::SuccessCallback extension_loaded_callback_;
74 copresence::SuccessCallback init_callback_; 73 audio_modem::SuccessCallback init_callback_;
75 74
76 copresence::TokensCallback tokens_callback_; 75 audio_modem::TokensCallback tokens_callback_;
77 copresence::SamplesCallback samples_callback_; 76 audio_modem::SamplesCallback samples_callback_;
78 copresence::SuccessCallback db_callback_; 77 audio_modem::SuccessCallback db_callback_;
79 78
80 bool extension_loaded_; 79 bool extension_loaded_;
81 80
82 DISALLOW_COPY_AND_ASSIGN(ChromeWhispernetClient); 81 DISALLOW_COPY_AND_ASSIGN(ChromeWhispernetClient);
83 }; 82 };
84 83
85 #endif // CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_ 84 #endif // CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698