| 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 <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "chrome/browser/extensions/chrome_extension_function.h" | 12 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 13 #include "chrome/common/extensions/api/file_system_provider.h" | 13 #include "chrome/common/extensions/api/file_system_provider.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 } // namespace base | 17 } // namespace base |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 namespace file_system_provider { | 20 namespace file_system_provider { |
| 21 | 21 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 class FileSystemProviderInternalFunction : public ChromeSyncExtensionFunction { | 53 class FileSystemProviderInternalFunction : public ChromeSyncExtensionFunction { |
| 54 public: | 54 public: |
| 55 FileSystemProviderInternalFunction(); | 55 FileSystemProviderInternalFunction(); |
| 56 | 56 |
| 57 protected: | 57 protected: |
| 58 ~FileSystemProviderInternalFunction() override {} | 58 ~FileSystemProviderInternalFunction() override {} |
| 59 | 59 |
| 60 // Rejects the request and sets a response for this API function. Returns true | 60 // Rejects the request and sets a response for this API function. Returns true |
| 61 // on success, and false on failure. | 61 // on success, and false on failure. |
| 62 bool RejectRequest( | 62 bool RejectRequest( |
| 63 scoped_ptr<chromeos::file_system_provider::RequestValue> value, | 63 std::unique_ptr<chromeos::file_system_provider::RequestValue> value, |
| 64 base::File::Error error); | 64 base::File::Error error); |
| 65 | 65 |
| 66 // Fulfills the request with parsed arguments of this API function | 66 // Fulfills the request with parsed arguments of this API function |
| 67 // encapsulated as a RequestValue instance. Also, sets a response. | 67 // encapsulated as a RequestValue instance. Also, sets a response. |
| 68 // If |has_more| is set to true, then the function will be called again for | 68 // If |has_more| is set to true, then the function will be called again for |
| 69 // this request. Returns true on success, and false on failure. | 69 // this request. Returns true on success, and false on failure. |
| 70 bool FulfillRequest( | 70 bool FulfillRequest( |
| 71 scoped_ptr<chromeos::file_system_provider::RequestValue> value, | 71 std::unique_ptr<chromeos::file_system_provider::RequestValue> value, |
| 72 bool has_more); | 72 bool has_more); |
| 73 | 73 |
| 74 // Subclasses implement this for their functionality. | 74 // Subclasses implement this for their functionality. |
| 75 // Called after Parse() is successful, such that |request_id_| and | 75 // Called after Parse() is successful, such that |request_id_| and |
| 76 // |request_manager_| have been fully initialized. | 76 // |request_manager_| have been fully initialized. |
| 77 virtual bool RunWhenValid() = 0; | 77 virtual bool RunWhenValid() = 0; |
| 78 | 78 |
| 79 // ChromeSyncExtensionFunction overrides. | 79 // ChromeSyncExtensionFunction overrides. |
| 80 bool RunSync() override; | 80 bool RunSync() override; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 // Parses the request in order to extract the request manager. If fails, then | 83 // Parses the request in order to extract the request manager. If fails, then |
| 84 // sets a response and returns false. | 84 // sets a response and returns false. |
| 85 bool Parse(); | 85 bool Parse(); |
| 86 | 86 |
| 87 int request_id_; | 87 int request_id_; |
| 88 chromeos::file_system_provider::RequestManager* request_manager_; | 88 chromeos::file_system_provider::RequestManager* request_manager_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace extensions | 91 } // namespace extensions |
| 92 | 92 |
| 93 #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 |