| 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 virtual ~ChromeWhispernetClient(); | 38 virtual ~ChromeWhispernetClient(); |
| 38 | 39 |
| 39 // WhispernetClient overrides: | 40 // WhispernetClient overrides: |
| 40 virtual void Initialize(const SuccessCallback& init_callback) override; | 41 virtual void Initialize(const SuccessCallback& init_callback) override; |
| 41 virtual void Shutdown() override; | 42 virtual void Shutdown() override; |
| 42 | 43 |
| 43 virtual void EncodeToken(const std::string& token, bool audible) override; | 44 virtual void EncodeToken(const std::string& token, |
| 44 virtual void DecodeSamples(const std::string& samples) override; | 45 copresence::AudioType type) override; |
| 46 virtual void DecodeSamples(copresence::AudioType type, |
| 47 const std::string& samples) override; |
| 45 virtual void DetectBroadcast() override; | 48 virtual void DetectBroadcast() override; |
| 46 | 49 |
| 47 virtual void RegisterTokensCallback( | 50 virtual void RegisterTokensCallback( |
| 48 const TokensCallback& tokens_callback) override; | 51 const TokensCallback& tokens_callback) override; |
| 49 virtual void RegisterSamplesCallback( | 52 virtual void RegisterSamplesCallback( |
| 50 const SamplesCallback& samples_callback) override; | 53 const SamplesCallback& samples_callback) override; |
| 51 virtual void RegisterDetectBroadcastCallback( | 54 virtual void RegisterDetectBroadcastCallback( |
| 52 const SuccessCallback& db_callback) override; | 55 const SuccessCallback& db_callback) override; |
| 53 | 56 |
| 54 virtual TokensCallback GetTokensCallback() override; | 57 virtual TokensCallback GetTokensCallback() override; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 75 TokensCallback tokens_callback_; | 78 TokensCallback tokens_callback_; |
| 76 SamplesCallback samples_callback_; | 79 SamplesCallback samples_callback_; |
| 77 SuccessCallback db_callback_; | 80 SuccessCallback db_callback_; |
| 78 | 81 |
| 79 bool extension_loaded_; | 82 bool extension_loaded_; |
| 80 | 83 |
| 81 DISALLOW_COPY_AND_ASSIGN(ChromeWhispernetClient); | 84 DISALLOW_COPY_AND_ASSIGN(ChromeWhispernetClient); |
| 82 }; | 85 }; |
| 83 | 86 |
| 84 #endif // CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_ | 87 #endif // CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_ |
| OLD | NEW |