OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 11 matching lines...) Expand all Loading... |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "WebForm.h" | 32 #include "WebSecurityOrigin.h" |
33 | 33 |
34 #include "HTMLFormElement.h" | 34 #include "SecurityOrigin.h" |
| 35 #include "WebString.h" |
35 #include <wtf/PassRefPtr.h> | 36 #include <wtf/PassRefPtr.h> |
36 | 37 |
37 using namespace WebCore; | 38 using namespace WebCore; |
38 | 39 |
39 namespace WebKit { | 40 namespace WebKit { |
40 | 41 |
41 class WebFormPrivate : public HTMLFormElement { | 42 class WebSecurityOriginPrivate : public SecurityOrigin { |
42 }; | 43 }; |
43 | 44 |
44 void WebForm::reset() | 45 void WebSecurityOrigin::reset() |
45 { | 46 { |
46 assign(0); | 47 assign(0); |
47 } | 48 } |
48 | 49 |
49 void WebForm::assign(const WebForm& other) | 50 void WebSecurityOrigin::assign(const WebSecurityOrigin& other) |
50 { | 51 { |
51 WebFormPrivate* p = const_cast<WebFormPrivate*>(other.m_private); | 52 WebSecurityOriginPrivate* p = const_cast<WebSecurityOriginPrivate*>(other.m_private); |
52 p->ref(); | 53 p->ref(); |
53 assign(p); | 54 assign(p); |
54 } | 55 } |
55 | 56 |
56 bool WebForm::isAutoCompleteEnabled() const | 57 WebString WebSecurityOrigin::toString() const |
57 { | 58 { |
58 ASSERT(!isNull()); | 59 if (m_private) |
59 return m_private->autoComplete(); | 60 return m_private->toString(); |
| 61 |
| 62 return WebString::fromUTF8("null"); |
60 } | 63 } |
61 | 64 |
62 WebForm::WebForm(const WTF::PassRefPtr<WebCore::HTMLFormElement>& element) | 65 WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin) |
63 : m_private(static_cast<WebFormPrivate*>(element.releaseRef())) | 66 : m_private(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef())) |
64 { | 67 { |
65 } | 68 } |
66 | 69 |
67 WebForm& WebForm::operator=(const WTF::PassRefPtr<WebCore::HTMLFormElement>& element) | 70 WebSecurityOrigin& WebSecurityOrigin::operator=(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin) |
68 { | 71 { |
69 assign(static_cast<WebFormPrivate*>(element.releaseRef())); | 72 assign(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef())); |
70 return *this; | 73 return *this; |
71 } | 74 } |
72 | 75 |
73 WebForm::operator WTF::PassRefPtr<WebCore::HTMLFormElement>() const | 76 WebSecurityOrigin::operator WTF::PassRefPtr<WebCore::SecurityOrigin>() const |
74 { | 77 { |
75 return PassRefPtr<HTMLFormElement>(const_cast<WebFormPrivate*>(m_private)); | 78 return PassRefPtr<SecurityOrigin>(const_cast<WebSecurityOriginPrivate*>(m_private)); |
76 } | 79 } |
77 | 80 |
78 void WebForm::assign(WebFormPrivate* p) | 81 void WebSecurityOrigin::assign(WebSecurityOriginPrivate* p) |
79 { | 82 { |
80 // p is already ref'd for us by the caller | 83 // p is already ref'd for us by the caller |
81 if (m_private) | 84 if (m_private) |
82 m_private->deref(); | 85 m_private->deref(); |
83 m_private = p; | 86 m_private = p; |
84 } | 87 } |
85 | 88 |
86 } // namespace WebKit | 89 } // namespace WebKit |
OLD | NEW |