| 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 #include <utility> |
| 6 |
| 5 #include "chrome/browser/chromeos/extensions/file_system_provider/file_system_pr
ovider_api.h" | 7 #include "chrome/browser/chromeos/extensions/file_system_provider/file_system_pr
ovider_api.h" |
| 6 | |
| 7 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 8 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
| 8 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 9 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
| 9 #include "chrome/browser/chromeos/file_system_provider/request_value.h" | 10 #include "chrome/browser/chromeos/file_system_provider/request_value.h" |
| 10 #include "chrome/browser/chromeos/file_system_provider/service.h" | 11 #include "chrome/browser/chromeos/file_system_provider/service.h" |
| 11 #include "chrome/common/extensions/api/file_system_provider_internal.h" | 12 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
| 12 | 13 |
| 13 using chromeos::file_system_provider::ProvidedFileSystemInterface; | 14 using chromeos::file_system_provider::ProvidedFileSystemInterface; |
| 14 using chromeos::file_system_provider::RequestManager; | 15 using chromeos::file_system_provider::RequestManager; |
| 15 using chromeos::file_system_provider::RequestValue; | 16 using chromeos::file_system_provider::RequestValue; |
| 16 using chromeos::file_system_provider::Service; | 17 using chromeos::file_system_provider::Service; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 121 } |
| 121 | 122 |
| 122 FileSystemProviderInternalFunction::FileSystemProviderInternalFunction() | 123 FileSystemProviderInternalFunction::FileSystemProviderInternalFunction() |
| 123 : request_id_(0), request_manager_(NULL) { | 124 : request_id_(0), request_manager_(NULL) { |
| 124 } | 125 } |
| 125 | 126 |
| 126 bool FileSystemProviderInternalFunction::RejectRequest( | 127 bool FileSystemProviderInternalFunction::RejectRequest( |
| 127 scoped_ptr<chromeos::file_system_provider::RequestValue> value, | 128 scoped_ptr<chromeos::file_system_provider::RequestValue> value, |
| 128 base::File::Error error) { | 129 base::File::Error error) { |
| 129 const base::File::Error result = | 130 const base::File::Error result = |
| 130 request_manager_->RejectRequest(request_id_, value.Pass(), error); | 131 request_manager_->RejectRequest(request_id_, std::move(value), error); |
| 131 if (result != base::File::FILE_OK) { | 132 if (result != base::File::FILE_OK) { |
| 132 SetError(FileErrorToString(result)); | 133 SetError(FileErrorToString(result)); |
| 133 return false; | 134 return false; |
| 134 } | 135 } |
| 135 | 136 |
| 136 return true; | 137 return true; |
| 137 } | 138 } |
| 138 | 139 |
| 139 bool FileSystemProviderInternalFunction::FulfillRequest( | 140 bool FileSystemProviderInternalFunction::FulfillRequest( |
| 140 scoped_ptr<RequestValue> value, | 141 scoped_ptr<RequestValue> value, |
| 141 bool has_more) { | 142 bool has_more) { |
| 142 const base::File::Error result = | 143 const base::File::Error result = |
| 143 request_manager_->FulfillRequest(request_id_, value.Pass(), has_more); | 144 request_manager_->FulfillRequest(request_id_, std::move(value), has_more); |
| 144 if (result != base::File::FILE_OK) { | 145 if (result != base::File::FILE_OK) { |
| 145 SetError(FileErrorToString(result)); | 146 SetError(FileErrorToString(result)); |
| 146 return false; | 147 return false; |
| 147 } | 148 } |
| 148 | 149 |
| 149 return true; | 150 return true; |
| 150 } | 151 } |
| 151 | 152 |
| 152 bool FileSystemProviderInternalFunction::RunSync() { | 153 bool FileSystemProviderInternalFunction::RunSync() { |
| 153 DCHECK(args_); | 154 DCHECK(args_); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 176 if (!file_system) { | 177 if (!file_system) { |
| 177 SetError(FileErrorToString(base::File::FILE_ERROR_NOT_FOUND)); | 178 SetError(FileErrorToString(base::File::FILE_ERROR_NOT_FOUND)); |
| 178 return false; | 179 return false; |
| 179 } | 180 } |
| 180 | 181 |
| 181 request_manager_ = file_system->GetRequestManager(); | 182 request_manager_ = file_system->GetRequestManager(); |
| 182 return true; | 183 return true; |
| 183 } | 184 } |
| 184 | 185 |
| 185 } // namespace extensions | 186 } // namespace extensions |
| OLD | NEW |