| 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" | |
| 12 #include "webkit/plugins/ppapi/resource.h" | 11 #include "webkit/plugins/ppapi/resource.h" |
| 13 | 12 |
| 14 struct PP_CompletionCallback; | 13 struct PP_CompletionCallback; |
| 15 struct PP_DirectoryEntry_Dev; | 14 struct PP_DirectoryEntry_Dev; |
| 16 struct PPB_DirectoryReader_Dev; | 15 struct PPB_DirectoryReader_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 : public Resource { |
| 24 : public Resource, | |
| 25 public ::ppapi::thunk::PPB_DirectoryReader_API { | |
| 26 public: | 23 public: |
| 27 explicit PPB_DirectoryReader_Impl(PPB_FileRef_Impl* directory_ref); | 24 explicit PPB_DirectoryReader_Impl(PPB_FileRef_Impl* directory_ref); |
| 28 virtual ~PPB_DirectoryReader_Impl(); | 25 virtual ~PPB_DirectoryReader_Impl(); |
| 29 | 26 |
| 30 static PP_Resource Create(PP_Resource directory_ref); | 27 // Returns a pointer to the interface implementing PPB_DirectoryReader that |
| 28 // is exposed to the plugin. |
| 29 static const PPB_DirectoryReader_Dev* GetInterface(); |
| 31 | 30 |
| 32 // Resource overrides. | 31 // Resource overrides. |
| 33 virtual PPB_DirectoryReader_Impl* AsPPB_DirectoryReader_Impl() OVERRIDE; | 32 virtual PPB_DirectoryReader_Impl* AsPPB_DirectoryReader_Impl(); |
| 34 | 33 |
| 35 // ResourceObjectBase overrides. | 34 // PPB_DirectoryReader implementation. |
| 36 virtual ::ppapi::thunk::PPB_DirectoryReader_API* AsPPB_DirectoryReader_API() | 35 int32_t GetNextEntry(PP_DirectoryEntry_Dev* entry, |
| 37 OVERRIDE; | 36 PP_CompletionCallback callback); |
| 38 | |
| 39 // PPB_DirectoryReader_API implementation. | |
| 40 virtual int32_t GetNextEntry(PP_DirectoryEntry_Dev* entry, | |
| 41 PP_CompletionCallback callback) OVERRIDE; | |
| 42 | 37 |
| 43 void AddNewEntries(const std::vector<base::FileUtilProxy::Entry>& entries, | 38 void AddNewEntries(const std::vector<base::FileUtilProxy::Entry>& entries, |
| 44 bool has_more); | 39 bool has_more); |
| 45 | 40 |
| 46 private: | 41 private: |
| 47 bool FillUpEntry(); | 42 bool FillUpEntry(); |
| 48 | 43 |
| 49 scoped_refptr<PPB_FileRef_Impl> directory_ref_; | 44 scoped_refptr<PPB_FileRef_Impl> directory_ref_; |
| 50 std::queue<base::FileUtilProxy::Entry> entries_; | 45 std::queue<base::FileUtilProxy::Entry> entries_; |
| 51 bool has_more_; | 46 bool has_more_; |
| 52 PP_DirectoryEntry_Dev* entry_; | 47 PP_DirectoryEntry_Dev* entry_; |
| 53 }; | 48 }; |
| 54 | 49 |
| 55 } // namespace ppapi | 50 } // namespace ppapi |
| 56 } // namespace webkit | 51 } // namespace webkit |
| 57 | 52 |
| 58 #endif // WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ | 53 #endif // WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ |
| OLD | NEW |