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.
5 #ifndef COMPONENTS_DEVTOOLS_BRIDGE_ABSTRACT_DATA_CHANNEL_H_
6 #define COMPONENTS_DEVTOOLS_BRIDGE_ABSTRACT_DATA_CHANNEL_H_
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
13 namespace devtools_bridge
{
16 * WebRTC DataChannel adapter for DevTools bridge. Not thread safe.
18 class AbstractDataChannel
{
20 AbstractDataChannel() {}
21 virtual ~AbstractDataChannel() {}
24 * Called on WebRTC signaling thread.
29 virtual ~Observer() {}
31 virtual void OnOpen() = 0;
32 virtual void OnClose() = 0;
34 virtual void OnMessage(const void* data
, size_t length
) = 0;
37 DISALLOW_COPY_AND_ASSIGN(Observer
);
40 virtual void RegisterObserver(scoped_ptr
<Observer
> observer
) = 0;
41 virtual void UnregisterObserver() = 0;
43 virtual void SendBinaryMessage(void* data
, size_t length
) = 0;
44 virtual void SendTextMessage(void* data
, size_t length
) = 0;
46 virtual void Close() = 0;
49 DISALLOW_COPY_AND_ASSIGN(AbstractDataChannel
);
52 } // namespace devtools_bridge
54 #endif // COMPONENTS_DEVTOOLS_BRIDGE_ABSTRACT_DATA_CHANNEL_H_