1 // Copyright (c) 2012 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.
5 #include "ppapi/cpp/file_system.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_file_system.h"
9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/file_ref.h"
11 #include "ppapi/cpp/instance_handle.h"
12 #include "ppapi/cpp/module.h"
13 #include "ppapi/cpp/module_impl.h"
19 template <> const char* interface_name
<PPB_FileSystem_1_0
>() {
20 return PPB_FILESYSTEM_INTERFACE_1_0
;
25 FileSystem::FileSystem() {
28 FileSystem::FileSystem(const FileSystem
& other
) : Resource(other
) {
31 FileSystem::FileSystem(PassRef
, PP_Resource resource
)
32 : Resource(PASS_REF
, resource
) {
35 FileSystem::FileSystem(const InstanceHandle
& instance
,
36 PP_FileSystemType type
) {
37 if (!has_interface
<PPB_FileSystem_1_0
>())
39 PassRefFromConstructor(get_interface
<PPB_FileSystem_1_0
>()->Create(
40 instance
.pp_instance(), type
));
43 int32_t FileSystem::Open(int64_t expected_size
,
44 const CompletionCallback
& cc
) {
45 if (!has_interface
<PPB_FileSystem_1_0
>())
46 return cc
.MayForce(PP_ERROR_NOINTERFACE
);
47 return get_interface
<PPB_FileSystem_1_0
>()->Open(
48 pp_resource(), expected_size
, cc
.pp_completion_callback());