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/ref_counted.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "content/common/content_export.h" | |
15 #include "ppapi/c/pp_file_info.h" | |
16 #include "ppapi/host/host_message_context.h" | |
17 #include "ppapi/host/resource_host.h" | |
18 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" | |
19 | |
20 namespace ppapi { | |
21 struct PPB_FileRef_CreateInfo; | |
22 } | |
23 | |
24 namespace content { | |
25 | |
26 class RendererPpapiHost; | |
27 | |
28 class CONTENT_EXPORT PepperDirectoryReaderHost | |
29 : public ppapi::host::ResourceHost { | |
30 public: | |
31 typedef std::vector<base::FileUtilProxy::Entry> Entries; | |
32 | |
33 PepperDirectoryReaderHost(RendererPpapiHost* host, | |
34 PP_Instance instance, | |
35 PP_Resource resource); | |
36 virtual ~PepperDirectoryReaderHost(); | |
37 | |
38 virtual int32_t OnResourceMessageReceived( | |
39 const IPC::Message& msg, | |
40 ppapi::host::HostMessageContext* context) OVERRIDE; | |
41 | |
42 private: | |
43 struct EntryData { | |
44 EntryData(); | |
yzshen1
2013/02/05 05:55:44
nit: do we have to have constructor and destructor
nhiroki
2013/02/05 08:24:37
I think these are necessary. Without them, a compi
| |
45 ~EntryData(); | |
46 scoped_refptr<webkit::ppapi::PPB_FileRef_Impl> file_ref; | |
47 PP_FileType file_type; | |
48 }; | |
49 | |
50 int32_t OnGetEntries(ppapi::host::HostMessageContext* host_context, | |
51 const ppapi::HostResource& resource); | |
52 void OnReadDirectory(const Entries& entries, bool has_more, int32_t result); | |
53 bool AddNewEntries(const Entries& entries); | |
54 | |
55 void SendGetEntriesReply(int32_t result); | |
56 | |
57 RendererPpapiHost* renderer_ppapi_host_; | |
58 ppapi::host::ReplyMessageContext reply_context_; | |
59 | |
60 scoped_refptr<webkit::ppapi::PPB_FileRef_Impl> directory_ref_; | |
61 | |
62 // Ensures that the resources are alive for as long as the host is. | |
63 std::vector<EntryData> entry_data_; | |
64 | |
65 base::WeakPtrFactory<PepperDirectoryReaderHost> weak_factory_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(PepperDirectoryReaderHost); | |
68 }; | |
69 | |
70 } | |
71 | |
72 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DIRECTORY_READER_HOST_H_ | |
OLD | NEW |