OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_SYSTEM_PROVIDER_PROVIDER_FUNCTIO
N_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_SYSTEM_PROVIDER_PROVIDER_FUNCTIO
N_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_SYSTEM_PROVIDER_PROVIDER_FUNCTIO
N_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_SYSTEM_PROVIDER_PROVIDER_FUNCTIO
N_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 FileSystemProviderInternalFunction(); | 57 FileSystemProviderInternalFunction(); |
58 | 58 |
59 protected: | 59 protected: |
60 virtual ~FileSystemProviderInternalFunction() {} | 60 virtual ~FileSystemProviderInternalFunction() {} |
61 | 61 |
62 // Rejects the request and sets a response for this API function. | 62 // Rejects the request and sets a response for this API function. |
63 void RejectRequest(base::File::Error error); | 63 void RejectRequest(base::File::Error error); |
64 | 64 |
65 // Fulfills the request with parsed arguments of this API function | 65 // Fulfills the request with parsed arguments of this API function |
66 // encapsulated as a RequestValue instance. Also, sets a response. | 66 // encapsulated as a RequestValue instance. Also, sets a response. |
67 // If |has_next| is set to true, then the function will be called again for | 67 // If |has_more| is set to true, then the function will be called again for |
68 // this request. | 68 // this request. |
69 void FulfillRequest( | 69 void FulfillRequest( |
70 scoped_ptr<chromeos::file_system_provider::RequestValue> value, | 70 scoped_ptr<chromeos::file_system_provider::RequestValue> value, |
71 bool has_next); | 71 bool has_more); |
72 | 72 |
73 // Subclasses implement this for their functionality. | 73 // Subclasses implement this for their functionality. |
74 // Called after Parse() is successful, such that |request_id_| and | 74 // Called after Parse() is successful, such that |request_id_| and |
75 // |request_manager_| have been fully initialized. | 75 // |request_manager_| have been fully initialized. |
76 virtual bool RunWhenValid() = 0; | 76 virtual bool RunWhenValid() = 0; |
77 | 77 |
78 // ChromeSyncExtensionFunction overrides. | 78 // ChromeSyncExtensionFunction overrides. |
79 virtual bool RunSync() OVERRIDE; | 79 virtual bool RunSync() OVERRIDE; |
80 | 80 |
81 private: | 81 private: |
82 // Parses the request in order to extract the request manager. If fails, then | 82 // Parses the request in order to extract the request manager. If fails, then |
83 // sets a response and returns false. | 83 // sets a response and returns false. |
84 bool Parse(); | 84 bool Parse(); |
85 | 85 |
86 // Sets an error message in case of a failure. | 86 // Sets an error message in case of a failure. |
87 void SetErrorResponse(const std::string& name, const std::string& message); | 87 void SetErrorResponse(const std::string& name, const std::string& message); |
88 | 88 |
89 int request_id_; | 89 int request_id_; |
90 chromeos::file_system_provider::RequestManager* request_manager_; | 90 chromeos::file_system_provider::RequestManager* request_manager_; |
91 }; | 91 }; |
92 | 92 |
93 } // namespace extensions | 93 } // namespace extensions |
94 | 94 |
95 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_SYSTEM_PROVIDER_PROVIDER_FUNC
TION_H_ | 95 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_SYSTEM_PROVIDER_PROVIDER_FUNC
TION_H_ |
OLD | NEW |