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

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

Issue 23064011: Consolidate scheme checks into an easy GURL method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
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/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // We don't want to add any metadata, because that will cause the file to 125 // We don't want to add any metadata, because that will cause the file to
126 // be quarantined against the user's wishes. 126 // be quarantined against the user's wishes.
127 return; 127 return;
128 } 128 }
129 129
130 // kLSQuarantineAgentNameKey, kLSQuarantineAgentBundleIdentifierKey, and 130 // kLSQuarantineAgentNameKey, kLSQuarantineAgentBundleIdentifierKey, and
131 // kLSQuarantineTimeStampKey are set for us (see LSQuarantine.h), so we only 131 // kLSQuarantineTimeStampKey are set for us (see LSQuarantine.h), so we only
132 // need to set the values that the OS can't infer. 132 // need to set the values that the OS can't infer.
133 133
134 if (![quarantine_properties valueForKey:(NSString*)kLSQuarantineTypeKey]) { 134 if (![quarantine_properties valueForKey:(NSString*)kLSQuarantineTypeKey]) {
135 CFStringRef type = (source.SchemeIs("http") || source.SchemeIs("https")) 135 CFStringRef type = source.SchemeIsHTTPOrHTTPS()
136 ? kLSQuarantineTypeWebDownload 136 ? kLSQuarantineTypeWebDownload
137 : kLSQuarantineTypeOtherDownload; 137 : kLSQuarantineTypeOtherDownload;
138 [quarantine_properties setValue:(NSString*)type 138 [quarantine_properties setValue:(NSString*)type
139 forKey:(NSString*)kLSQuarantineTypeKey]; 139 forKey:(NSString*)kLSQuarantineTypeKey];
140 } 140 }
141 141
142 if (![quarantine_properties 142 if (![quarantine_properties
143 valueForKey:(NSString*)kLSQuarantineOriginURLKey] && 143 valueForKey:(NSString*)kLSQuarantineOriginURLKey] &&
144 referrer.is_valid()) { 144 referrer.is_valid()) {
145 NSString* referrer_url = 145 NSString* referrer_url =
(...skipping 13 matching lines...) Expand all
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 | « chrome_frame/test/net/test_automation_provider.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698