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 OnPluginMsgGetEntriesReply( | |
43 const ResourceMessageReplyParams& params, | |
44 const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos, | |
45 const std::vector<PP_FileType>& file_types, | |
46 bool has_more); | |
47 bool FillUpEntry(); | |
48 | |
49 // Owning a reference to the directory to be read. | |
50 PP_Resource directory_ref_; | |
dmichael (off chromium)
2013/01/29 21:22:42
Probably should be a scoped_refptr instead?
dmichael (off chromium)
2013/01/29 21:25:31
Let me clarify a bit... you should just hold a sc
nhiroki
2013/01/30 09:24:51
I see, thanks for your clear explanation! Done.
| |
51 | |
52 // Owning references to files and directories. | |
53 std::queue<PP_DirectoryEntry_Dev> entries_; | |
dmichael (off chromium)
2013/01/29 21:22:42
ditto, scoped_refptr
nhiroki
2013/01/30 09:24:51
Done.
| |
54 | |
55 PP_DirectoryEntry_Dev* output_; | |
56 bool has_more_; | |
57 | |
58 scoped_refptr<TrackedCallback> callback_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(DirectoryReaderResource); | |
61 }; | |
62 | |
63 } // namespace proxy | |
64 } // namespace ppapi | |
65 | |
66 #endif // PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_ | |
OLD | NEW |