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

Side by Side Diff: third_party/mozilla/NSURL+Utils.m

Issue 2391653003: [Mac Fix-It] Removed usage of deprecated resource fork API. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* ***** BEGIN LICENSE BLOCK ***** 1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 * 3 *
4 * The contents of this file are subject to the Mozilla Public License Version 4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with 5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at 6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/ 7 * http://www.mozilla.org/MPL/
8 * 8 *
9 * Software distributed under the License is distributed on an "AS IS" basis, 9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 return url; 58 return url;
59 } 59 }
60 60
61 // 61 //
62 // Reads the URL from a .webloc/.ftploc file. 62 // Reads the URL from a .webloc/.ftploc file.
63 // Returns the URL, or nil on failure. 63 // Returns the URL, or nil on failure.
64 // 64 //
65 +(NSURL*)URLFromInetloc:(NSString*)inFile 65 +(NSURL*)URLFromInetloc:(NSString*)inFile
66 { 66 {
67 FSRef ref; 67 //// Begin Google Modified
Avi (use Gerrit) 2016/10/06 03:26:16 Indent 2.
Eugene But (OOO till 7-30) 2016/10/06 03:40:50 Done. Sorry about that.
68 NSURL *ret = nil; 68 NSDictionary *plist = [NSDictionary dictionaryWithContentsOfFile:inFile];
69 69 return [NSURL URLWithString:[plist objectForKey:@"URL"]];
70 if (inFile && FSPathMakeRef((UInt8 *)[inFile fileSystemRepresentation], &ref, NULL) == noErr) { 70 //// End Google Modified
71 short resRef;
72
73 resRef = FSOpenResFile(&ref, fsRdPerm);
74
75 if (resRef != -1) { // Has resouce fork.
76 Handle urlResHandle;
77
78 if ((urlResHandle = Get1Resource('url ', 256))) { // Has 'url ' resource w ith ID 256.
79 long size;
80
81 size = GetMaxResourceSize(urlResHandle);
82 // Begin Google Modified
83 // ret = [NSURL URLWithString:[NSString stringWithCString:(char *)*urlRes Handle length:size]];
84 NSString *urlString = [[[NSString alloc] initWithBytes:(void *)*urlResHa ndle
85 length:size
86 encoding:NSMacOSRomanStrin gEncoding] // best guess here
87 autorelease];
88 ret = [NSURL URLWithString:urlString];
89 // End Google Modified
90 }
91
92 CloseResFile(resRef);
93 }
94
95 if (!ret) { // Look for valid plist data.
96 NSDictionary *plist;
97 if ((plist = [[NSDictionary alloc] initWithContentsOfFile:inFile])) {
98 ret = [NSURL URLWithString:[plist objectForKey:@"URL"]];
99 [plist release];
100 }
101 }
102 }
103
104 return ret;
105 } 71 }
106 72
107 // 73 //
108 // Reads the URL from a .url file. 74 // Reads the URL from a .url file.
109 // Returns the URL or nil on failure. 75 // Returns the URL or nil on failure.
110 // 76 //
111 +(NSURL*)URLFromIEURLFile:(NSString*)inFile 77 +(NSURL*)URLFromIEURLFile:(NSString*)inFile
112 { 78 {
113 NSURL *ret = nil; 79 NSURL *ret = nil;
114 80
(...skipping 24 matching lines...) Expand all
139 break; 105 break;
140 } 106 }
141 } 107 }
142 } 108 }
143 } 109 }
144 110
145 return ret; 111 return ret;
146 } 112 }
147 113
148 @end 114 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698