Chromium Code Reviews| 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 "base/memory/ref_counted.h" | |
| 13 #include "ppapi/proxy/plugin_resource.h" | |
| 14 #include "ppapi/proxy/ppapi_proxy_export.h" | |
| 15 #include "ppapi/shared_impl/ppb_file_ref_shared.h" | |
| 16 #include "ppapi/shared_impl/resource.h" | |
| 17 #include "ppapi/shared_impl/scoped_pp_resource.h" | |
| 18 #include "ppapi/thunk/ppb_directory_reader_api.h" | |
| 19 | |
| 20 namespace ppapi { | |
| 21 | |
| 22 class TrackedCallback; | |
| 23 | |
| 24 namespace proxy { | |
| 25 | |
| 26 class PPAPI_PROXY_EXPORT DirectoryReaderResource | |
| 27 : public PluginResource, | |
| 28 public NON_EXPORTED_BASE(thunk::PPB_DirectoryReader_API) { | |
| 29 public: | |
| 30 DirectoryReaderResource(Connection connection, | |
| 31 PP_Instance instance, | |
| 32 PP_Resource directory_ref); | |
| 33 virtual ~DirectoryReaderResource(); | |
| 34 | |
| 35 // Resource overrides. | |
| 36 virtual thunk::PPB_DirectoryReader_API* AsPPB_DirectoryReader_API() OVERRIDE; | |
| 37 | |
| 38 // PPB_DirectoryReader_API. | |
| 39 virtual int32_t GetNextEntry( | |
| 40 PP_DirectoryEntry_Dev* entry, | |
| 41 scoped_refptr<TrackedCallback> callback) OVERRIDE; | |
| 42 | |
| 43 private: | |
| 44 struct DirectoryEntry { | |
| 45 ScopedPPResource file_resource; | |
| 46 PP_FileType file_type; | |
| 47 }; | |
| 48 | |
| 49 void OnPluginMsgGetEntriesReply( | |
| 50 const ResourceMessageReplyParams& params, | |
| 51 const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos, | |
| 52 const std::vector<PP_FileType>& file_types); | |
| 53 bool FillUpEntry(); | |
|
dmichael (off chromium)
2013/02/06 22:44:21
This function probably deserves a comment, includi
nhiroki
2013/02/07 09:37:27
Done.
| |
| 54 | |
| 55 scoped_refptr<Resource> directory_resource_; | |
| 56 std::queue<DirectoryEntry> entries_; | |
| 57 | |
| 58 PP_DirectoryEntry_Dev* output_; | |
| 59 bool has_more_; | |
| 60 | |
| 61 scoped_refptr<TrackedCallback> callback_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(DirectoryReaderResource); | |
| 64 }; | |
| 65 | |
| 66 } // namespace proxy | |
| 67 } // namespace ppapi | |
| 68 | |
| 69 #endif // PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_ | |
| OLD | NEW |