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/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/files/file_enumerator.h" | 12 #include "base/files/file_enumerator.h" |
13 #include "base/files/scoped_platform_file_closer.h" | 13 #include "base/files/scoped_platform_file_closer.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
16 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" | 16 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "net/base/mime_sniffer.h" | 18 #include "net/base/mime_sniffer.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 #include "webkit/browser/fileapi/file_system_context.h" | 20 #include "webkit/browser/fileapi/file_system_context.h" |
21 #include "webkit/browser/fileapi/file_system_operation_context.h" | 21 #include "webkit/browser/fileapi/file_system_operation_context.h" |
22 #include "webkit/browser/fileapi/native_file_util.h" | 22 #include "webkit/browser/fileapi/native_file_util.h" |
23 #include "webkit/common/blob/shareable_file_reference.h" | 23 #include "webkit/common/blob/shareable_file_reference.h" |
24 | 24 |
25 namespace chrome { | |
26 | |
27 namespace { | 25 namespace { |
28 | 26 |
29 // Used to skip the hidden folders and files. Returns true if the file specified | 27 // Used to skip the hidden folders and files. Returns true if the file specified |
30 // by |path| should be skipped. | 28 // by |path| should be skipped. |
31 bool ShouldSkip(const base::FilePath& path) { | 29 bool ShouldSkip(const base::FilePath& path) { |
32 const base::FilePath::StringType base_name = path.BaseName().value(); | 30 const base::FilePath::StringType base_name = path.BaseName().value(); |
33 if (base_name.empty()) | 31 if (base_name.empty()) |
34 return false; | 32 return false; |
35 | 33 |
36 // Dot files (aka hidden files) | 34 // Dot files (aka hidden files) |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 return base::PLATFORM_FILE_ERROR_FAILED; | 616 return base::PLATFORM_FILE_ERROR_FAILED; |
619 | 617 |
620 if (!file_info.is_directory && | 618 if (!file_info.is_directory && |
621 !media_path_filter_->Match(file_path)) { | 619 !media_path_filter_->Match(file_path)) { |
622 return failure_error; | 620 return failure_error; |
623 } | 621 } |
624 | 622 |
625 *local_file_path = file_path; | 623 *local_file_path = file_path; |
626 return base::PLATFORM_FILE_OK; | 624 return base::PLATFORM_FILE_OK; |
627 } | 625 } |
628 | |
629 } // namespace chrome | |
OLD | NEW |