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" |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 const fileapi::FileSystemURL& file_system_url, | 623 const fileapi::FileSystemURL& file_system_url, |
624 base::PlatformFileError failure_error, | 624 base::PlatformFileError failure_error, |
625 base::FilePath* local_file_path) { | 625 base::FilePath* local_file_path) { |
626 DCHECK(IsOnTaskRunnerThread(context)); | 626 DCHECK(IsOnTaskRunnerThread(context)); |
627 base::FilePath file_path; | 627 base::FilePath file_path; |
628 base::PlatformFileError error = | 628 base::PlatformFileError error = |
629 GetLocalFilePath(context, file_system_url, &file_path); | 629 GetLocalFilePath(context, file_system_url, &file_path); |
630 if (error != base::PLATFORM_FILE_OK) | 630 if (error != base::PLATFORM_FILE_OK) |
631 return error; | 631 return error; |
632 | 632 |
633 if (!file_util::PathExists(file_path)) | 633 if (!base::PathExists(file_path)) |
634 return failure_error; | 634 return failure_error; |
635 base::PlatformFileInfo file_info; | 635 base::PlatformFileInfo file_info; |
636 if (!file_util::GetFileInfo(file_path, &file_info)) | 636 if (!file_util::GetFileInfo(file_path, &file_info)) |
637 return base::PLATFORM_FILE_ERROR_FAILED; | 637 return base::PLATFORM_FILE_ERROR_FAILED; |
638 | 638 |
639 if (!file_info.is_directory && | 639 if (!file_info.is_directory && |
640 !GetMediaPathFilter(context)->Match(file_path)) { | 640 !GetMediaPathFilter(context)->Match(file_path)) { |
641 return failure_error; | 641 return failure_error; |
642 } | 642 } |
643 | 643 |
644 *local_file_path = file_path; | 644 *local_file_path = file_path; |
645 return base::PLATFORM_FILE_OK; | 645 return base::PLATFORM_FILE_OK; |
646 } | 646 } |
647 | 647 |
648 } // namespace chrome | 648 } // namespace chrome |
OLD | NEW |