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/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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/mac/mac_logging.h" | 12 #include "base/mac/mac_logging.h" |
13 #include "base/mac/mac_util.h" | 13 #include "base/mac/mac_util.h" |
14 #include "base/mac/scoped_cftyperef.h" | 14 #include "base/mac/scoped_cftyperef.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 | 16 |
17 namespace file_metadata { | 17 namespace content { |
18 | 18 |
19 // As of Mac OS X 10.4 ("Tiger"), files can be tagged with metadata describing | 19 // As of Mac OS X 10.4 ("Tiger"), files can be tagged with metadata describing |
20 // various attributes. Metadata is integrated with the system's Spotlight | 20 // various attributes. Metadata is integrated with the system's Spotlight |
21 // feature and is searchable. Ordinarily, metadata can only be set by | 21 // feature and is searchable. Ordinarily, metadata can only be set by |
22 // Spotlight importers, which requires that the importer own the target file. | 22 // Spotlight importers, which requires that the importer own the target file. |
23 // However, there's an attribute intended to describe the origin of a | 23 // However, there's an attribute intended to describe the origin of a |
24 // file, that can store the source URL and referrer of a downloaded file. | 24 // file, that can store the source URL and referrer of a downloaded file. |
25 // It's stored as a "com.apple.metadata:kMDItemWhereFroms" extended attribute, | 25 // It's stored as a "com.apple.metadata:kMDItemWhereFroms" extended attribute, |
26 // structured as a binary1-format plist containing a list of sources. This | 26 // structured as a binary1-format plist containing a list of sources. This |
27 // attribute can only be populated by the downloader, not a Spotlight importer. | 27 // attribute can only be populated by the downloader, not a Spotlight importer. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
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 file_metadata | 168 } // namespace content |
OLD | NEW |