Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: chrome/renderer/page_click_tracker.cc

Issue 8294007: Get rid of view_messages.h includes in chrome\renderer. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/page_click_tracker.h ('k') | chrome/renderer/page_load_histograms.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/renderer/page_click_tracker.h" 5 #include "chrome/renderer/page_click_tracker.h"
6 6
7 #include "chrome/common/render_messages.h" 7 #include "chrome/common/render_messages.h"
8 #include "chrome/renderer/page_click_listener.h" 8 #include "chrome/renderer/page_click_listener.h"
9 #include "content/common/view_messages.h"
10 #include "content/public/renderer/render_view.h" 9 #include "content/public/renderer/render_view.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMouseEvent.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMouseEvent.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
17 16
18 using WebKit::WebDOMEvent; 17 using WebKit::WebDOMEvent;
19 using WebKit::WebDOMMouseEvent; 18 using WebKit::WebDOMMouseEvent;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 84 }
86 85
87 void PageClickTracker::AddListener(PageClickListener* listener) { 86 void PageClickTracker::AddListener(PageClickListener* listener) {
88 listeners_.AddObserver(listener); 87 listeners_.AddObserver(listener);
89 } 88 }
90 89
91 void PageClickTracker::RemoveListener(PageClickListener* listener) { 90 void PageClickTracker::RemoveListener(PageClickListener* listener) {
92 listeners_.RemoveObserver(listener); 91 listeners_.RemoveObserver(listener);
93 } 92 }
94 93
95 bool PageClickTracker::OnMessageReceived(const IPC::Message& message) {
96 if (message.type() == ViewMsg_HandleInputEvent::ID) {
ananta 2011/10/15 00:15:21 This code not needed anymore?
jam 2011/10/15 00:17:10 yeah, i don't know why it got checked in like that
97 void* iter = NULL;
98 const char* data;
99 int data_length;
100 if (message.ReadData(&iter, &data, &data_length)) {
101 const WebInputEvent* input_event =
102 reinterpret_cast<const WebInputEvent*>(data);
103 if (WebInputEvent::isMouseEventType(input_event->type))
104 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event)));
105 }
106 }
107 return false;
108 }
109
110 void PageClickTracker::DidFinishDocumentLoad(WebKit::WebFrame* frame) { 94 void PageClickTracker::DidFinishDocumentLoad(WebKit::WebFrame* frame) {
111 tracked_frames_.push_back(frame); 95 tracked_frames_.push_back(frame);
112 frame->document().addEventListener("mousedown", this, false); 96 frame->document().addEventListener("mousedown", this, false);
113 } 97 }
114 98
115 void PageClickTracker::FrameDetached(WebKit::WebFrame* frame) { 99 void PageClickTracker::FrameDetached(WebKit::WebFrame* frame) {
116 FrameList::iterator iter = 100 FrameList::iterator iter =
117 std::find(tracked_frames_.begin(), tracked_frames_.end(), frame); 101 std::find(tracked_frames_.begin(), tracked_frames_.end(), frame);
118 if (iter == tracked_frames_.end()) { 102 if (iter == tracked_frames_.end()) {
119 // Some frames might never load contents so we may not have a listener on 103 // Some frames might never load contents so we may not have a listener on
(...skipping 19 matching lines...) Expand all
139 // We'll get a notification once the mouse event has been processed 123 // We'll get a notification once the mouse event has been processed
140 // (DidHandleMouseEvent), we'll notify the listener at that point. 124 // (DidHandleMouseEvent), we'll notify the listener at that point.
141 WebNode node = mouse_event.target(); 125 WebNode node = mouse_event.target();
142 // We are only interested in text field clicks. 126 // We are only interested in text field clicks.
143 if (GetTextWebInputElement(node).isNull()) 127 if (GetTextWebInputElement(node).isNull())
144 return; 128 return;
145 129
146 last_node_clicked_ = node; 130 last_node_clicked_ = node;
147 was_focused_ = (render_view()->GetFocusedNode() == last_node_clicked_); 131 was_focused_ = (render_view()->GetFocusedNode() == last_node_clicked_);
148 } 132 }
OLDNEW
« no previous file with comments | « chrome/renderer/page_click_tracker.h ('k') | chrome/renderer/page_load_histograms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698