Pepper_47_C++_interfaces
extension_system_samsung.cc
Go to the documentation of this file.
1 // Copyright 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/samsung/ppb_extension_system_samsung.h"
8 #include "ppapi/c/pp_errors.h"
10 
11 namespace pp {
12 
13 namespace {
14 
15 template <>
16 const char* interface_name<PPB_ExtensionSystem_Samsung_0_1>() {
17  return PPB_EXTENSIONSYSTEM_SAMSUNG_INTERFACE_0_1;
18 }
19 
20 } // namespace
21 
23  : instance_(instance) {}
24 
26 
28  if (!has_interface<PPB_ExtensionSystem_Samsung_0_1>())
29  return std::string();
30  Var result(PASS_REF,
31  get_interface<PPB_ExtensionSystem_Samsung_0_1>()->GetEmbedderName(
32  instance_.pp_instance()));
33  return result.is_string() ? result.AsString() : std::string();
34 }
35 
37  if (!has_interface<PPB_ExtensionSystem_Samsung_0_1>())
38  return Var();
39  PP_Var rv =
40  get_interface<PPB_ExtensionSystem_Samsung_0_1>()->GetCurrentExtensionInfo(
41  instance_.pp_instance());
42  return Var(PASS_REF, rv);
43 }
44 
46  const Var& operation_data) {
47  if (!has_interface<PPB_ExtensionSystem_Samsung_0_1>())
48  return Var();
49  PP_Var operation_result;
50  int32_t error =
51  get_interface<PPB_ExtensionSystem_Samsung_0_1>()->GenericSyncCall(
52  instance_.pp_instance(),
53  operation_name.pp_var(),
54  operation_data.pp_var(),
55  &operation_result);
56  if (error != PP_OK)
57  return Var();
58  return Var(PASS_REF, operation_result);
59 }
60 
61 } // namespace pp
std::string AsString() const
Definition: var.cc:250
bool is_string() const
Definition: var.h:123
std::string GetEmbedderName() const
GetEmbedderName() returns name of the extension system provider.
const PP_Var & pp_var() const
Definition: var.h:226
ExtensionSystemSamsung(const InstanceHandle &instance)
Var GenericSyncCall(const Var &operation_name, const Var &operation_data)
A generic type used for passing data types between the module and the page.
Definition: var.h:21
PP_Instance pp_instance() const