Index: runtime/bin/directory.h |
diff --git a/runtime/bin/directory.h b/runtime/bin/directory.h |
index 9455bbbc7c2f65fd4a04c1eb1c6939ea3f0132be..a2921ddbb54c7ddbcd02cea43deb44bede9da1c6 100644 |
--- a/runtime/bin/directory.h |
+++ b/runtime/bin/directory.h |
@@ -12,6 +12,16 @@ |
class DirectoryListing { |
public: |
+ virtual bool HandleDirectory(char* dir_name) = 0; |
+ virtual bool HandleFile(char* file_name) = 0; |
+ virtual bool HandleError(const char* dir_name) = 0; |
+ |
+ virtual ~DirectoryListing() {} |
+}; |
+ |
+ |
+class DirectoryAsyncListing : public DirectoryListing { |
Mads Ager (google)
2013/01/04 10:00:25
Can we make this AsyncDirectoryListing? I think th
Bill Hesse
2013/01/04 13:49:27
Done.
|
+ public: |
enum Response { |
kListDirectory = 0, |
kListFile = 1, |
@@ -19,17 +29,43 @@ class DirectoryListing { |
kListDone = 3 |
}; |
- explicit DirectoryListing(Dart_Port response_port) |
+ explicit DirectoryAsyncListing(Dart_Port response_port) |
: response_port_(response_port) {} |
- bool HandleDirectory(char* dir_name); |
- bool HandleFile(char* file_name); |
- bool HandleError(const char* dir_name); |
+ virtual bool HandleDirectory(char* dir_name); |
+ virtual bool HandleFile(char* file_name); |
+ virtual bool HandleError(const char* dir_name); |
+ virtual ~DirectoryAsyncListing() {} |
Mads Ager (google)
2013/01/04 10:00:25
Destructor above methods, please.
http://google-s
Bill Hesse
2013/01/04 13:49:27
Done.
|
private: |
CObjectArray* NewResponse(Response response, char* arg); |
Dart_Port response_port_; |
- DISALLOW_IMPLICIT_CONSTRUCTORS(DirectoryListing); |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(DirectoryAsyncListing); |
+}; |
+ |
+ |
+class DirectorySyncListing: public DirectoryListing { |
Mads Ager (google)
2013/01/04 10:00:25
SyncDirectoryListing?
Bill Hesse
2013/01/04 13:49:27
Done.
|
+ public: |
+ explicit DirectorySyncListing(Dart_Handle results) |
+ : results_(results) { |
+ add_ = DartUtils::NewString("add"); |
Mads Ager (google)
2013/01/04 10:00:25
add_string_?
Bill Hesse
2013/01/04 13:49:27
Done.
|
+ directory_class_ = |
+ DartUtils::GetDartClass(DartUtils::kIOLibURL, "Directory"); |
+ file_class_ = |
+ DartUtils::GetDartClass(DartUtils::kIOLibURL, "File"); |
+ } |
+ virtual bool HandleDirectory(char* dir_name); |
+ virtual bool HandleFile(char* file_name); |
+ virtual bool HandleError(const char* dir_name); |
+ |
+ virtual ~DirectorySyncListing() {} |
Mads Ager (google)
2013/01/04 10:00:25
Destructor before methods, please.
Bill Hesse
2013/01/04 13:49:27
Done.
|
+ private: |
+ Dart_Handle results_; |
+ Dart_Handle add_; |
+ Dart_Handle directory_class_; |
+ Dart_Handle file_class_; |
+ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(DirectorySyncListing); |
}; |