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#include "ppapi/cpp/private/file_io_private.h"
6
7#include "ppapi/c/pp_errors.h"
8#include "ppapi/c/private/ppb_file_io_private.h"
9#include "ppapi/cpp/file_io.h"
10#include "ppapi/cpp/module_impl.h"
11
12namespace pp {
13
14namespace {
15
16template <> const char* interface_name<PPB_FileIO_Private>() {
17  return PPB_FILEIO_PRIVATE_INTERFACE_0_1;
18}
19
20}  // namespace
21
22FileIO_Private::FileIO_Private()
23    : FileIO() {
24}
25
26FileIO_Private::FileIO_Private(const InstanceHandle& instance)
27    : FileIO(instance) {
28}
29
30int32_t FileIO_Private::RequestOSFileHandle(
31    const CompletionCallbackWithOutput<PassFileHandle>& cc) {
32  if (has_interface<PPB_FileIO_Private>())
33    return get_interface<PPB_FileIO_Private>()->RequestOSFileHandle(
34        pp_resource(),
35        cc.output(),
36        cc.pp_completion_callback());
37  return cc.MayForce(PP_ERROR_NOINTERFACE);
38}
39
40}  // namespace pp
41