OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/file_util_proxy.h" | 10 #include "base/file_util_proxy.h" |
| 11 #include "ppapi/thunk/ppb_directory_reader_api.h" |
11 #include "webkit/plugins/ppapi/resource.h" | 12 #include "webkit/plugins/ppapi/resource.h" |
12 | 13 |
13 struct PP_CompletionCallback; | 14 struct PP_CompletionCallback; |
14 struct PP_DirectoryEntry_Dev; | 15 struct PP_DirectoryEntry_Dev; |
15 struct PPB_DirectoryReader_Dev; | 16 struct PPB_DirectoryReader_Dev; |
16 | 17 |
17 namespace webkit { | 18 namespace webkit { |
18 namespace ppapi { | 19 namespace ppapi { |
19 | 20 |
20 class PPB_FileRef_Impl; | 21 class PPB_FileRef_Impl; |
21 | 22 |
22 class PPB_DirectoryReader_Impl : public Resource { | 23 class PPB_DirectoryReader_Impl |
| 24 : public Resource, |
| 25 public ::ppapi::thunk::PPB_DirectoryReader_API { |
23 public: | 26 public: |
24 explicit PPB_DirectoryReader_Impl(PPB_FileRef_Impl* directory_ref); | 27 explicit PPB_DirectoryReader_Impl(PPB_FileRef_Impl* directory_ref); |
25 virtual ~PPB_DirectoryReader_Impl(); | 28 virtual ~PPB_DirectoryReader_Impl(); |
26 | 29 |
27 // Returns a pointer to the interface implementing PPB_DirectoryReader that | 30 static PP_Resource Create(PP_Resource directory_ref); |
28 // is exposed to the plugin. | |
29 static const PPB_DirectoryReader_Dev* GetInterface(); | |
30 | 31 |
31 // Resource overrides. | 32 // Resource overrides. |
32 virtual PPB_DirectoryReader_Impl* AsPPB_DirectoryReader_Impl(); | 33 virtual PPB_DirectoryReader_Impl* AsPPB_DirectoryReader_Impl() OVERRIDE; |
33 | 34 |
34 // PPB_DirectoryReader implementation. | 35 // ResourceObjectBase overrides. |
35 int32_t GetNextEntry(PP_DirectoryEntry_Dev* entry, | 36 virtual ::ppapi::thunk::PPB_DirectoryReader_API* AsPPB_DirectoryReader_API() |
36 PP_CompletionCallback callback); | 37 OVERRIDE; |
| 38 |
| 39 // PPB_DirectoryReader_API implementation. |
| 40 virtual int32_t GetNextEntry(PP_DirectoryEntry_Dev* entry, |
| 41 PP_CompletionCallback callback) OVERRIDE; |
37 | 42 |
38 void AddNewEntries(const std::vector<base::FileUtilProxy::Entry>& entries, | 43 void AddNewEntries(const std::vector<base::FileUtilProxy::Entry>& entries, |
39 bool has_more); | 44 bool has_more); |
40 | 45 |
41 private: | 46 private: |
42 bool FillUpEntry(); | 47 bool FillUpEntry(); |
43 | 48 |
44 scoped_refptr<PPB_FileRef_Impl> directory_ref_; | 49 scoped_refptr<PPB_FileRef_Impl> directory_ref_; |
45 std::queue<base::FileUtilProxy::Entry> entries_; | 50 std::queue<base::FileUtilProxy::Entry> entries_; |
46 bool has_more_; | 51 bool has_more_; |
47 PP_DirectoryEntry_Dev* entry_; | 52 PP_DirectoryEntry_Dev* entry_; |
48 }; | 53 }; |
49 | 54 |
50 } // namespace ppapi | 55 } // namespace ppapi |
51 } // namespace webkit | 56 } // namespace webkit |
52 | 57 |
53 #endif // WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ | 58 #endif // WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ |
OLD | NEW |