1/*
2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#import "WebNavigationData.h"
27
28@interface WebNavigationDataPrivate : NSObject
29{
30@public
31    NSString *url;
32    NSString *title;
33    NSURLRequest *originalRequest;
34    NSURLResponse *response;
35    BOOL hasSubstituteData;
36    NSString *clientRedirectSource;
37}
38
39@end
40
41@implementation WebNavigationDataPrivate
42
43- (void)dealloc
44{
45    [url release];
46    [title release];
47    [originalRequest release];
48    [response release];
49    [clientRedirectSource release];
50
51    [super dealloc];
52}
53
54@end
55
56@implementation WebNavigationData
57
58- (id)initWithURLString:(NSString *)url title:(NSString *)title originalRequest:(NSURLRequest *)request response:(NSURLResponse *)response hasSubstituteData:(BOOL)hasSubstituteData clientRedirectSource:(NSString *)redirectSource
59{
60    self = [super init];
61    if (!self)
62        return nil;
63    _private = [[WebNavigationDataPrivate alloc] init];
64
65    _private->url = [url retain];
66    _private->title = [title retain];
67    _private->originalRequest = [request retain];
68    _private->response = [response retain];
69    _private->hasSubstituteData = hasSubstituteData;
70    _private->clientRedirectSource = [redirectSource retain];
71
72    return self;
73}
74
75- (NSString *)url
76{
77    return _private->url;
78}
79
80- (NSString *)title
81{
82    return _private->title;
83}
84
85- (NSURLRequest *)originalRequest
86{
87    return _private->originalRequest;
88}
89
90- (NSURLResponse *)response
91{
92    return _private->response;
93}
94
95- (BOOL)hasSubstituteData
96{
97    return _private->hasSubstituteData;
98}
99
100- (NSString *)clientRedirectSource
101{
102    return _private->clientRedirectSource;
103}
104
105- (void)dealloc
106{
107    [_private release];
108    [super dealloc];
109}
110
111@end
112