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