OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/cpp/file_system.h" | 5 #include "ppapi/cpp/file_system.h" |
6 | 6 |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/ppb_file_system.h" | 8 #include "ppapi/c/ppb_file_system.h" |
9 #include "ppapi/cpp/completion_callback.h" | 9 #include "ppapi/cpp/completion_callback.h" |
10 #include "ppapi/cpp/file_ref.h" | 10 #include "ppapi/cpp/file_ref.h" |
| 11 #include "ppapi/cpp/instance_handle.h" |
11 #include "ppapi/cpp/module.h" | 12 #include "ppapi/cpp/module.h" |
12 #include "ppapi/cpp/module_impl.h" | 13 #include "ppapi/cpp/module_impl.h" |
13 | 14 |
14 namespace pp { | 15 namespace pp { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 template <> const char* interface_name<PPB_FileSystem>() { | 19 template <> const char* interface_name<PPB_FileSystem>() { |
19 return PPB_FILESYSTEM_INTERFACE; | 20 return PPB_FILESYSTEM_INTERFACE; |
20 } | 21 } |
21 | 22 |
22 } // namespace | 23 } // namespace |
23 | 24 |
24 FileSystem::FileSystem() { | 25 FileSystem::FileSystem() { |
25 } | 26 } |
26 | 27 |
27 FileSystem::FileSystem(Instance* instance, | 28 FileSystem::FileSystem(const InstanceHandle& instance, |
28 PP_FileSystemType type) { | 29 PP_FileSystemType type) { |
29 if (!has_interface<PPB_FileSystem>()) | 30 if (!has_interface<PPB_FileSystem>()) |
30 return; | 31 return; |
31 PassRefFromConstructor(get_interface<PPB_FileSystem>()->Create( | 32 PassRefFromConstructor(get_interface<PPB_FileSystem>()->Create( |
32 instance->pp_instance(), type)); | 33 instance.pp_instance(), type)); |
33 } | 34 } |
34 | 35 |
35 int32_t FileSystem::Open(int64_t expected_size, | 36 int32_t FileSystem::Open(int64_t expected_size, |
36 const CompletionCallback& cc) { | 37 const CompletionCallback& cc) { |
37 if (!has_interface<PPB_FileSystem>()) | 38 if (!has_interface<PPB_FileSystem>()) |
38 return cc.MayForce(PP_ERROR_NOINTERFACE); | 39 return cc.MayForce(PP_ERROR_NOINTERFACE); |
39 return get_interface<PPB_FileSystem>()->Open( | 40 return get_interface<PPB_FileSystem>()->Open( |
40 pp_resource(), expected_size, cc.pp_completion_callback()); | 41 pp_resource(), expected_size, cc.pp_completion_callback()); |
41 } | 42 } |
42 | 43 |
43 } // namespace pp | 44 } // namespace pp |
OLD | NEW |