18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
2cad810f21b803229eb11403f9209855525a25d57Steve Block * Copyright (C) 2008, 2010 Apple Inc. All rights reserved.
38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without
58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions
68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met:
78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1.  Redistributions of source code must retain the above copyright
98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *     notice, this list of conditions and the following disclaimer.
108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2.  Redistributions in binary form must reproduce the above copyright
118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *     notice, this list of conditions and the following disclaimer in the
128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *     documentation and/or other materials provided with the distribution.
138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *     its contributors may be used to endorse or promote products derived
158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *     from this software without specific prior written permission.
168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */
288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef Location_h
308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define Location_h
318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include <wtf/PassRefPtr.h>
338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include <wtf/RefCounted.h>
34e48d279609693b4d164199748c93ad791547c649Steve Block#include <wtf/text/WTFString.h>
358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore {
378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
38cad810f21b803229eb11403f9209855525a25d57Steve Blockclass DOMWindow;
39cad810f21b803229eb11403f9209855525a25d57Steve Blockclass Frame;
40cad810f21b803229eb11403f9209855525a25d57Steve Blockclass KURL;
418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
42cad810f21b803229eb11403f9209855525a25d57Steve Blocktypedef int ExceptionCode;
438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
44cad810f21b803229eb11403f9209855525a25d57Steve Blockclass Location : public RefCounted<Location> {
45cad810f21b803229eb11403f9209855525a25d57Steve Blockpublic:
46cad810f21b803229eb11403f9209855525a25d57Steve Block    static PassRefPtr<Location> create(Frame* frame) { return adoptRef(new Location(frame)); }
478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
48cad810f21b803229eb11403f9209855525a25d57Steve Block    Frame* frame() const { return m_frame; }
49cad810f21b803229eb11403f9209855525a25d57Steve Block    void disconnectFrame();
508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
51cad810f21b803229eb11403f9209855525a25d57Steve Block    void setHref(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
52cad810f21b803229eb11403f9209855525a25d57Steve Block    String href() const;
538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
54cad810f21b803229eb11403f9209855525a25d57Steve Block    void assign(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
55cad810f21b803229eb11403f9209855525a25d57Steve Block    void replace(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
56cad810f21b803229eb11403f9209855525a25d57Steve Block    void reload(DOMWindow* activeWindow);
578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
58cad810f21b803229eb11403f9209855525a25d57Steve Block    void setProtocol(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow, ExceptionCode&);
59cad810f21b803229eb11403f9209855525a25d57Steve Block    String protocol() const;
60cad810f21b803229eb11403f9209855525a25d57Steve Block    void setHost(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
61cad810f21b803229eb11403f9209855525a25d57Steve Block    String host() const;
62cad810f21b803229eb11403f9209855525a25d57Steve Block    void setHostname(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
63cad810f21b803229eb11403f9209855525a25d57Steve Block    String hostname() const;
64cad810f21b803229eb11403f9209855525a25d57Steve Block    void setPort(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
65cad810f21b803229eb11403f9209855525a25d57Steve Block    String port() const;
66cad810f21b803229eb11403f9209855525a25d57Steve Block    void setPathname(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
67cad810f21b803229eb11403f9209855525a25d57Steve Block    String pathname() const;
68cad810f21b803229eb11403f9209855525a25d57Steve Block    void setSearch(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
69cad810f21b803229eb11403f9209855525a25d57Steve Block    String search() const;
70cad810f21b803229eb11403f9209855525a25d57Steve Block    void setHash(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
71cad810f21b803229eb11403f9209855525a25d57Steve Block    String hash() const;
72cad810f21b803229eb11403f9209855525a25d57Steve Block    String origin() const;
73a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
74e48d279609693b4d164199748c93ad791547c649Steve Block    String toString() const { return href(); }
758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
76cad810f21b803229eb11403f9209855525a25d57Steve Block    String getParameter(const String&) const;
778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
78cad810f21b803229eb11403f9209855525a25d57Steve Blockprivate:
79cad810f21b803229eb11403f9209855525a25d57Steve Block    Location(Frame*);
80cad810f21b803229eb11403f9209855525a25d57Steve Block
81cad810f21b803229eb11403f9209855525a25d57Steve Block    const KURL& url() const;
82cad810f21b803229eb11403f9209855525a25d57Steve Block
83cad810f21b803229eb11403f9209855525a25d57Steve Block    Frame* m_frame;
84cad810f21b803229eb11403f9209855525a25d57Steve Block};
858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} // namespace WebCore
878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif // Location_h
89