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

Side by Side Diff: components/webmessaging/broadcast_channel_service.h

Issue 2004643002: Implement BroadcastChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
(Empty)
1 // Copyright 2016 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 COMPONENTS_WEBMESSAGING_BROADCAST_CHANNEL_SERVICE_H_
6 #define COMPONENTS_WEBMESSAGING_BROADCAST_CHANNEL_SERVICE_H_
7
8 #include <map>
9
10 #include "base/memory/ref_counted.h"
11 #include "components/webmessaging/broadcast_channel.mojom.h"
12 #include "mojo/public/cpp/bindings/binding_set.h"
13 #include "url/origin.h"
14
15 namespace webmessaging {
16
17 class BroadcastChannelService
18 : public base::RefCountedThreadSafe<BroadcastChannelService>,
19 public mojom::BroadcastChannelService {
20 public:
21 BroadcastChannelService();
22
23 void ConnectProcess(
24 mojo::InterfaceRequest<mojom::BroadcastChannelService> request);
25
26 void ConnectToChannel(
27 const mojo::String& origin,
28 const mojo::String& name,
29 mojom::BroadcastChannelClientAssociatedPtrInfo client,
30 mojom::BroadcastChannelClientAssociatedRequest connection) override;
31
32 private:
33 friend class base::RefCountedThreadSafe<BroadcastChannelService>;
34
35 class Connection;
36 friend class Connection;
37
38 ~BroadcastChannelService() override;
39
40 void RegisterConnection(Connection*);
41 void UnregisterConnection(Connection*);
42 void ReceivedMessageOnConnection(Connection*, const mojo::String& message);
43
44 mojo::BindingSet<mojom::BroadcastChannelService> bindings_;
45 std::multimap<url::Origin, Connection*> connections_;
46
47 base::WeakPtrFactory<BroadcastChannelService> weak_factory_;
48 };
49
50 } // namespace webmessaging
51
52 #endif // COMPONENTS_WEBMESSAGING_CHANNEL_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698