| 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> | 5 #include <utility> |
| 6 | 6 |
| 7 #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" |
| 8 #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" |
| 9 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 9 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
| 10 #include "chrome/browser/chromeos/file_system_provider/request_value.h" | 10 #include "chrome/browser/chromeos/file_system_provider/request_value.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 std::string FileErrorToString(base::File::Error error) { | 118 std::string FileErrorToString(base::File::Error error) { |
| 119 return extensions::api::file_system_provider::ToString( | 119 return extensions::api::file_system_provider::ToString( |
| 120 FileErrorToProviderError(error)); | 120 FileErrorToProviderError(error)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 FileSystemProviderInternalFunction::FileSystemProviderInternalFunction() | 123 FileSystemProviderInternalFunction::FileSystemProviderInternalFunction() |
| 124 : request_id_(0), request_manager_(NULL) { | 124 : request_id_(0), request_manager_(NULL) { |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool FileSystemProviderInternalFunction::RejectRequest( | 127 bool FileSystemProviderInternalFunction::RejectRequest( |
| 128 scoped_ptr<chromeos::file_system_provider::RequestValue> value, | 128 std::unique_ptr<chromeos::file_system_provider::RequestValue> value, |
| 129 base::File::Error error) { | 129 base::File::Error error) { |
| 130 const base::File::Error result = | 130 const base::File::Error result = |
| 131 request_manager_->RejectRequest(request_id_, std::move(value), error); | 131 request_manager_->RejectRequest(request_id_, std::move(value), error); |
| 132 if (result != base::File::FILE_OK) { | 132 if (result != base::File::FILE_OK) { |
| 133 SetError(FileErrorToString(result)); | 133 SetError(FileErrorToString(result)); |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| 136 | 136 |
| 137 return true; | 137 return true; |
| 138 } | 138 } |
| 139 | 139 |
| 140 bool FileSystemProviderInternalFunction::FulfillRequest( | 140 bool FileSystemProviderInternalFunction::FulfillRequest( |
| 141 scoped_ptr<RequestValue> value, | 141 std::unique_ptr<RequestValue> value, |
| 142 bool has_more) { | 142 bool has_more) { |
| 143 const base::File::Error result = | 143 const base::File::Error result = |
| 144 request_manager_->FulfillRequest(request_id_, std::move(value), has_more); | 144 request_manager_->FulfillRequest(request_id_, std::move(value), has_more); |
| 145 if (result != base::File::FILE_OK) { | 145 if (result != base::File::FILE_OK) { |
| 146 SetError(FileErrorToString(result)); | 146 SetError(FileErrorToString(result)); |
| 147 return false; | 147 return false; |
| 148 } | 148 } |
| 149 | 149 |
| 150 return true; | 150 return true; |
| 151 } | 151 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 177 if (!file_system) { | 177 if (!file_system) { |
| 178 SetError(FileErrorToString(base::File::FILE_ERROR_NOT_FOUND)); | 178 SetError(FileErrorToString(base::File::FILE_ERROR_NOT_FOUND)); |
| 179 return false; | 179 return false; |
| 180 } | 180 } |
| 181 | 181 |
| 182 request_manager_ = file_system->GetRequestManager(); | 182 request_manager_ = file_system->GetRequestManager(); |
| 183 return true; | 183 return true; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace extensions | 186 } // namespace extensions |
| OLD | NEW |