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 struct DirectoryEntry { | |
43 scoped_refptr<Resource> file_resource; | |
yzshen1
2013/01/31 08:50:54
nit: please include what you use. (ref_counted.h)
nhiroki
2013/02/01 08:19:47
Done.
| |
44 PP_FileType file_type; | |
45 }; | |
46 | |
47 void OnPluginMsgGetEntriesReply( | |
48 const ResourceMessageReplyParams& params, | |
49 const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos, | |
50 const std::vector<PP_FileType>& file_types); | |
51 bool FillUpEntry(); | |
52 | |
53 scoped_refptr<Resource> directory_resource_; | |
54 std::queue<DirectoryEntry> entries_; | |
55 | |
56 PP_DirectoryEntry_Dev* output_; | |
57 bool has_more_; | |
58 | |
59 scoped_refptr<TrackedCallback> callback_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(DirectoryReaderResource); | |
62 }; | |
63 | |
64 } // namespace proxy | |
65 } // namespace ppapi | |
66 | |
67 #endif // PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_ | |
OLD | NEW |