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

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
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 "base/memory/scoped_ptr.h"
xiyuan 2014/07/31 19:22:22 nit: not used.
rkc 2014/07/31 23:12:52 Done.
14 #include "components/copresence/public/whispernet_client.h"
15
16 namespace content {
17 class BrowserContext;
18 }
19
20 namespace extensions {
21 namespace api {
22 namespace copresence_private {
23 struct AudioParameters;
24 }
25 }
26 }
27
28 namespace media {
29 class AudioBusRefCounted;
30 }
31
32 // This class is responsible for communication with our ledger_proxy extension
33 // that talks to the whispernet audio library.
34 class ChromeWhispernetClient : public copresence::WhispernetClient {
35 public:
36 // The browser context needs to outlive this class.
37 explicit ChromeWhispernetClient(content::BrowserContext* browser_context);
38
39 // WhispernetClient overrides:
xiyuan 2014/07/31 19:22:22 nit: move this down to just before "Initialize"
rkc 2014/07/31 23:12:52 Done.
40
41 virtual ~ChromeWhispernetClient() OVERRIDE;
xiyuan 2014/07/31 19:22:22 I don't think we need OVERRIDE for virtual dtor.
rkc 2014/07/31 23:12:52 Done.
42
43 virtual void Initialize(const SuccessCallback& init_callback) OVERRIDE;
44 virtual void Shutdown() OVERRIDE;
45
46 virtual void EncodeToken(const std::string& token) OVERRIDE;
47 virtual void DecodeSamples(const std::string& samples) OVERRIDE;
48 virtual void DetectBroadcast() OVERRIDE;
49
50 virtual void RegisterTokensCallback(
51 const TokensCallback& tokens_callback) OVERRIDE;
52 virtual void RegisterSamplesCallback(
53 const SamplesCallback& samples_callback) OVERRIDE;
54 virtual void RegisterDetectBroadcastCallback(
55 const SuccessCallback& db_callback) OVERRIDE;
56
57 virtual TokensCallback GetTokensCallback() OVERRIDE;
58 virtual SamplesCallback GetSamplesCallback() OVERRIDE;
59 virtual SuccessCallback GetDetectBroadcastCallback() OVERRIDE;
60 virtual SuccessCallback GetInitializedCallback() OVERRIDE;
61
62 static const char kWhispernetProxyExtensionId[];
63
64 private:
65 // Fire an event to initialize whispernet with the given parameters.
66 void InitializeWhispernet(
67 const extensions::api::copresence_private::AudioParameters& params);
68
69 // This gets called twice; once when the proxy extension loads, the second
70 // time when we have initialized the proxy extension's encoder and decoder.
71 void OnExtensionLoaded(bool success);
72
73 content::BrowserContext* browser_context_;
74
75 SuccessCallback extension_loaded_callback_;
76 SuccessCallback init_callback_;
77
78 TokensCallback tokens_callback_;
79 SamplesCallback samples_callback_;
80 SuccessCallback db_callback_;
81
82 bool extension_loaded_;
83
84 DISALLOW_COPY_AND_ASSIGN(ChromeWhispernetClient);
85 };
86
87 #endif // CHROME_BROWSER_COPRESENCE_CHROME_WHISPERNET_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698