OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CONTENT_RENDERER_PAGE_CLICK_TRACKER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PAGE_CLICK_TRACKER_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PAGE_CLICK_TRACKER_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_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 11 matching lines...) Expand all Loading... |
22 // notifying the listeners of whether the clicked node was already focused | 22 // notifying the listeners of whether the clicked node was already focused |
23 // before it was clicked. | 23 // before it was clicked. |
24 // | 24 // |
25 // This is useful for password/form autofill where we want to trigger a | 25 // This is useful for password/form autofill where we want to trigger a |
26 // suggestion popup when a text input is clicked. | 26 // suggestion popup when a text input is clicked. |
27 // It only notifies of WebInputElement that are text inputs being clicked, but | 27 // It only notifies of WebInputElement that are text inputs being clicked, but |
28 // could easily be changed to report click on any type of WebNode. | 28 // could easily be changed to report click on any type of WebNode. |
29 // | 29 // |
30 // There is one PageClickTracker per RenderView. | 30 // There is one PageClickTracker per RenderView. |
31 class PageClickTracker : public content::RenderViewObserver, | 31 class PageClickTracker : public content::RenderViewObserver, |
32 public WebKit::WebDOMEventListener { | 32 public blink::WebDOMEventListener { |
33 public: | 33 public: |
34 // The |listener| will be notified when an element is clicked. It must | 34 // The |listener| will be notified when an element is clicked. It must |
35 // outlive this class. | 35 // outlive this class. |
36 PageClickTracker(content::RenderView* render_view, | 36 PageClickTracker(content::RenderView* render_view, |
37 PageClickListener* listener); | 37 PageClickListener* listener); |
38 virtual ~PageClickTracker(); | 38 virtual ~PageClickTracker(); |
39 | 39 |
40 private: | 40 private: |
41 // RenderView::Observer implementation. | 41 // RenderView::Observer implementation. |
42 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; | 42 virtual void DidFinishDocumentLoad(blink::WebFrame* frame) OVERRIDE; |
43 virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE; | 43 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE; |
44 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) OVERRIDE; | 44 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) OVERRIDE; |
45 | 45 |
46 // WebKit::WebDOMEventListener implementation. | 46 // blink::WebDOMEventListener implementation. |
47 virtual void handleEvent(const WebKit::WebDOMEvent& event); | 47 virtual void handleEvent(const blink::WebDOMEvent& event); |
48 | 48 |
49 // Checks to see if a text field is losing focus and inform listeners if | 49 // Checks to see if a text field is losing focus and inform listeners if |
50 // it is. | 50 // it is. |
51 void HandleTextFieldMaybeLosingFocus( | 51 void HandleTextFieldMaybeLosingFocus( |
52 const WebKit::WebNode& newly_clicked_node); | 52 const blink::WebNode& newly_clicked_node); |
53 | 53 |
54 // The last node that was clicked and had focus. | 54 // The last node that was clicked and had focus. |
55 WebKit::WebNode last_node_clicked_; | 55 blink::WebNode last_node_clicked_; |
56 | 56 |
57 // Whether the last clicked node had focused before it was clicked. | 57 // Whether the last clicked node had focused before it was clicked. |
58 bool was_focused_; | 58 bool was_focused_; |
59 | 59 |
60 // The frames we are listening to for mouse events. | 60 // The frames we are listening to for mouse events. |
61 std::vector<WebKit::WebFrame*> tracked_frames_; | 61 std::vector<blink::WebFrame*> tracked_frames_; |
62 | 62 |
63 // The listener getting the actual notifications. | 63 // The listener getting the actual notifications. |
64 PageClickListener* listener_; | 64 PageClickListener* listener_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(PageClickTracker); | 66 DISALLOW_COPY_AND_ASSIGN(PageClickTracker); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace autofill | 69 } // namespace autofill |
70 | 70 |
71 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PAGE_CLICK_TRACKER_H_ | 71 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PAGE_CLICK_TRACKER_H_ |
OLD | NEW |