Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Unified Diff: content/browser/download/file_metadata_mac.mm

Issue 1513413002: Enable "Hide Extension" option when "Save Link As" on the Mac Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/download/file_metadata_mac.mm
diff --git a/content/browser/download/file_metadata_mac.mm b/content/browser/download/file_metadata_mac.mm
index f4ae3c9750943adc0b88b14dfeafde35f09be680..02bb755444bd609be69543c440467b313de40379 100644
--- a/content/browser/download/file_metadata_mac.mm
+++ b/content/browser/download/file_metadata_mac.mm
@@ -166,4 +166,18 @@ void AddQuarantineMetadataToFile(const base::FilePath& file, const GURL& source,
}
}
+void SetExtensionHiddenForFile(const base::FilePath& file, bool hidden) {
+ NSString* filePath =
+ [NSString stringWithUTF8String:file.value().c_str()];
+ if (filePath) {
+ 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.
+ NSDictionary* attributes =
+ [NSDictionary dictionaryWithObject:boolNumber
+ forKey:NSFileExtensionHidden];
Avi (use Gerrit) 2015/12/12 00:41:46 NSDictionary* attributes = @{ NSFileExtensionHidde
shrike 2015/12/16 19:04:12 Done.
+ [[NSFileManager defaultManager] setAttributes:attributes
+ ofItemAtPath:filePath
+ error:nullptr];
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698