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 REMOTING_HOST_HOST_EXTENSION_SESSION_H_
6#define REMOTING_HOST_HOST_EXTENSION_SESSION_H_
7
8#include "base/memory/scoped_ptr.h"
9
10namespace webrtc {
11class DesktopCapturer;
12}
13
14namespace remoting {
15
16class ClientSessionControl;
17class VideoEncoder;
18
19namespace protocol {
20class ExtensionMessage;
21class ClientStub;
22}  // namespace protocol
23
24// Created by an |HostExtension| to store |ClientSession| specific state, and to
25// handle extension messages.
26class HostExtensionSession {
27 public:
28  virtual ~HostExtensionSession() {}
29
30  // Hook functions called when the video pipeline is being (re)constructed.
31  // Implementations will receive these calls only if they express the need to
32  // modify the pipeline (see below). They may replace or wrap |capturer| and/or
33  // |encoder|, e.g. to filter video frames in some way.
34  // If either |capturer| or |encoder| are reset then the video pipeline is not
35  // constructed.
36  virtual void OnCreateVideoCapturer(
37      scoped_ptr<webrtc::DesktopCapturer>* capturer);
38  virtual void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder);
39
40  // Must return true if the HostExtensionSession needs the opportunity to
41  // modify the video pipeline.
42  virtual bool ModifiesVideoPipeline() const;
43
44  // Called when the host receives an |ExtensionMessage| for the |ClientSession|
45  // associated with this |HostExtensionSession|.
46  // It returns |true| if the message was handled, and |false| otherwise.
47  virtual bool OnExtensionMessage(
48      ClientSessionControl* client_session_control,
49      protocol::ClientStub* client_stub,
50      const protocol::ExtensionMessage& message) = 0;
51};
52
53}  // namespace remoting
54
55#endif  // REMOTING_HOST_HOST_EXTENSION_SESSION_H_
56