OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Simon Hausmann <hausmann@kde.org> | 4 * (C) 2000 Simon Hausmann <hausmann@kde.org> |
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "core/frame/UseCounter.h" | 30 #include "core/frame/UseCounter.h" |
31 #include "core/html/HTMLImageElement.h" | 31 #include "core/html/HTMLImageElement.h" |
32 #include "core/html/parser/HTMLParserIdioms.h" | 32 #include "core/html/parser/HTMLParserIdioms.h" |
33 #include "core/layout/LayoutBox.h" | 33 #include "core/layout/LayoutBox.h" |
34 #include "core/loader/FrameLoadRequest.h" | 34 #include "core/loader/FrameLoadRequest.h" |
35 #include "core/loader/FrameLoaderClient.h" | 35 #include "core/loader/FrameLoaderClient.h" |
36 #include "core/loader/PingLoader.h" | 36 #include "core/loader/PingLoader.h" |
37 #include "core/page/ChromeClient.h" | 37 #include "core/page/ChromeClient.h" |
38 #include "platform/network/NetworkHints.h" | 38 #include "platform/network/NetworkHints.h" |
39 #include "platform/weborigin/SecurityPolicy.h" | 39 #include "platform/weborigin/SecurityPolicy.h" |
| 40 #include "public/platform/resource_hints.mojom-blink.h" |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 using namespace HTMLNames; | 44 using namespace HTMLNames; |
44 | 45 |
45 class HTMLAnchorElement::NavigationHintSender : public GarbageCollected<HTMLAnch
orElement::NavigationHintSender> { | 46 class HTMLAnchorElement::NavigationHintSender : public GarbageCollected<HTMLAnch
orElement::NavigationHintSender> { |
46 public: | 47 public: |
47 // TODO(horo): Move WebNavigationHintType to public/ directory. | |
48 enum class WebNavigationHintType { | |
49 Unknown, | |
50 LinkMouseDown, | |
51 LinkTapUnconfirmed, | |
52 LinkTapDown, | |
53 Last = LinkTapDown | |
54 }; | |
55 | |
56 static NavigationHintSender* create(HTMLAnchorElement* anchorElement) | 48 static NavigationHintSender* create(HTMLAnchorElement* anchorElement) |
57 { | 49 { |
58 return new NavigationHintSender(anchorElement); | 50 return new NavigationHintSender(anchorElement); |
59 } | 51 } |
60 void handleEvent(Event*); | 52 void handleEvent(Event*); |
61 | 53 |
62 DECLARE_TRACE(); | 54 DECLARE_TRACE(); |
63 | 55 |
64 private: | 56 private: |
65 explicit NavigationHintSender(HTMLAnchorElement*); | 57 explicit NavigationHintSender(HTMLAnchorElement*); |
66 bool shouldSendNavigationHint() const; | 58 bool shouldSendNavigationHint() const; |
67 void maybeSendNavigationHint(WebNavigationHintType); | 59 void maybeSendNavigationHint(mojom::blink::NavigationHintType); |
68 | 60 |
69 Member<HTMLAnchorElement> m_anchorElement; | 61 Member<HTMLAnchorElement> m_anchorElement; |
70 }; | 62 }; |
71 | 63 |
72 void HTMLAnchorElement::NavigationHintSender::handleEvent(Event* event) | 64 void HTMLAnchorElement::NavigationHintSender::handleEvent(Event* event) |
73 { | 65 { |
74 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t
oMouseEvent(event)->button() == LeftButton) | 66 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t
oMouseEvent(event)->button() == LeftButton) |
75 maybeSendNavigationHint(WebNavigationHintType::LinkMouseDown); | 67 maybeSendNavigationHint(mojom::blink::NavigationHintType::LINK_MOUSE_DOW
N); |
76 else if (event->type() == EventTypeNames::gesturetapunconfirmed) | 68 else if (event->type() == EventTypeNames::gesturetapunconfirmed) |
77 maybeSendNavigationHint(WebNavigationHintType::LinkTapUnconfirmed); | 69 maybeSendNavigationHint(mojom::blink::NavigationHintType::LINK_TAP_UNCON
FIRMED); |
78 else if (event->type() == EventTypeNames::gestureshowpress) | 70 else if (event->type() == EventTypeNames::gestureshowpress) |
79 maybeSendNavigationHint(WebNavigationHintType::LinkTapDown); | 71 maybeSendNavigationHint(mojom::blink::NavigationHintType::LINK_TAP_DOWN)
; |
80 } | 72 } |
81 | 73 |
82 DEFINE_TRACE(HTMLAnchorElement::NavigationHintSender) | 74 DEFINE_TRACE(HTMLAnchorElement::NavigationHintSender) |
83 { | 75 { |
84 visitor->trace(m_anchorElement); | 76 visitor->trace(m_anchorElement); |
85 } | 77 } |
86 | 78 |
87 HTMLAnchorElement::NavigationHintSender::NavigationHintSender(HTMLAnchorElement*
anchorElement) | 79 HTMLAnchorElement::NavigationHintSender::NavigationHintSender(HTMLAnchorElement*
anchorElement) |
88 : m_anchorElement(anchorElement) | 80 : m_anchorElement(anchorElement) |
89 { | 81 { |
(...skipping 14 matching lines...) Expand all Loading... |
104 | 96 |
105 // When the user clicks a link which is to the current document with a hash, | 97 // When the user clicks a link which is to the current document with a hash, |
106 // the network request is not fetched. So we don't send the navigation hint | 98 // the network request is not fetched. So we don't send the navigation hint |
107 // to the browser process. | 99 // to the browser process. |
108 if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(document.
url(), url)) | 100 if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(document.
url(), url)) |
109 return false; | 101 return false; |
110 | 102 |
111 return true; | 103 return true; |
112 } | 104 } |
113 | 105 |
114 void HTMLAnchorElement::NavigationHintSender::maybeSendNavigationHint(WebNavigat
ionHintType type) | 106 void HTMLAnchorElement::NavigationHintSender::maybeSendNavigationHint(mojom::bli
nk::NavigationHintType type) |
115 { | 107 { |
116 if (!shouldSendNavigationHint()) | 108 if (!shouldSendNavigationHint()) |
117 return; | 109 return; |
118 | 110 |
119 // TODO(horo): Send the navigation hint message to the browser process. | 111 sendNavigationHint(m_anchorElement->href(), type); |
120 } | 112 } |
121 | 113 |
122 HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document& doc
ument) | 114 HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document& doc
ument) |
123 : HTMLElement(tagName, document) | 115 : HTMLElement(tagName, document) |
124 , m_linkRelations(0) | 116 , m_linkRelations(0) |
125 , m_cachedVisitedLinkHash(0) | 117 , m_cachedVisitedLinkHash(0) |
126 , m_wasFocusedByMouse(false) | 118 , m_wasFocusedByMouse(false) |
127 { | 119 { |
128 } | 120 } |
129 | 121 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 476 } |
485 | 477 |
486 HTMLAnchorElement::NavigationHintSender* HTMLAnchorElement::ensureNavigationHint
Sender() | 478 HTMLAnchorElement::NavigationHintSender* HTMLAnchorElement::ensureNavigationHint
Sender() |
487 { | 479 { |
488 if (!m_navigationHintSender) | 480 if (!m_navigationHintSender) |
489 m_navigationHintSender = NavigationHintSender::create(this); | 481 m_navigationHintSender = NavigationHintSender::create(this); |
490 return m_navigationHintSender; | 482 return m_navigationHintSender; |
491 } | 483 } |
492 | 484 |
493 } // namespace blink | 485 } // namespace blink |
OLD | NEW |