| OLD | NEW |
| 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 "components/copresence/public/whispernet_client.h" | 14 #include "components/copresence/public/whispernet_client.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 class BrowserContext; | 17 class BrowserContext; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace extensions { | 20 namespace extensions { |
| 20 namespace api { | 21 namespace api { |
| 21 namespace copresence_private { | 22 namespace copresence_private { |
| 22 struct AudioParameters; | 23 struct AudioParameters; |
| 23 } | 24 } |
| 24 } | 25 } |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace media { | 28 namespace media { |
| 28 class AudioBusRefCounted; | 29 class AudioBusRefCounted; |
| 29 } | 30 } |
| 30 | 31 |
| 31 // This class is responsible for communication with our ledger_proxy extension | 32 // This class is responsible for communication with our ledger_proxy extension |
| 32 // that talks to the whispernet audio library. | 33 // that talks to the whispernet audio library. |
| 33 class ChromeWhispernetClient : public copresence::WhispernetClient { | 34 class ChromeWhispernetClient final : public copresence::WhispernetClient { |
| 34 public: | 35 public: |
| 35 // The browser context needs to outlive this class. | 36 // The browser context needs to outlive this class. |
| 36 explicit ChromeWhispernetClient(content::BrowserContext* browser_context); | 37 explicit ChromeWhispernetClient(content::BrowserContext* browser_context); |
| 37 ~ChromeWhispernetClient() override; | 38 ~ChromeWhispernetClient() override; |
| 38 | 39 |
| 39 // WhispernetClient overrides: | 40 // WhispernetClient overrides: |
| 40 void Initialize(const SuccessCallback& init_callback) override; | 41 void Initialize(const SuccessCallback& init_callback) override; |
| 41 void Shutdown() override; | 42 void Shutdown() override; |
| 42 | 43 |
| 43 void EncodeToken(const std::string& token, bool audible) override; | 44 void EncodeToken(const std::string& token, |
| 44 void DecodeSamples(const std::string& samples) override; | 45 copresence::AudioType type) override; |
| 46 void DecodeSamples(copresence::AudioType type, |
| 47 const std::string& samples) override; |
| 45 void DetectBroadcast() override; | 48 void DetectBroadcast() override; |
| 46 | 49 |
| 47 void RegisterTokensCallback(const TokensCallback& tokens_callback) override; | 50 void RegisterTokensCallback(const TokensCallback& tokens_callback) override; |
| 48 void RegisterSamplesCallback( | 51 void RegisterSamplesCallback( |
| 49 const SamplesCallback& samples_callback) override; | 52 const SamplesCallback& samples_callback) override; |
| 50 void RegisterDetectBroadcastCallback( | 53 void RegisterDetectBroadcastCallback( |
| 51 const SuccessCallback& db_callback) override; | 54 const SuccessCallback& db_callback) override; |
| 52 | 55 |
| 53 TokensCallback GetTokensCallback() override; | 56 TokensCallback GetTokensCallback() override; |
| 54 SamplesCallback GetSamplesCallback() override; | 57 SamplesCallback GetSamplesCallback() override; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 TokensCallback tokens_callback_; | 77 TokensCallback tokens_callback_; |
| 75 SamplesCallback samples_callback_; | 78 SamplesCallback samples_callback_; |
| 76 SuccessCallback db_callback_; | 79 SuccessCallback db_callback_; |
| 77 | 80 |
| 78 bool extension_loaded_; | 81 bool extension_loaded_; |
| 79 | 82 |
| 80 DISALLOW_COPY_AND_ASSIGN(ChromeWhispernetClient); | 83 DISALLOW_COPY_AND_ASSIGN(ChromeWhispernetClient); |
| 81 }; | 84 }; |
| 82 | 85 |
| 83 #endif // CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_ | 86 #endif // CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_ |
| OLD | NEW |