Pepper_47_C++_interfaces
url_data_source_samsung.cc
Go to the documentation of this file.
1 // Copyright (c) 2016 Samsung Electronics. 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 
6 
7 #include "ppapi/c/pp_errors.h"
10 
11 namespace pp {
12 
13 namespace {
14 
15 template <> const char* interface_name<PPB_URLDataSource_Samsung_1_0>() {
16  return PPB_URLDATASOURCE_SAMSUNG_INTERFACE;
17 }
18 
19 } // namespace
20 
22  const std::string& url) {
23  if (has_interface<PPB_URLDataSource_Samsung_1_0>()) {
24  PassRefFromConstructor(get_interface<PPB_URLDataSource_Samsung_1_0>()->
25  Create(instance.pp_instance(), url.c_str()));
26  }
27 }
28 
30  : MediaDataSource_Samsung(other) {
31 }
32 
34  : MediaDataSource_Samsung(resource) {
35 }
36 
38  : MediaDataSource_Samsung(PASS_REF, resource) {
39 }
40 
42  const URLDataSource_Samsung& other) {
44  return *this;
45 }
46 
48 }
49 
51  PP_StreamingProperty type,
52  const CompletionCallbackWithOutput<pp::Var>& callback) {
53  if (has_interface<PPB_URLDataSource_Samsung_1_0>()) {
54  return get_interface<PPB_URLDataSource_Samsung_1_0>()->GetStreamingProperty(
55  pp_resource(), type,
56  callback.output(), callback.pp_completion_callback());
57  }
58 
59  return callback.MayForce(PP_ERROR_NOINTERFACE);
60 }
61 
63  PP_StreamingProperty type,
64  const Var& value,
65  const CompletionCallback& callback) {
66  if (has_interface<PPB_URLDataSource_Samsung_1_0>()) {
67  return get_interface<PPB_URLDataSource_Samsung_1_0>()->SetStreamingProperty(
68  pp_resource(), type, value.pp_var(),
69  callback.pp_completion_callback());
70  }
71 
72  return callback.MayForce(PP_ERROR_NOINTERFACE);
73 }
74 
75 } // namespace pp
URLDataSource_Samsung & operator=(const URLDataSource_Samsung &other)
void PassRefFromConstructor(PP_Resource resource)
Definition: resource.cc:50
int32_t MayForce(int32_t result) const
const PP_CompletionCallback & pp_completion_callback() const
const PP_Var & pp_var() const
Definition: var.h:226
int32_t GetStreamingProperty(PP_StreamingProperty type, const CompletionCallbackWithOutput< pp::Var > &callback)
PassRef
Definition: pass_ref.h:17
PP_Resource pp_resource() const
Definition: resource.h:47
MediaDataSource_Samsung & operator=(const MediaDataSource_Samsung &other)
A generic type used for passing data types between the module and the page.
Definition: var.h:21
PP_Instance pp_instance() const
int32_t SetStreamingProperty(PP_StreamingProperty type, const Var &value, const CompletionCallback &callback)
URLDataSource_Samsung(const InstanceHandle &instance, const std::string &url)