OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/media_galleries/fileapi/media_file_system_backend.h" | 5 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 return NULL; | 320 return NULL; |
320 } | 321 } |
321 | 322 |
322 storage::FileSystemOperation* MediaFileSystemBackend::CreateFileSystemOperation( | 323 storage::FileSystemOperation* MediaFileSystemBackend::CreateFileSystemOperation( |
323 const FileSystemURL& url, | 324 const FileSystemURL& url, |
324 FileSystemContext* context, | 325 FileSystemContext* context, |
325 base::File::Error* error_code) const { | 326 base::File::Error* error_code) const { |
326 scoped_ptr<storage::FileSystemOperationContext> operation_context( | 327 scoped_ptr<storage::FileSystemOperationContext> operation_context( |
327 new storage::FileSystemOperationContext(context, | 328 new storage::FileSystemOperationContext(context, |
328 media_task_runner_.get())); | 329 media_task_runner_.get())); |
329 return storage::FileSystemOperation::Create( | 330 return storage::FileSystemOperation::Create(url, context, |
330 url, context, operation_context.Pass()); | 331 std::move(operation_context)); |
331 } | 332 } |
332 | 333 |
333 bool MediaFileSystemBackend::SupportsStreaming( | 334 bool MediaFileSystemBackend::SupportsStreaming( |
334 const storage::FileSystemURL& url) const { | 335 const storage::FileSystemURL& url) const { |
335 if (url.type() == storage::kFileSystemTypeDeviceMedia) { | 336 if (url.type() == storage::kFileSystemTypeDeviceMedia) { |
336 DCHECK(device_media_async_file_util_); | 337 DCHECK(device_media_async_file_util_); |
337 return device_media_async_file_util_->SupportsStreaming(url); | 338 return device_media_async_file_util_->SupportsStreaming(url); |
338 } | 339 } |
339 | 340 |
340 return false; | 341 return false; |
(...skipping 15 matching lines...) Expand all Loading... |
356 int64_t offset, | 357 int64_t offset, |
357 int64_t max_bytes_to_read, | 358 int64_t max_bytes_to_read, |
358 const base::Time& expected_modification_time, | 359 const base::Time& expected_modification_time, |
359 FileSystemContext* context) const { | 360 FileSystemContext* context) const { |
360 if (url.type() == storage::kFileSystemTypeDeviceMedia) { | 361 if (url.type() == storage::kFileSystemTypeDeviceMedia) { |
361 DCHECK(device_media_async_file_util_); | 362 DCHECK(device_media_async_file_util_); |
362 scoped_ptr<storage::FileStreamReader> reader = | 363 scoped_ptr<storage::FileStreamReader> reader = |
363 device_media_async_file_util_->GetFileStreamReader( | 364 device_media_async_file_util_->GetFileStreamReader( |
364 url, offset, expected_modification_time, context); | 365 url, offset, expected_modification_time, context); |
365 DCHECK(reader); | 366 DCHECK(reader); |
366 return reader.Pass(); | 367 return reader; |
367 } | 368 } |
368 | 369 |
369 return scoped_ptr<storage::FileStreamReader>( | 370 return scoped_ptr<storage::FileStreamReader>( |
370 storage::FileStreamReader::CreateForLocalFile( | 371 storage::FileStreamReader::CreateForLocalFile( |
371 context->default_file_task_runner(), | 372 context->default_file_task_runner(), |
372 url.path(), | 373 url.path(), |
373 offset, | 374 offset, |
374 expected_modification_time)); | 375 expected_modification_time)); |
375 } | 376 } |
376 | 377 |
(...skipping 22 matching lines...) Expand all Loading... |
399 | 400 |
400 const storage::ChangeObserverList* MediaFileSystemBackend::GetChangeObservers( | 401 const storage::ChangeObserverList* MediaFileSystemBackend::GetChangeObservers( |
401 storage::FileSystemType type) const { | 402 storage::FileSystemType type) const { |
402 return NULL; | 403 return NULL; |
403 } | 404 } |
404 | 405 |
405 const storage::AccessObserverList* MediaFileSystemBackend::GetAccessObservers( | 406 const storage::AccessObserverList* MediaFileSystemBackend::GetAccessObservers( |
406 storage::FileSystemType type) const { | 407 storage::FileSystemType type) const { |
407 return NULL; | 408 return NULL; |
408 } | 409 } |
OLD | NEW |