| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 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 #ifndef InputMethodContext_h | 31 #ifndef LinkResource_h |
| 32 #define InputMethodContext_h | 32 #define LinkResource_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" | 34 #include "core/loader/cache/CachedResourceRequest.h" |
| 35 #include "core/html/HTMLElement.h" | 35 #include "core/platform/KURL.h" |
| 36 #include "wtf/PassOwnPtr.h" | 36 #include "wtf/Forward.h" |
| 37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefCounted.h" |
| 38 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 class Composition; | 42 class HTMLLinkElement; |
| 43 class Node; | |
| 44 | 43 |
| 45 class InputMethodContext : public ScriptWrappable { | 44 class LinkResource : public RefCounted<LinkResource> { |
| 46 public: | 45 public: |
| 47 static PassOwnPtr<InputMethodContext> create(HTMLElement*); | 46 enum Type { |
| 48 ~InputMethodContext(); | 47 Style, |
| 48 Import |
| 49 }; |
| 49 | 50 |
| 50 void ref() { m_element->ref(); } | 51 explicit LinkResource(HTMLLinkElement*); |
| 51 void deref() { m_element->deref(); } | 52 virtual ~LinkResource(); |
| 52 | 53 |
| 53 Composition* composition() const; | 54 virtual Type type() const = 0; |
| 54 bool enabled() const; | 55 virtual void process() = 0; |
| 55 void setEnabled(bool); | 56 virtual void ownerRemoved() = 0; |
| 56 String locale() const; | 57 |
| 57 void confirmComposition(); | 58 protected: |
| 58 void setCaretRectangle(Node* anchor, int x, int y, int w, int h); | 59 HTMLLinkElement* m_owner; |
| 59 void setExclusionRectangle(Node* anchor, int x, int y, int w, int h); | 60 }; |
| 60 bool open(); | 61 |
| 62 class LinkRequestBuilder { |
| 63 public: |
| 64 explicit LinkRequestBuilder(HTMLLinkElement* owner); |
| 65 |
| 66 bool isValid() const { return !m_url.isEmpty() && m_url.isValid(); } |
| 67 const KURL& url() const { return m_url; } |
| 68 const String& charset() const { return m_charset; } |
| 69 CachedResourceRequest build(bool blocking) const; |
| 61 | 70 |
| 62 private: | 71 private: |
| 63 InputMethodContext(HTMLElement*); | 72 HTMLLinkElement* m_owner; |
| 64 bool m_enabled; | 73 KURL m_url; |
| 65 RefPtr<Composition> m_composition; | 74 String m_charset; |
| 66 HTMLElement* m_element; | |
| 67 }; | 75 }; |
| 68 | 76 |
| 69 } // namespace WebCore | 77 } // namespace WebCore |
| 70 | 78 |
| 71 #endif // InputMethodContext_h | 79 #endif // LinkResource_h |
| OLD | NEW |