| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_RENDERER_PAGE_CLICK_TRACKER_H_ | 5 #ifndef CHROME_RENDERER_PAGE_CLICK_TRACKER_H_ |
| 6 #define CHROME_RENDERER_PAGE_CLICK_TRACKER_H_ | 6 #define CHROME_RENDERER_PAGE_CLICK_TRACKER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // Adds/removes a listener for getting notification when an element is | 37 // Adds/removes a listener for getting notification when an element is |
| 38 // clicked. Note that the order of insertion is important as a listener when | 38 // clicked. Note that the order of insertion is important as a listener when |
| 39 // notified can decide to stop the propagation of the event (so that listeners | 39 // notified can decide to stop the propagation of the event (so that listeners |
| 40 // inserted after don't get the notification). | 40 // inserted after don't get the notification). |
| 41 void AddListener(PageClickListener* listener); | 41 void AddListener(PageClickListener* listener); |
| 42 void RemoveListener(PageClickListener* listener); | 42 void RemoveListener(PageClickListener* listener); |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 // RenderView::Observer implementation. | 45 // RenderView::Observer implementation. |
| 46 virtual bool OnMessageReceived(const IPC::Message& message); | 46 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; |
| 47 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame); | 47 virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE; |
| 48 virtual void FrameDetached(WebKit::WebFrame* frame); | 48 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) OVERRIDE; |
| 49 | 49 |
| 50 // WebKit::WebDOMEventListener implementation. | 50 // WebKit::WebDOMEventListener implementation. |
| 51 virtual void handleEvent(const WebKit::WebDOMEvent& event); | 51 virtual void handleEvent(const WebKit::WebDOMEvent& event); |
| 52 | 52 |
| 53 // Called after the mouse event |event| has been processed by WebKit. | |
| 54 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event); | |
| 55 | |
| 56 // The last node that was clicked and had focus. | 53 // The last node that was clicked and had focus. |
| 57 WebKit::WebNode last_node_clicked_; | 54 WebKit::WebNode last_node_clicked_; |
| 58 | 55 |
| 59 // Whether the last clicked node had focused before it was clicked. | 56 // Whether the last clicked node had focused before it was clicked. |
| 60 bool was_focused_; | 57 bool was_focused_; |
| 61 | 58 |
| 62 // The frames we are listening to for mouse events. | 59 // The frames we are listening to for mouse events. |
| 63 typedef std::vector<WebKit::WebFrame*> FrameList; | 60 typedef std::vector<WebKit::WebFrame*> FrameList; |
| 64 FrameList tracked_frames_; | 61 FrameList tracked_frames_; |
| 65 | 62 |
| 66 // The listener getting the actual notifications. | 63 // The listener getting the actual notifications. |
| 67 ObserverList<PageClickListener> listeners_; | 64 ObserverList<PageClickListener> listeners_; |
| 68 | 65 |
| 69 DISALLOW_COPY_AND_ASSIGN(PageClickTracker); | 66 DISALLOW_COPY_AND_ASSIGN(PageClickTracker); |
| 70 }; | 67 }; |
| 71 | 68 |
| 72 #endif // CHROME_RENDERER_PAGE_CLICK_TRACKER_H_ | 69 #endif // CHROME_RENDERER_PAGE_CLICK_TRACKER_H_ |
| OLD | NEW |