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

Side by Side Diff: content/browser/download/file_metadata_mac.mm

Issue 12286020: Replace FilePath with base::FilePath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file_path.h" 10 #include "base/file_path.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 [list addObject:referrer_url]; 89 [list addObject:referrer_url];
90 90
91 md_item_set_attribute_func(md_item, kMDItemWhereFroms, 91 md_item_set_attribute_func(md_item, kMDItemWhereFroms,
92 base::mac::NSToCFCast(list)); 92 base::mac::NSToCFCast(list));
93 } 93 }
94 94
95 // The OS will automatically quarantine files due to the 95 // The OS will automatically quarantine files due to the
96 // LSFileQuarantineEnabled entry in our Info.plist, but it knows relatively 96 // LSFileQuarantineEnabled entry in our Info.plist, but it knows relatively
97 // little about the files. We add more information about the download to 97 // little about the files. We add more information about the download to
98 // improve the UI shown by the OS when the users tries to open the file. 98 // improve the UI shown by the OS when the users tries to open the file.
99 void AddQuarantineMetadataToFile(const FilePath& file, const GURL& source, 99 void AddQuarantineMetadataToFile(const base::FilePath& file, const GURL& source,
100 const GURL& referrer) { 100 const GURL& referrer) {
101 FSRef file_ref; 101 FSRef file_ref;
102 if (!base::mac::FSRefFromPath(file.value(), &file_ref)) 102 if (!base::mac::FSRefFromPath(file.value(), &file_ref))
103 return; 103 return;
104 104
105 NSMutableDictionary* quarantine_properties = nil; 105 NSMutableDictionary* quarantine_properties = nil;
106 CFTypeRef quarantine_properties_base = NULL; 106 CFTypeRef quarantine_properties_base = NULL;
107 if (LSCopyItemAttribute(&file_ref, kLSRolesAll, kLSItemQuarantineProperties, 107 if (LSCopyItemAttribute(&file_ref, kLSRolesAll, kLSItemQuarantineProperties,
108 &quarantine_properties_base) == noErr) { 108 &quarantine_properties_base) == noErr) {
109 if (CFGetTypeID(quarantine_properties_base) == 109 if (CFGetTypeID(quarantine_properties_base) ==
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 OSStatus os_error = LSSetItemAttribute(&file_ref, kLSRolesAll, 159 OSStatus os_error = LSSetItemAttribute(&file_ref, kLSRolesAll,
160 kLSItemQuarantineProperties, 160 kLSItemQuarantineProperties,
161 quarantine_properties); 161 quarantine_properties);
162 if (os_error != noErr) { 162 if (os_error != noErr) {
163 OSSTATUS_LOG(WARNING, os_error) 163 OSSTATUS_LOG(WARNING, os_error)
164 << "Unable to set quarantine attributes on file " << file.value(); 164 << "Unable to set quarantine attributes on file " << file.value();
165 } 165 }
166 } 166 }
167 167
168 } // namespace content 168 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/child_process_security_policy_unittest.cc ('k') | content/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698