Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: ppapi/proxy/directory_reader_resource.h

Issue 11958033: Implement Pepper proxy for PPB_DirectoryReader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix resource management Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/thunk/ppb_directory_reader_api.h"
18
19 namespace ppapi {
20
21 class TrackedCallback;
22
23 namespace proxy {
24
25 class PPAPI_PROXY_EXPORT DirectoryReaderResource
26 : public PluginResource,
27 public NON_EXPORTED_BASE(thunk::PPB_DirectoryReader_API) {
28 public:
29 DirectoryReaderResource(Connection connection,
30 PP_Instance instance,
31 PP_Resource directory_ref);
32 virtual ~DirectoryReaderResource();
33
34 // Resource overrides.
35 virtual thunk::PPB_DirectoryReader_API* AsPPB_DirectoryReader_API() OVERRIDE;
36
37 // PPB_DirectoryReader_API.
38 virtual int32_t GetNextEntry(
39 PP_DirectoryEntry_Dev* entry,
40 scoped_refptr<TrackedCallback> callback) OVERRIDE;
41
42 private:
43 struct DirectoryEntry {
44 scoped_refptr<Resource> file_resource;
45 PP_FileType file_type;
46 };
47
48 void OnPluginMsgGetEntriesReply(
49 const ResourceMessageReplyParams& params,
50 const std::vector<ppapi::PPB_FileRef_CreateInfo>& infos,
51 const std::vector<PP_FileType>& file_types);
52 bool FillUpEntry();
53
54 scoped_refptr<Resource> directory_resource_;
55 std::queue<DirectoryEntry> entries_;
56
57 PP_DirectoryEntry_Dev* output_;
58 bool has_more_;
59
60 scoped_refptr<TrackedCallback> callback_;
61
62 DISALLOW_COPY_AND_ASSIGN(DirectoryReaderResource);
63 };
64
65 } // namespace proxy
66 } // namespace ppapi
67
68 #endif // PPAPI_PROXY_DIRECTORY_READER_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698