| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/native_media_file_util.h" | 5 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/files/file_enumerator.h" | 11 #include "base/files/file_enumerator.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/task_runner_util.h" | 14 #include "base/task_runner_util.h" |
| 15 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" | 15 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" |
| 16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
| 18 #include "net/base/mime_sniffer.h" | 18 #include "net/base/mime_sniffer.h" |
| 19 #include "storage/browser/blob/shareable_file_reference.h" |
| 19 #include "storage/browser/fileapi/file_system_context.h" | 20 #include "storage/browser/fileapi/file_system_context.h" |
| 20 #include "storage/browser/fileapi/file_system_operation_context.h" | 21 #include "storage/browser/fileapi/file_system_operation_context.h" |
| 21 #include "storage/browser/fileapi/native_file_util.h" | 22 #include "storage/browser/fileapi/native_file_util.h" |
| 22 #include "storage/common/blob/shareable_file_reference.h" | |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // Returns true if the current thread is capable of doing IO. | 27 // Returns true if the current thread is capable of doing IO. |
| 28 bool IsOnTaskRunnerThread(storage::FileSystemOperationContext* context) { | 28 bool IsOnTaskRunnerThread(storage::FileSystemOperationContext* context) { |
| 29 return context->task_runner()->RunsTasksOnCurrentThread(); | 29 return context->task_runner()->RunsTasksOnCurrentThread(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 base::File::Error IsMediaHeader(const char* buf, size_t length) { | 32 base::File::Error IsMediaHeader(const char* buf, size_t length) { |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 return base::File::FILE_ERROR_FAILED; | 671 return base::File::FILE_ERROR_FAILED; |
| 672 | 672 |
| 673 if (!file_info.is_directory && | 673 if (!file_info.is_directory && |
| 674 !media_path_filter_->Match(file_path)) { | 674 !media_path_filter_->Match(file_path)) { |
| 675 return failure_error; | 675 return failure_error; |
| 676 } | 676 } |
| 677 | 677 |
| 678 *local_file_path = file_path; | 678 *local_file_path = file_path; |
| 679 return base::File::FILE_OK; | 679 return base::File::FILE_OK; |
| 680 } | 680 } |
| OLD | NEW |