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

Unified Diff: components/autofill/content/renderer/page_click_tracker.cc

Issue 1305353013: Tests for user gesture detection in page click tracker. [DO NOT REVIEW] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@user-gesture
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/content/renderer/page_click_tracker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/renderer/page_click_tracker.cc
diff --git a/components/autofill/content/renderer/page_click_tracker.cc b/components/autofill/content/renderer/page_click_tracker.cc
index b6a383d475080c90f5b31fd5d862db01e494e733..4541fe219cab54ca4606165ee21c400ac86e07ec 100644
--- a/components/autofill/content/renderer/page_click_tracker.cc
+++ b/components/autofill/content/renderer/page_click_tracker.cc
@@ -76,32 +76,40 @@ PageClickTracker::PageClickTracker(content::RenderFrame* render_frame,
PageClickTracker::~PageClickTracker() {
}
-void PageClickTracker::OnMouseDown(const WebNode& mouse_down_node) {
- focused_node_was_last_clicked_ = !mouse_down_node.isNull() &&
- mouse_down_node.focused();
-
- if (IsKeyboardAccessoryEnabled())
- DoFocusChangeComplete();
-}
-
void PageClickTracker::FocusedNodeChanged(const WebNode& node) {
was_focused_before_now_ = false;
- if (IsKeyboardAccessoryEnabled() &&
- WebUserGestureIndicator::isProcessingUserGesture()) {
+ if (IsKeyboardAccessory() && IsUserGesture()) {
focused_node_was_last_clicked_ = true;
DoFocusChangeComplete();
}
}
+bool PageClickTracker::IsUserGesture() const {
+ return WebUserGestureIndicator::isProcessingUserGesture();
+}
+
+bool PageClickTracker::IsKeyboardAccessory() const {
+ return IsKeyboardAccessoryEnabled();
+}
+
+void PageClickTracker::OnMouseDown(const WebNode& mouse_down_node) {
+ focused_node_was_last_clicked_ = !mouse_down_node.isNull() &&
+ mouse_down_node.focused();
+
+ if (IsKeyboardAccessory())
+ DoFocusChangeComplete();
+}
+
void PageClickTracker::FocusChangeComplete() {
- if (IsKeyboardAccessoryEnabled())
+ if (IsKeyboardAccessory())
return;
DoFocusChangeComplete();
}
void PageClickTracker::DoFocusChangeComplete() {
+ LOG(ERROR) << __FUNCTION__;
WebNode focused_node = render_frame()->GetFocusedElement();
if (focused_node_was_last_clicked_ && !focused_node.isNull()) {
const WebInputElement input_element = GetTextWebInputElement(focused_node);
« no previous file with comments | « components/autofill/content/renderer/page_click_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698