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 CONTENT_RENDERER_PEPPER_PEPPER_DIRECTORY_READER_HOST_H_ | |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_DIRECTORY_READER_HOST_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/files/file_util_proxy.h" | |
12 #include "base/memory/weak_ptr.h" | |
13 #include "content/common/content_export.h" | |
14 #include "ppapi/c/pp_file_info.h" | |
15 #include "ppapi/host/host_message_context.h" | |
16 #include "ppapi/host/resource_host.h" | |
17 | |
18 namespace ppapi { | |
19 struct PPB_FileRef_CreateInfo; | |
20 } | |
21 | |
22 namespace webkit { | |
23 namespace ppapi { | |
24 class PPB_FileRef_Impl; | |
25 } | |
26 } | |
27 | |
28 namespace content { | |
29 | |
30 class RendererPpapiHost; | |
31 | |
32 class CONTENT_EXPORT PepperDirectoryReaderHost | |
33 : public ppapi::host::ResourceHost { | |
34 public: | |
35 typedef std::vector<base::FileUtilProxy::Entry> Entries; | |
36 | |
37 PepperDirectoryReaderHost(RendererPpapiHost* host, | |
38 PP_Instance instance, | |
39 PP_Resource resource); | |
40 virtual ~PepperDirectoryReaderHost(); | |
41 | |
42 virtual int32_t OnResourceMessageReceived( | |
43 const IPC::Message& msg, | |
44 ppapi::host::HostMessageContext* context) OVERRIDE; | |
45 | |
46 private: | |
47 int32_t OnGetEntries(ppapi::host::HostMessageContext* host_context, | |
48 ppapi::HostResource resource); | |
yzshen1
2013/01/31 08:50:54
Maybe use const ref?
nhiroki
2013/02/01 08:19:47
Done.
| |
49 void OnReadDirectory(const Entries& entries, bool has_more, int32_t result); | |
50 bool AddNewEntries(const Entries& entries, bool has_more); | |
51 void SendGetEntriesReply(int32_t result); | |
52 | |
53 RendererPpapiHost* renderer_ppapi_host_; | |
54 ppapi::host::ReplyMessageContext reply_context_; | |
55 | |
56 scoped_refptr<webkit::ppapi::PPB_FileRef_Impl> directory_ref_; | |
yzshen1
2013/01/31 08:50:54
nit: please include what you use.
nhiroki
2013/02/01 08:19:47
Done.
| |
57 | |
58 // Ensures that the resources are alive for as long as the host is. | |
59 std::vector<scoped_refptr<webkit::ppapi::PPB_FileRef_Impl> > file_refs_; | |
60 | |
61 std::vector<ppapi::PPB_FileRef_CreateInfo> host_resources_; | |
62 std::vector<PP_FileType> file_types_; | |
63 | |
64 base::WeakPtrFactory<PepperDirectoryReaderHost> weak_factory_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(PepperDirectoryReaderHost); | |
67 }; | |
68 | |
69 } | |
70 | |
71 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DIRECTORY_READER_HOST_H_ | |
OLD | NEW |