1// Copyright (c) 2013 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 CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_OBSERVER_H_
6#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_OBSERVER_H_
7
8#include "base/compiler_specific.h"
9#include "base/memory/ref_counted.h"
10#include "base/threading/non_thread_safe.h"
11#include "content/common/content_export.h"
12#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
13#include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
14
15namespace content {
16
17class MediaStreamSourceExtraData;
18
19// MediaStreamSourceObserver listens to events on MediaSourceInterface and
20// notify WebKit. It will be owned by MediaStreamSourceExtraData.
21class CONTENT_EXPORT MediaStreamSourceObserver
22    : NON_EXPORTED_BASE(public webrtc::ObserverInterface),
23      NON_EXPORTED_BASE(public base::NonThreadSafe) {
24 public:
25  MediaStreamSourceObserver(webrtc::MediaSourceInterface* webrtc_source,
26                            MediaStreamSourceExtraData* extra_data);
27  virtual ~MediaStreamSourceObserver();
28
29 private:
30  // webrtc::ObserverInterface implementation.
31  virtual void OnChanged() OVERRIDE;
32
33  webrtc::MediaSourceInterface::SourceState state_;
34  scoped_refptr<webrtc::MediaSourceInterface> webrtc_source_;
35  MediaStreamSourceExtraData* extra_data_;
36
37  DISALLOW_COPY_AND_ASSIGN(MediaStreamSourceObserver);
38};
39
40}  // namespace content
41
42#endif  // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_OBSERVER_H_
43