OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 #ifndef FILESYSTEM_PROVIDER_H |
| 5 #define FILESYSTEM_PROVIDER_H |
| 6 |
| 7 #include <string> |
| 8 #include <vector> |
| 9 |
| 10 #include "ppapi/c/dev/ppb_filesystemprovider_dev.h" |
| 11 #include "ppapi/cpp/resource.h" |
| 12 #include "ppapi/cpp/var_dictionary.h" |
| 13 #include "ppapi/cpp/var_array.h" |
| 14 |
| 15 namespace pp{ |
| 16 |
| 17 class CompletionCallback; |
| 18 template <class T> class CompletionCallbackWithOutput; |
| 19 class InstanceHandle; |
| 20 class Instance; |
| 21 |
| 22 class Filesystem_Provider_Dev : Resource { |
| 23 public: |
| 24 // Creates it but doesn't mount it |
| 25 Filesystem_Provider_Dev( pp::Instance *instance ); |
| 26 virtual ~Filesystem_Provider_Dev(); |
| 27 static bool IsAvailable(); |
| 28 |
| 29 // PPB_FilesystemProvider interfaces |
| 30 int32_t Mount( |
| 31 const std::string& filesystem_id, |
| 32 const std::string& display_name, |
| 33 bool writable, |
| 34 int32_t opened_files_limit, |
| 35 const CompletionCallback& cc ); |
| 36 int32_t Unmount( |
| 37 const std::string& filesystem_id, |
| 38 const CompletionCallback& cc ); |
| 39 int32_t Notify(const VarDictionary& options_notify); |
| 40 |
| 41 // Response for requests |
| 42 int32_t SendSuccessResponse( |
| 43 const PP_OperationType_Dev operation_type, |
| 44 int32_t request_id); |
| 45 int32_t SendErrorResponse( |
| 46 const PP_OperationType_Dev& operation_type, |
| 47 int32_t error, |
| 48 int32_t request_id); |
| 49 // Special Responses |
| 50 int32_t SendMetadataSuccessResponse( |
| 51 const VarDictionary& metadata, |
| 52 int32_t request_id); |
| 53 int32_t SendReadDirectorySuccessResponse( |
| 54 const VarArray& entries, |
| 55 bool has_more, |
| 56 int32_t request_id ); |
| 57 int32_t SendReadFileSuccessResponse( |
| 58 uint32_t data_size, |
| 59 const char* data, |
| 60 bool has_more, |
| 61 int32_t request_id ); |
| 62 int32_t GetNextRequest( |
| 63 const CompletionCallbackWithOutput<PP_FilesystemRequest>& cc); |
| 64 int32_t ReleaseRequestBuffer(int32_t request_id); |
| 65 |
| 66 protected: |
| 67 InstanceHandle associated_instance_; |
| 68 |
| 69 }; // class Filesystem_Provider_Dev |
| 70 |
| 71 } // namespace pp |
| 72 |
| 73 #endif // FILESYSTEM_PROVIDER_H |
| 74 |
OLD | NEW |