OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/file_select_helper.h" | 5 #include "chrome/browser/file_select_helper.h" |
6 | 6 |
7 #include <Cocoa/Cocoa.h> | 7 #include <Cocoa/Cocoa.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 int result = -1; | 82 int result = -1; |
83 if (success) | 83 if (success) |
84 result = fchmod(file.GetPlatformFile(), S_IRUSR); | 84 result = fchmod(file.GetPlatformFile(), S_IRUSR); |
85 | 85 |
86 return result >= 0 ? dest : base::FilePath(); | 86 return result >= 0 ? dest : base::FilePath(); |
87 } | 87 } |
88 | 88 |
89 void FileSelectHelper::ProcessSelectedFilesMac( | 89 void FileSelectHelper::ProcessSelectedFilesMac( |
90 const std::vector<ui::SelectedFileInfo>& files) { | 90 const std::vector<ui::SelectedFileInfo>& files) { |
91 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE_USER_BLOCKING); | |
92 | |
93 // Make a mutable copy of the input files. | 91 // Make a mutable copy of the input files. |
94 std::vector<ui::SelectedFileInfo> files_out(files); | 92 std::vector<ui::SelectedFileInfo> files_out(files); |
95 std::vector<base::FilePath> temporary_files; | 93 std::vector<base::FilePath> temporary_files; |
96 | 94 |
97 for (auto& file_info : files_out) { | 95 for (auto& file_info : files_out) { |
98 NSString* filename = base::mac::FilePathToNSString(file_info.local_path); | 96 NSString* filename = base::mac::FilePathToNSString(file_info.local_path); |
99 BOOL isPackage = | 97 BOOL isPackage = |
100 [[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename]; | 98 [[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename]; |
101 if (isPackage && base::DirectoryExists(file_info.local_path)) { | 99 if (isPackage && base::DirectoryExists(file_info.local_path)) { |
102 base::FilePath result = ZipPackage(file_info.local_path); | 100 base::FilePath result = ZipPackage(file_info.local_path); |
(...skipping 30 matching lines...) Expand all Loading... |
133 // need to be deleted now. | 131 // need to be deleted now. |
134 if (!web_contents_) { | 132 if (!web_contents_) { |
135 DeleteTemporaryFiles(); | 133 DeleteTemporaryFiles(); |
136 RunFileChooserEnd(); | 134 RunFileChooserEnd(); |
137 return; | 135 return; |
138 } | 136 } |
139 } | 137 } |
140 | 138 |
141 NotifyRenderFrameHostAndEnd(files); | 139 NotifyRenderFrameHostAndEnd(files); |
142 } | 140 } |
OLD | NEW |