summaryrefslogtreecommitdiffstats
path: root/webkit/glue/media/web_data_source_factory.h
blob: 7163ef495f32e07d5e56a1a4b7ea8241aac15b67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_FACTORY_H_
#define WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_FACTORY_H_

#include "media/base/async_filter_factory_base.h"
#include "webkit/glue/media/web_data_source.h"

class MessageLoop;

namespace WebKit {
class WebFrame;
}

namespace webkit_glue {

class WebDataSourceFactory : public media::AsyncDataSourceFactoryBase {
 public:
  typedef WebDataSource* (*FactoryFunction)(MessageLoop* render_loop,
                                            WebKit::WebFrame* frame);

  WebDataSourceFactory(MessageLoop* render_loop, WebKit::WebFrame* frame,
                       FactoryFunction factory_function,
                       WebDataSourceBuildObserverHack* build_observer);
  virtual ~WebDataSourceFactory();

  // DataSourceFactory method.
  virtual media::DataSourceFactory* Clone() const;

 protected:
  // AsyncDataSourceFactoryBase methods.
  virtual bool AllowRequests() const;
  virtual AsyncDataSourceFactoryBase::BuildRequest* CreateRequest(
      const std::string& url, BuildCallback* callback);

 private:
  class BuildRequest;

  MessageLoop* render_loop_;
  WebKit::WebFrame* frame_;
  FactoryFunction factory_function_;
  WebDataSourceBuildObserverHack* build_observer_;

  DISALLOW_COPY_AND_ASSIGN(WebDataSourceFactory);
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_MEDIA_BUFFERED_DATA_SOURCE_FACTORY_H_