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 "content/browser/download/file_metadata_mac.h" | 5 #include "content/browser/download/file_metadata_mac.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <Foundation/Foundation.h> | 8 #include <Foundation/Foundation.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 | 159 |
160 OSStatus os_error = LSSetItemAttribute(&file_ref, kLSRolesAll, | 160 OSStatus os_error = LSSetItemAttribute(&file_ref, kLSRolesAll, |
161 kLSItemQuarantineProperties, | 161 kLSItemQuarantineProperties, |
162 quarantine_properties); | 162 quarantine_properties); |
163 if (os_error != noErr) { | 163 if (os_error != noErr) { |
164 OSSTATUS_LOG(WARNING, os_error) | 164 OSSTATUS_LOG(WARNING, os_error) |
165 << "Unable to set quarantine attributes on file " << file.value(); | 165 << "Unable to set quarantine attributes on file " << file.value(); |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 void SetExtensionHiddenForFile(const base::FilePath& file, bool hidden) { | |
170 NSString* filePath = | |
171 [NSString stringWithUTF8String:file.value().c_str()]; | |
172 if (filePath) { | |
173 NSNumber* boolNumber = [NSNumber numberWithBool:hidden ? YES : NO]; | |
Avi (use Gerrit)
2015/12/12 00:41:46
bool ? YES : NO is not useful; bools convert as 1
shrike
2015/12/16 19:04:12
Acknowledged.
| |
174 NSDictionary* attributes = | |
175 [NSDictionary dictionaryWithObject:boolNumber | |
176 forKey:NSFileExtensionHidden]; | |
Avi (use Gerrit)
2015/12/12 00:41:46
NSDictionary* attributes = @{ NSFileExtensionHidde
shrike
2015/12/16 19:04:12
Done.
| |
177 [[NSFileManager defaultManager] setAttributes:attributes | |
178 ofItemAtPath:filePath | |
179 error:nullptr]; | |
180 } | |
181 } | |
182 | |
169 } // namespace content | 183 } // namespace content |
OLD | NEW |