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

Side by Side Diff: chrome/browser/copresence/chrome_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
« no previous file with comments | « chrome/browser/copresence/OWNERS ('k') | chrome/browser/copresence/chrome_whispernet_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_
6 #define CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "components/copresence/public/whispernet_client.h"
14
15 namespace content {
16 class BrowserContext;
17 }
18
19 namespace extensions {
20 namespace api {
21 namespace copresence_private {
22 struct AudioParameters;
23 }
24 }
25 }
26
27 namespace media {
28 class AudioBusRefCounted;
29 }
30
31 // This class is responsible for communication with our ledger_proxy extension
32 // that talks to the whispernet audio library.
33 class ChromeWhispernetClient : public copresence::WhispernetClient {
34 public:
35 // The browser context needs to outlive this class.
36 explicit ChromeWhispernetClient(content::BrowserContext* browser_context);
37 virtual ~ChromeWhispernetClient();
38
39 // WhispernetClient overrides:
40 virtual void Initialize(const SuccessCallback& init_callback) OVERRIDE;
41 virtual void Shutdown() OVERRIDE;
42
43 virtual void EncodeToken(const std::string& token) OVERRIDE;
44 virtual void DecodeSamples(const std::string& samples) OVERRIDE;
45 virtual void DetectBroadcast() OVERRIDE;
46
47 virtual void RegisterTokensCallback(
48 const TokensCallback& tokens_callback) OVERRIDE;
49 virtual void RegisterSamplesCallback(
50 const SamplesCallback& samples_callback) OVERRIDE;
51 virtual void RegisterDetectBroadcastCallback(
52 const SuccessCallback& db_callback) OVERRIDE;
53
54 virtual TokensCallback GetTokensCallback() OVERRIDE;
55 virtual SamplesCallback GetSamplesCallback() OVERRIDE;
56 virtual SuccessCallback GetDetectBroadcastCallback() OVERRIDE;
57 virtual SuccessCallback GetInitializedCallback() OVERRIDE;
58
59 static const char kWhispernetProxyExtensionId[];
60
61 private:
62 // Fire an event to initialize whispernet with the given parameters.
63 void InitializeWhispernet(
64 const extensions::api::copresence_private::AudioParameters& params);
65
66 // This gets called twice; once when the proxy extension loads, the second
67 // time when we have initialized the proxy extension's encoder and decoder.
68 void OnExtensionLoaded(bool success);
69
70 content::BrowserContext* browser_context_;
71
72 SuccessCallback extension_loaded_callback_;
73 SuccessCallback init_callback_;
74
75 TokensCallback tokens_callback_;
76 SamplesCallback samples_callback_;
77 SuccessCallback db_callback_;
78
79 bool extension_loaded_;
80
81 DISALLOW_COPY_AND_ASSIGN(ChromeWhispernetClient);
82 };
83
84 #endif // CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/copresence/OWNERS ('k') | chrome/browser/copresence/chrome_whispernet_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698