OLD | NEW |
(Empty) | |
| 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 #ifndef PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_ |
| 6 #define PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_ |
| 7 |
| 8 #include <queue> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "ppapi/proxy/plugin_resource.h" |
| 13 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 14 #include "ppapi/shared_impl/ppb_file_ref_shared.h" |
| 15 #include "ppapi/shared_impl/resource.h" |
| 16 #include "ppapi/thunk/ppb_directory_reader_api.h" |
| 17 |
| 18 namespace ppapi { |
| 19 |
| 20 class TrackedCallback; |
| 21 |
| 22 namespace proxy { |
| 23 |
| 24 class PPAPI_PROXY_EXPORT DirectoryReaderResource |
| 25 : public PluginResource, |
| 26 public NON_EXPORTED_BASE(thunk::PPB_DirectoryReader_API) { |
| 27 public: |
| 28 DirectoryReaderResource(Connection connection, |
| 29 PP_Instance instance, |
| 30 PP_Resource directory_ref); |
| 31 virtual ~DirectoryReaderResource(); |
| 32 |
| 33 // Resource overrides. |
| 34 virtual thunk::PPB_DirectoryReader_API* AsPPB_DirectoryReader_API() OVERRIDE; |
| 35 |
| 36 // PPB_DirectoryReader_API. |
| 37 virtual int32_t GetNextEntry( |
| 38 PP_DirectoryEntry_Dev* entry, |
| 39 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 40 |
| 41 private: |
| 42 void OnPluginMsgGetNextEntryReply( |
| 43 const ResourceMessageReplyParams& params, |
| 44 const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos, |
| 45 const std::vector<PP_FileType>& file_types); |
| 46 bool FillUpEntry(); |
| 47 |
| 48 // Owning a reference to the directory to be read. |
| 49 PP_Resource directory_ref_; |
| 50 |
| 51 // Owning references to files and directories. |
| 52 std::queue<PP_DirectoryEntry_Dev> entries_; |
| 53 |
| 54 PP_DirectoryEntry_Dev* output_; |
| 55 bool has_more_; |
| 56 |
| 57 scoped_refptr<TrackedCallback> callback_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(DirectoryReaderResource); |
| 60 }; |
| 61 |
| 62 } // namespace proxy |
| 63 } // namespace ppapi |
| 64 |
| 65 #endif // PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_ |
OLD | NEW |