2 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, 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 COMPUTER, 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.
27 #include "WebKitDLL.h"
28 #include "WebNavigationData.h"
30 using namespace WebCore;
32 // IUnknown -------------------------------------------------------------------
34 HRESULT STDMETHODCALLTYPE WebNavigationData::QueryInterface(REFIID riid, void** ppvObject)
37 if (IsEqualGUID(riid, IID_IUnknown))
38 *ppvObject = static_cast<IWebNavigationData*>(this);
39 else if (IsEqualGUID(riid, IID_IWebNavigationData))
40 *ppvObject = static_cast<IWebNavigationData*>(this);
48 ULONG STDMETHODCALLTYPE WebNavigationData::AddRef(void)
53 ULONG STDMETHODCALLTYPE WebNavigationData::Release(void)
55 ULONG newRef = --m_refCount;
62 // WebNavigationData -------------------------------------------------------------------
64 WebNavigationData::WebNavigationData(const String& url, const String& title, IWebURLRequest* request, IWebURLResponse* response, bool hasSubstituteData, const String& clientRedirectSource)
69 , m_response(response)
70 , m_hasSubstituteData(hasSubstituteData)
71 , m_clientRedirectSource(clientRedirectSource)
75 gClassNameCount.add("WebNavigationData");
78 WebNavigationData::~WebNavigationData()
81 gClassNameCount.remove("WebNavigationData");
84 WebNavigationData* WebNavigationData::createInstance(const String& url, const String& title, IWebURLRequest* request, IWebURLResponse* response, bool hasSubstituteData, const String& clientRedirectSource)
86 WebNavigationData* instance = new WebNavigationData(url, title, request, response, hasSubstituteData, clientRedirectSource);
91 // IWebNavigationData -------------------------------------------------------------------
93 HRESULT WebNavigationData::url(BSTR* url)
97 *url = BString(m_url).release();
101 HRESULT WebNavigationData::title(BSTR* title)
105 *title = BString(m_title).release();
109 HRESULT WebNavigationData::originalRequest(IWebURLRequest** request)
113 *request = m_request.get();
118 HRESULT WebNavigationData::response(IWebURLResponse** response)
122 *response = m_response.get();
123 m_response->AddRef();
127 HRESULT WebNavigationData::hasSubstituteData(BOOL* hasSubstituteData)
129 if (!hasSubstituteData)
131 *hasSubstituteData = m_hasSubstituteData;
135 HRESULT WebNavigationData::clientRedirectSource(BSTR* clientRedirectSource)
137 if (!clientRedirectSource)
140 *clientRedirectSource = BString(m_clientRedirectSource).release();