| 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_GLUE_PLUGINS_PEPPER_DIRECTORY_READER_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_DIRECTORY_READER_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 "webkit/glue/plugins/pepper_resource.h" | 11 #include "webkit/plugins/ppapi/resource.h" |
| 12 | 12 |
| 13 struct PP_CompletionCallback; | 13 struct PP_CompletionCallback; |
| 14 struct PP_DirectoryEntry_Dev; | 14 struct PP_DirectoryEntry_Dev; |
| 15 struct PPB_DirectoryReader_Dev; | 15 struct PPB_DirectoryReader_Dev; |
| 16 | 16 |
| 17 namespace pepper { | 17 namespace webkit { |
| 18 namespace plugins { |
| 19 namespace ppapi { |
| 18 | 20 |
| 19 class FileRef; | 21 class PPB_FileRef_Impl; |
| 20 | 22 |
| 21 class DirectoryReader : public Resource { | 23 class PPB_DirectoryReader_Impl : public Resource { |
| 22 public: | 24 public: |
| 23 explicit DirectoryReader(FileRef* directory_ref); | 25 explicit PPB_DirectoryReader_Impl(PPB_FileRef_Impl* directory_ref); |
| 24 virtual ~DirectoryReader(); | 26 virtual ~PPB_DirectoryReader_Impl(); |
| 25 | 27 |
| 26 // Returns a pointer to the interface implementing PPB_DirectoryReader that | 28 // Returns a pointer to the interface implementing PPB_DirectoryReader that |
| 27 // is exposed to the plugin. | 29 // is exposed to the plugin. |
| 28 static const PPB_DirectoryReader_Dev* GetInterface(); | 30 static const PPB_DirectoryReader_Dev* GetInterface(); |
| 29 | 31 |
| 30 // Resource overrides. | 32 // Resource overrides. |
| 31 virtual DirectoryReader* AsDirectoryReader(); | 33 virtual PPB_DirectoryReader_Impl* AsDirectoryReader(); |
| 32 | 34 |
| 33 // PPB_DirectoryReader implementation. | 35 // PPB_DirectoryReader implementation. |
| 34 int32_t GetNextEntry(PP_DirectoryEntry_Dev* entry, | 36 int32_t GetNextEntry(PP_DirectoryEntry_Dev* entry, |
| 35 PP_CompletionCallback callback); | 37 PP_CompletionCallback callback); |
| 36 | 38 |
| 37 void AddNewEntries(const std::vector<base::FileUtilProxy::Entry>& entries, | 39 void AddNewEntries(const std::vector<base::FileUtilProxy::Entry>& entries, |
| 38 bool has_more); | 40 bool has_more); |
| 39 | 41 |
| 40 private: | 42 private: |
| 41 bool FillUpEntry(); | 43 bool FillUpEntry(); |
| 42 | 44 |
| 43 scoped_refptr<FileRef> directory_ref_; | 45 scoped_refptr<PPB_FileRef_Impl> directory_ref_; |
| 44 std::queue<base::FileUtilProxy::Entry> entries_; | 46 std::queue<base::FileUtilProxy::Entry> entries_; |
| 45 bool has_more_; | 47 bool has_more_; |
| 46 PP_DirectoryEntry_Dev* entry_; | 48 PP_DirectoryEntry_Dev* entry_; |
| 47 }; | 49 }; |
| 48 | 50 |
| 49 } // namespace pepper | 51 } // namespace ppapi |
| 52 } // namespace plugins |
| 53 } // namespace webkit |
| 50 | 54 |
| 51 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_DIRECTORY_READER_H_ | 55 #endif // WEBKIT_PLUGINS_PPAPI_PPB_DIRECTORY_READER_IMPL_H_ |
| OLD | NEW |