~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2008 Apple Inc. All rights reserved.
 
2
 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
3
3
 *
4
4
 * Redistribution and use in source and binary forms, with or without
5
5
 * modification, are permitted provided that the following conditions
33
33
 
34
34
static const NSString *LegacyWebArchiveResourceResponseKey = @"WebResourceResponse";
35
35
 
36
 
// FIXME: Is it possible to parse in a Cocoa-style resource response manually, 
37
 
// without NSKeyed(Un)Archiver, manipulating plists directly?
38
 
ResourceResponse createResourceResponseFromMacArchivedData(CFDataRef responseData)
 
36
// FIXME: If is is possible to parse in a serialized NSURLResponse manually, without using
 
37
// NSKeyedUnarchiver, manipulating plists directly, we would prefer to do that instead.
 
38
ResourceResponse LegacyWebArchive::createResourceResponseFromMacArchivedData(CFDataRef responseData)
39
39
{    
40
40
    ASSERT(responseData);
41
41
    if (!responseData)
56
56
    return ResourceResponse(response);
57
57
}
58
58
 
59
 
RetainPtr<CFDataRef> propertyListDataFromResourceResponse(const ResourceResponse& response)
 
59
RetainPtr<CFDataRef> LegacyWebArchive::createPropertyListRepresentation(const ResourceResponse& response)
60
60
{    
61
61
    NSURLResponse *nsResponse = response.nsURLResponse();
 
62
    ASSERT(nsResponse);
62
63
    if (!nsResponse)
63
64
        return 0;
64
 
        
65
 
    NSMutableData *responseData = (NSMutableData *)CFDataCreateMutable(0, 0);
66
 
    NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:responseData];
 
65
 
 
66
    CFMutableDataRef responseData = CFDataCreateMutable(0, 0);
 
67
 
 
68
    NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:(NSMutableData *)responseData];
67
69
    [archiver encodeObject:nsResponse forKey:LegacyWebArchiveResourceResponseKey];
68
70
    [archiver finishEncoding];
69
71
    [archiver release];
70
72
    
71
 
    return RetainPtr<CFDataRef>(AdoptCF, (CFDataRef)responseData);
 
73
    return RetainPtr<CFDataRef>(AdoptCF, responseData);
72
74
}
73
75
 
74
76
}