summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi/ppb_video_layer_impl.cc
blob: 4bc201b36add44aa56a16b5d5cf0f9ca7f523cc9 (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
// 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.

#include "webkit/plugins/ppapi/ppb_video_layer_impl.h"

#include "base/logging.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/ppb_video_layer_software.h"

using ppapi::thunk::PPB_VideoLayer_API;

namespace webkit {
namespace ppapi {

PPB_VideoLayer_Impl::PPB_VideoLayer_Impl(PluginInstance* instance)
    : Resource(instance) {
}

PPB_VideoLayer_Impl::~PPB_VideoLayer_Impl() {
}

// static
PP_Resource PPB_VideoLayer_Impl::Create(PP_Instance pp_instance,
                                        PP_VideoLayerMode_Dev mode) {
  PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
  if (!instance)
    return 0;

  if (mode != PP_VIDEOLAYERMODE_SOFTWARE)
    return 0;

  scoped_refptr<PPB_VideoLayer_Impl> layer(
      new PPB_VideoLayer_Software(instance));
  return layer->GetReference();
}

PPB_VideoLayer_API* PPB_VideoLayer_Impl::AsPPB_VideoLayer_API() {
  return this;
}

}  // namespace ppapi
}  // namespace webkit