OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/file_util_proxy.h" | 11 #include "base/file_util_proxy.h" |
12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
13 #include "ppapi/thunk/ppb_directory_reader_api.h" | 13 #include "ppapi/thunk/ppb_directory_reader_api.h" |
14 | 14 |
15 struct PP_CompletionCallback; | |
16 struct PP_DirectoryEntry_Dev; | 15 struct PP_DirectoryEntry_Dev; |
17 | 16 |
18 namespace webkit { | 17 namespace webkit { |
19 namespace ppapi { | 18 namespace ppapi { |
20 | 19 |
21 class PPB_FileRef_Impl; | 20 class PPB_FileRef_Impl; |
22 | 21 |
23 class PPB_DirectoryReader_Impl | 22 class PPB_DirectoryReader_Impl |
24 : public ::ppapi::Resource, | 23 : public ::ppapi::Resource, |
25 public ::ppapi::thunk::PPB_DirectoryReader_API { | 24 public ::ppapi::thunk::PPB_DirectoryReader_API { |
26 public: | 25 public: |
27 explicit PPB_DirectoryReader_Impl(PPB_FileRef_Impl* directory_ref); | 26 explicit PPB_DirectoryReader_Impl(PPB_FileRef_Impl* directory_ref); |
28 virtual ~PPB_DirectoryReader_Impl(); | 27 virtual ~PPB_DirectoryReader_Impl(); |
29 | 28 |
30 static PP_Resource Create(PP_Resource directory_ref); | 29 static PP_Resource Create(PP_Resource directory_ref); |
31 | 30 |
32 // Resource overrides. | 31 // Resource overrides. |
33 virtual ::ppapi::thunk::PPB_DirectoryReader_API* AsPPB_DirectoryReader_API() | 32 virtual ::ppapi::thunk::PPB_DirectoryReader_API* AsPPB_DirectoryReader_API() |
34 OVERRIDE; | 33 OVERRIDE; |
35 | 34 |
36 // PPB_DirectoryReader_API implementation. | 35 // PPB_DirectoryReader_API implementation. |
37 virtual int32_t GetNextEntry(PP_DirectoryEntry_Dev* entry, | 36 virtual int32_t GetNextEntry( |
38 PP_CompletionCallback callback) OVERRIDE; | 37 PP_DirectoryEntry_Dev* entry, |
| 38 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; |
39 | 39 |
40 void AddNewEntries(const std::vector<base::FileUtilProxy::Entry>& entries, | 40 void AddNewEntries(const std::vector<base::FileUtilProxy::Entry>& entries, |
41 bool has_more); | 41 bool has_more); |
42 | 42 |
43 private: | 43 private: |
44 bool FillUpEntry(); | 44 bool FillUpEntry(); |
45 | 45 |
46 scoped_refptr<PPB_FileRef_Impl> directory_ref_; | 46 scoped_refptr<PPB_FileRef_Impl> directory_ref_; |
47 std::queue<base::FileUtilProxy::Entry> entries_; | 47 std::queue<base::FileUtilProxy::Entry> entries_; |
48 bool has_more_; | 48 bool has_more_; |
49 PP_DirectoryEntry_Dev* entry_; | 49 PP_DirectoryEntry_Dev* entry_; |
50 }; | 50 }; |
51 | 51 |
52 } // namespace ppapi | 52 } // namespace ppapi |
53 } // namespace webkit | 53 } // namespace webkit |
54 | 54 |
55 #endif // WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ | 55 #endif // WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ |
OLD | NEW |