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

Side by Side Diff: components/autofill/content/renderer/page_click_tracker.cc

Issue 1304923002: Only user gesture focus change and mouse click show autofill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Single if statement. 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "components/autofill/content/renderer/page_click_tracker.h" 5 #include "components/autofill/content/renderer/page_click_tracker.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "components/autofill/content/renderer/form_autofill_util.h" 8 #include "components/autofill/content/renderer/form_autofill_util.h"
9 #include "components/autofill/content/renderer/page_click_listener.h" 9 #include "components/autofill/content/renderer/page_click_listener.h"
10 #include "components/autofill/core/common/autofill_util.h" 10 #include "components/autofill/core/common/autofill_util.h"
11 #include "content/public/renderer/render_frame.h" 11 #include "content/public/renderer/render_frame.h"
12 #include "content/public/renderer/render_view.h" 12 #include "content/public/renderer/render_view.h"
13 #include "third_party/WebKit/public/platform/WebPoint.h" 13 #include "third_party/WebKit/public/platform/WebPoint.h"
14 #include "third_party/WebKit/public/platform/WebSize.h" 14 #include "third_party/WebKit/public/platform/WebSize.h"
15 #include "third_party/WebKit/public/web/WebDocument.h" 15 #include "third_party/WebKit/public/web/WebDocument.h"
16 #include "third_party/WebKit/public/web/WebHitTestResult.h" 16 #include "third_party/WebKit/public/web/WebHitTestResult.h"
17 #include "third_party/WebKit/public/web/WebInputElement.h" 17 #include "third_party/WebKit/public/web/WebInputElement.h"
18 #include "third_party/WebKit/public/web/WebInputEvent.h" 18 #include "third_party/WebKit/public/web/WebInputEvent.h"
19 #include "third_party/WebKit/public/web/WebLocalFrame.h" 19 #include "third_party/WebKit/public/web/WebLocalFrame.h"
20 #include "third_party/WebKit/public/web/WebTextAreaElement.h" 20 #include "third_party/WebKit/public/web/WebTextAreaElement.h"
21 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
21 #include "third_party/WebKit/public/web/WebView.h" 22 #include "third_party/WebKit/public/web/WebView.h"
22 23
23 using blink::WebElement; 24 using blink::WebElement;
24 using blink::WebGestureEvent; 25 using blink::WebGestureEvent;
25 using blink::WebInputElement; 26 using blink::WebInputElement;
26 using blink::WebInputEvent; 27 using blink::WebInputEvent;
27 using blink::WebMouseEvent; 28 using blink::WebMouseEvent;
28 using blink::WebNode; 29 using blink::WebNode;
29 using blink::WebPoint; 30 using blink::WebPoint;
30 using blink::WebSize; 31 using blink::WebSize;
31 using blink::WebTextAreaElement; 32 using blink::WebTextAreaElement;
33 using blink::WebUserGestureIndicator;
32 34
33 namespace { 35 namespace {
34 36
35 // Casts |node| to a WebInputElement. 37 // Casts |node| to a WebInputElement.
36 // Returns an empty (isNull()) WebInputElement if |node| is not a text field. 38 // Returns an empty (isNull()) WebInputElement if |node| is not a text field.
37 const WebInputElement GetTextWebInputElement(const WebNode& node) { 39 const WebInputElement GetTextWebInputElement(const WebNode& node) {
38 if (!node.isElementNode()) 40 if (!node.isElementNode())
39 return WebInputElement(); 41 return WebInputElement();
40 const WebElement element = node.toConst<WebElement>(); 42 const WebElement element = node.toConst<WebElement>();
41 if (!element.hasHTMLTagName("input")) 43 if (!element.hasHTMLTagName("input"))
(...skipping 28 matching lines...) Expand all
70 listener_(listener), 72 listener_(listener),
71 legacy_(this) { 73 legacy_(this) {
72 } 74 }
73 75
74 PageClickTracker::~PageClickTracker() { 76 PageClickTracker::~PageClickTracker() {
75 } 77 }
76 78
77 void PageClickTracker::OnMouseDown(const WebNode& mouse_down_node) { 79 void PageClickTracker::OnMouseDown(const WebNode& mouse_down_node) {
78 focused_node_was_last_clicked_ = !mouse_down_node.isNull() && 80 focused_node_was_last_clicked_ = !mouse_down_node.isNull() &&
79 mouse_down_node.focused(); 81 mouse_down_node.focused();
82
83 if (IsKeyboardAccessoryEnabled())
84 DoFocusChangeComplete();
80 } 85 }
81 86
82 void PageClickTracker::FocusedNodeChanged(const WebNode& node) { 87 void PageClickTracker::FocusedNodeChanged(const WebNode& node) {
83 was_focused_before_now_ = false; 88 was_focused_before_now_ = false;
84 89
85 if (IsKeyboardAccessoryEnabled()) { 90 if (IsKeyboardAccessoryEnabled() &&
91 WebUserGestureIndicator::isProcessingUserGesture()) {
86 focused_node_was_last_clicked_ = true; 92 focused_node_was_last_clicked_ = true;
87 DoFocusChangeComplete(); 93 DoFocusChangeComplete();
88 } 94 }
89 } 95 }
90 96
91 void PageClickTracker::FocusChangeComplete() { 97 void PageClickTracker::FocusChangeComplete() {
92 if (IsKeyboardAccessoryEnabled()) 98 if (IsKeyboardAccessoryEnabled())
93 return; 99 return;
94 100
95 DoFocusChangeComplete(); 101 DoFocusChangeComplete();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 135
130 void PageClickTracker::Legacy::OnMouseDown(const WebNode& mouse_down_node) { 136 void PageClickTracker::Legacy::OnMouseDown(const WebNode& mouse_down_node) {
131 tracker_->OnMouseDown(mouse_down_node); 137 tracker_->OnMouseDown(mouse_down_node);
132 } 138 }
133 139
134 void PageClickTracker::Legacy::FocusChangeComplete() { 140 void PageClickTracker::Legacy::FocusChangeComplete() {
135 tracker_->FocusChangeComplete(); 141 tracker_->FocusChangeComplete();
136 } 142 }
137 143
138 } // namespace autofill 144 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698