1/*
2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING.LIB.  If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21#ifndef TapHighlightController_h
22#define TapHighlightController_h
23
24#if ENABLE(TOUCH_EVENTS)
25
26#include "PageOverlay.h"
27#include <WebCore/Color.h>
28#include <WebCore/Path.h>
29#include <wtf/Forward.h>
30#include <wtf/Noncopyable.h>
31#include <wtf/Vector.h>
32
33namespace WebCore {
34class Frame;
35class IntRect;
36class Node;
37}
38
39namespace WebKit {
40
41class WebPage;
42
43class TapHighlightController : private PageOverlay::Client {
44    WTF_MAKE_NONCOPYABLE(TapHighlightController);
45
46public:
47    explicit TapHighlightController(WebPage*);
48    virtual ~TapHighlightController();
49
50    void highlight(WebCore::Node*);
51    void hideHighlight();
52
53private:
54    // PageOverlay::Client.
55    virtual void pageOverlayDestroyed(PageOverlay*);
56    virtual void willMoveToWebPage(PageOverlay*, WebPage*);
57    virtual void didMoveToWebPage(PageOverlay*, WebPage*);
58    virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&);
59    virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
60
61private:
62    WebPage* m_webPage;
63    PageOverlay* m_overlay;
64
65    WebCore::Path m_path;
66    WebCore::Color m_color;
67};
68
69} // namespace WebKit
70
71#endif // ENABLE(TOUCH_EVENTS)
72
73#endif // TapHighlightController_h
74