1f845c74c6243a10ee5df2af003dcf81bbd0b51a0Daniel Dunbar/*
28fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman * Copyright (C) 2009 Google Inc. All rights reserved.
38fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman *
48fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman * Redistribution and use in source and binary forms, with or without
58fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman * modification, are permitted provided that the following conditions are
68fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman * met:
78fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman *
88fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman *     * Redistributions of source code must retain the above copyright
98fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman * notice, this list of conditions and the following disclaimer.
10ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer *     * Redistributions in binary form must reproduce the above
111f6efa3996dd1929fbc129203ce5009b620e6969Michael J. Spencer * copyright notice, this list of conditions and the following disclaimer
128fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman * in the documentation and/or other materials provided with the
138fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman * distribution.
14ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer *     * Neither the name of Google Inc. nor the names of its
15ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * contributors may be used to endorse or promote products derived from
166d600da7346bf898cfbe8f6030051f10d157fcd4NAKAMURA Takumi * this software without specific prior written permission.
17ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer *
18ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
228fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
248fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer */
30ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer
31ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer#ifndef GenericBinding_h
3243b04fa17e2836ba6c55d1dd28f8d75dff451e70Francois Pichet#define GenericBinding_h
3343b04fa17e2836ba6c55d1dd28f8d75dff451e70Francois Pichet
3443b04fa17e2836ba6c55d1dd28f8d75dff451e70Francois Pichet#include "Frame.h"
3543b04fa17e2836ba6c55d1dd28f8d75dff451e70Francois Pichet#include "FrameLoader.h"
3643b04fa17e2836ba6c55d1dd28f8d75dff451e70Francois Pichet
3743b04fa17e2836ba6c55d1dd28f8d75dff451e70Francois Pichetnamespace WebCore {
38ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer
39ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer// Used to instantiate binding templates for any methods shared among all
40ddfce8f95b4e2cf9b899d1a4f2105d12ede0a155Michael J. Spencer// language bindings.
418fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukmanclass GenericBinding {};
428fb520eb4f06d4ef771abe9c22d85b2a275988eeMisha Brukman
43// Class to represent execution state for each language binding.
44template <class T>
45class State {};
46
47// Common notion of execution state for language bindings.
48template <>
49class State<GenericBinding> {
50    // Any methods shared across bindings can go here.
51};
52
53template <class Binding>
54KURL completeURL(State<Binding>* state, const String& relativeURL)
55{
56    // For historical reasons, we need to complete the URL using the
57    // dynamic frame.
58    Frame* frame = state->firstFrame();
59    if (!frame)
60        return KURL();
61    return frame->loader()->completeURL(relativeURL);
62}
63
64}
65
66#endif // GenericBinding_h
67