OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/extensions/file_system_provider/file_system_pr
ovider_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_system_provider/file_system_pr
ovider_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" | 15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" |
15 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
16 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 17 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
17 #include "chrome/browser/chromeos/file_system_provider/request_value.h" | 18 #include "chrome/browser/chromeos/file_system_provider/request_value.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 277 } |
277 | 278 |
278 SendResponse(true); | 279 SendResponse(true); |
279 } | 280 } |
280 | 281 |
281 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunWhenValid() { | 282 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunWhenValid() { |
282 using api::file_system_provider_internal::UnmountRequestedSuccess::Params; | 283 using api::file_system_provider_internal::UnmountRequestedSuccess::Params; |
283 scoped_ptr<Params> params(Params::Create(*args_)); | 284 scoped_ptr<Params> params(Params::Create(*args_)); |
284 EXTENSION_FUNCTION_VALIDATE(params); | 285 EXTENSION_FUNCTION_VALIDATE(params); |
285 | 286 |
286 return FulfillRequest(RequestValue::CreateForUnmountSuccess(params.Pass()), | 287 return FulfillRequest( |
287 false /* has_more */); | 288 RequestValue::CreateForUnmountSuccess(std::move(params)), |
| 289 false /* has_more */); |
288 } | 290 } |
289 | 291 |
290 bool | 292 bool |
291 FileSystemProviderInternalGetMetadataRequestedSuccessFunction::RunWhenValid() { | 293 FileSystemProviderInternalGetMetadataRequestedSuccessFunction::RunWhenValid() { |
292 using api::file_system_provider_internal::GetMetadataRequestedSuccess::Params; | 294 using api::file_system_provider_internal::GetMetadataRequestedSuccess::Params; |
293 scoped_ptr<Params> params(Params::Create(*args_)); | 295 scoped_ptr<Params> params(Params::Create(*args_)); |
294 EXTENSION_FUNCTION_VALIDATE(params); | 296 EXTENSION_FUNCTION_VALIDATE(params); |
295 | 297 |
296 return FulfillRequest( | 298 return FulfillRequest( |
297 RequestValue::CreateForGetMetadataSuccess(params.Pass()), | 299 RequestValue::CreateForGetMetadataSuccess(std::move(params)), |
298 false /* has_more */); | 300 false /* has_more */); |
299 } | 301 } |
300 | 302 |
301 bool FileSystemProviderInternalGetActionsRequestedSuccessFunction:: | 303 bool FileSystemProviderInternalGetActionsRequestedSuccessFunction:: |
302 RunWhenValid() { | 304 RunWhenValid() { |
303 using api::file_system_provider_internal::GetActionsRequestedSuccess::Params; | 305 using api::file_system_provider_internal::GetActionsRequestedSuccess::Params; |
304 scoped_ptr<Params> params(Params::Create(*args_)); | 306 scoped_ptr<Params> params(Params::Create(*args_)); |
305 EXTENSION_FUNCTION_VALIDATE(params); | 307 EXTENSION_FUNCTION_VALIDATE(params); |
306 | 308 |
307 return FulfillRequest(RequestValue::CreateForGetActionsSuccess(params.Pass()), | 309 return FulfillRequest( |
308 false /* has_more */); | 310 RequestValue::CreateForGetActionsSuccess(std::move(params)), |
| 311 false /* has_more */); |
309 } | 312 } |
310 | 313 |
311 bool FileSystemProviderInternalReadDirectoryRequestedSuccessFunction:: | 314 bool FileSystemProviderInternalReadDirectoryRequestedSuccessFunction:: |
312 RunWhenValid() { | 315 RunWhenValid() { |
313 using api::file_system_provider_internal::ReadDirectoryRequestedSuccess:: | 316 using api::file_system_provider_internal::ReadDirectoryRequestedSuccess:: |
314 Params; | 317 Params; |
315 scoped_ptr<Params> params(Params::Create(*args_)); | 318 scoped_ptr<Params> params(Params::Create(*args_)); |
316 EXTENSION_FUNCTION_VALIDATE(params); | 319 EXTENSION_FUNCTION_VALIDATE(params); |
317 | 320 |
318 const bool has_more = params->has_more; | 321 const bool has_more = params->has_more; |
319 return FulfillRequest( | 322 return FulfillRequest( |
320 RequestValue::CreateForReadDirectorySuccess(params.Pass()), has_more); | 323 RequestValue::CreateForReadDirectorySuccess(std::move(params)), has_more); |
321 } | 324 } |
322 | 325 |
323 bool | 326 bool |
324 FileSystemProviderInternalReadFileRequestedSuccessFunction::RunWhenValid() { | 327 FileSystemProviderInternalReadFileRequestedSuccessFunction::RunWhenValid() { |
325 TRACE_EVENT0("file_system_provider", "ReadFileRequestedSuccess"); | 328 TRACE_EVENT0("file_system_provider", "ReadFileRequestedSuccess"); |
326 using api::file_system_provider_internal::ReadFileRequestedSuccess::Params; | 329 using api::file_system_provider_internal::ReadFileRequestedSuccess::Params; |
327 | 330 |
328 scoped_ptr<Params> params(Params::Create(*args_)); | 331 scoped_ptr<Params> params(Params::Create(*args_)); |
329 EXTENSION_FUNCTION_VALIDATE(params); | 332 EXTENSION_FUNCTION_VALIDATE(params); |
330 | 333 |
331 const bool has_more = params->has_more; | 334 const bool has_more = params->has_more; |
332 return FulfillRequest(RequestValue::CreateForReadFileSuccess(params.Pass()), | 335 return FulfillRequest( |
333 has_more); | 336 RequestValue::CreateForReadFileSuccess(std::move(params)), has_more); |
334 } | 337 } |
335 | 338 |
336 bool | 339 bool |
337 FileSystemProviderInternalOperationRequestedSuccessFunction::RunWhenValid() { | 340 FileSystemProviderInternalOperationRequestedSuccessFunction::RunWhenValid() { |
338 using api::file_system_provider_internal::OperationRequestedSuccess::Params; | 341 using api::file_system_provider_internal::OperationRequestedSuccess::Params; |
339 scoped_ptr<Params> params(Params::Create(*args_)); | 342 scoped_ptr<Params> params(Params::Create(*args_)); |
340 EXTENSION_FUNCTION_VALIDATE(params); | 343 EXTENSION_FUNCTION_VALIDATE(params); |
341 | 344 |
342 return FulfillRequest( | 345 return FulfillRequest( |
343 scoped_ptr<RequestValue>( | 346 scoped_ptr<RequestValue>( |
344 RequestValue::CreateForOperationSuccess(params.Pass())), | 347 RequestValue::CreateForOperationSuccess(std::move(params))), |
345 false /* has_more */); | 348 false /* has_more */); |
346 } | 349 } |
347 | 350 |
348 bool FileSystemProviderInternalOperationRequestedErrorFunction::RunWhenValid() { | 351 bool FileSystemProviderInternalOperationRequestedErrorFunction::RunWhenValid() { |
349 using api::file_system_provider_internal::OperationRequestedError::Params; | 352 using api::file_system_provider_internal::OperationRequestedError::Params; |
350 scoped_ptr<Params> params(Params::Create(*args_)); | 353 scoped_ptr<Params> params(Params::Create(*args_)); |
351 EXTENSION_FUNCTION_VALIDATE(params); | 354 EXTENSION_FUNCTION_VALIDATE(params); |
352 | 355 |
353 const base::File::Error error = ProviderErrorToFileError(params->error); | 356 const base::File::Error error = ProviderErrorToFileError(params->error); |
354 return RejectRequest(RequestValue::CreateForOperationError(params.Pass()), | 357 return RejectRequest(RequestValue::CreateForOperationError(std::move(params)), |
355 error); | 358 error); |
356 } | 359 } |
357 | 360 |
358 } // namespace extensions | 361 } // namespace extensions |
OLD | NEW |