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

Side by Side Diff: components/autofill/renderer/autofill_agent.cc

Issue 15942004: Stop offering Autocheckout bubble on the forms of no interest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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 | « components/autofill/renderer/autofill_agent.h ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/autofill_agent.h" 5 #include "components/autofill/renderer/autofill_agent.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 autofill_action_(AUTOFILL_NONE), 145 autofill_action_(AUTOFILL_NONE),
146 topmost_frame_(NULL), 146 topmost_frame_(NULL),
147 web_view_(render_view->GetWebView()), 147 web_view_(render_view->GetWebView()),
148 display_warning_if_disabled_(false), 148 display_warning_if_disabled_(false),
149 was_query_node_autofilled_(false), 149 was_query_node_autofilled_(false),
150 has_shown_autofill_popup_for_current_edit_(false), 150 has_shown_autofill_popup_for_current_edit_(false),
151 did_set_node_text_(false), 151 did_set_node_text_(false),
152 autocheckout_click_in_progress_(false), 152 autocheckout_click_in_progress_(false),
153 is_autocheckout_supported_(false), 153 is_autocheckout_supported_(false),
154 has_new_forms_for_browser_(false), 154 has_new_forms_for_browser_(false),
155 try_to_show_autocheckout_bubble_(false),
156 ignore_text_changes_(false), 155 ignore_text_changes_(false),
157 weak_ptr_factory_(this) { 156 weak_ptr_factory_(this) {
158 render_view->GetWebView()->setAutofillClient(this); 157 render_view->GetWebView()->setAutofillClient(this);
159 158
160 // The PageClickTracker is a RenderViewObserver, and hence will be freed when 159 // The PageClickTracker is a RenderViewObserver, and hence will be freed when
161 // the RenderView is destroyed. 160 // the RenderView is destroyed.
162 new PageClickTracker(render_view, this); 161 new PageClickTracker(render_view, this);
163 } 162 }
164 163
165 AutofillAgent::~AutofillAgent() {} 164 AutofillAgent::~AutofillAgent() {}
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 if (!forms.empty() || !frame->parent()) { 221 if (!forms.empty() || !frame->parent()) {
223 Send(new AutofillHostMsg_FormsSeen(routing_id(), forms, 222 Send(new AutofillHostMsg_FormsSeen(routing_id(), forms,
224 forms_seen_timestamp_, 223 forms_seen_timestamp_,
225 state)); 224 state));
226 } 225 }
227 } 226 }
228 227
229 void AutofillAgent::DidStartProvisionalLoad(WebFrame* frame) { 228 void AutofillAgent::DidStartProvisionalLoad(WebFrame* frame) {
230 if (!frame->parent()) { 229 if (!frame->parent()) {
231 is_autocheckout_supported_ = false; 230 is_autocheckout_supported_ = false;
232 try_to_show_autocheckout_bubble_ = false;
233 topmost_frame_ = NULL; 231 topmost_frame_ = NULL;
234 if (click_timer_.IsRunning()) { 232 if (click_timer_.IsRunning()) {
235 click_timer_.Stop(); 233 click_timer_.Stop();
236 autocheckout_click_in_progress_ = true; 234 autocheckout_click_in_progress_ = true;
237 } 235 }
238 } 236 }
239 } 237 }
240 238
241 void AutofillAgent::DidFailProvisionalLoad(WebFrame* frame, 239 void AutofillAgent::DidFailProvisionalLoad(WebFrame* frame,
242 const WebKit::WebURLError& error) { 240 const WebKit::WebURLError& error) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (!element || !element->isEnabled() || element->isReadOnly() || 296 if (!element || !element->isEnabled() || element->isReadOnly() ||
299 !element->isTextField() || element->isPasswordField()) 297 !element->isTextField() || element->isPasswordField())
300 return; 298 return;
301 299
302 element_ = *element; 300 element_ = *element;
303 301
304 MaybeShowAutocheckoutBubble(); 302 MaybeShowAutocheckoutBubble();
305 } 303 }
306 304
307 void AutofillAgent::MaybeShowAutocheckoutBubble() { 305 void AutofillAgent::MaybeShowAutocheckoutBubble() {
308 if (!try_to_show_autocheckout_bubble_ || element_.isNull() || 306 if (element_.isNull() || !element_.focused())
309 !element_.focused())
310 return; 307 return;
311 308
312 FormData form; 309 FormData form;
313 FormFieldData field; 310 FormFieldData field;
314 // This must be called to short circuit this method if it fails. 311 // This must be called to short circuit this method if it fails.
315 if (!FindFormAndFieldForInputElement(element_, &form, &field, REQUIRE_NONE)) 312 if (!FindFormAndFieldForInputElement(element_, &form, &field, REQUIRE_NONE))
316 return; 313 return;
317 314
318 content::SSLStatus ssl_status = render_view()->GetSSLStatusOfFrame( 315 form.ssl_status = render_view()->GetSSLStatusOfFrame(
319 element_.document().frame()); 316 element_.document().frame());
320 317
321 Send(new AutofillHostMsg_MaybeShowAutocheckoutBubble( 318 Send(new AutofillHostMsg_MaybeShowAutocheckoutBubble(
322 routing_id(), 319 routing_id(),
323 form.origin, 320 form,
324 ssl_status,
325 GetScaledBoundingBox(web_view_->pageScaleFactor(), &element_))); 321 GetScaledBoundingBox(web_view_->pageScaleFactor(), &element_)));
326
327 // We should only try once.
328 try_to_show_autocheckout_bubble_ = false;
329 } 322 }
330 323
331 void AutofillAgent::DidChangeScrollOffset(WebKit::WebFrame*) { 324 void AutofillAgent::DidChangeScrollOffset(WebKit::WebFrame*) {
332 HideAutofillUi(); 325 HideAutofillUi();
333 } 326 }
334 327
335 void AutofillAgent::didRequestAutocomplete(WebKit::WebFrame* frame, 328 void AutofillAgent::didRequestAutocomplete(WebKit::WebFrame* frame,
336 const WebFormElement& form) { 329 const WebFormElement& form) {
337 FormData form_data; 330 FormData form_data;
338 if (!in_flight_request_form_.isNull() || 331 if (!in_flight_request_form_.isNull() ||
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 if (!ClickElement(topmost_frame_->document(), 777 if (!ClickElement(topmost_frame_->document(),
785 click_element_descriptor)) { 778 click_element_descriptor)) {
786 click_timer_.Stop(); 779 click_timer_.Stop();
787 Send(new AutofillHostMsg_ClickFailed(routing_id(), 780 Send(new AutofillHostMsg_ClickFailed(routing_id(),
788 MISSING_ADVANCE)); 781 MISSING_ADVANCE));
789 } 782 }
790 } 783 }
791 784
792 void AutofillAgent::OnAutocheckoutSupported() { 785 void AutofillAgent::OnAutocheckoutSupported() {
793 is_autocheckout_supported_ = true; 786 is_autocheckout_supported_ = true;
794 try_to_show_autocheckout_bubble_ = true;
795 if (has_new_forms_for_browser_) 787 if (has_new_forms_for_browser_)
796 MaybeSendDynamicFormsSeen(); 788 MaybeSendDynamicFormsSeen();
797 MaybeShowAutocheckoutBubble(); 789 MaybeShowAutocheckoutBubble();
798 } 790 }
799 791
800 void AutofillAgent::ClickFailed() { 792 void AutofillAgent::ClickFailed() {
801 Send(new AutofillHostMsg_ClickFailed(routing_id(), 793 Send(new AutofillHostMsg_ClickFailed(routing_id(),
802 CANNOT_PROCEED)); 794 CANNOT_PROCEED));
803 } 795 }
804 796
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 if (!forms.empty()) { 975 if (!forms.empty()) {
984 if (click_timer_.IsRunning()) 976 if (click_timer_.IsRunning())
985 click_timer_.Stop(); 977 click_timer_.Stop();
986 Send(new AutofillHostMsg_FormsSeen(routing_id(), forms, 978 Send(new AutofillHostMsg_FormsSeen(routing_id(), forms,
987 forms_seen_timestamp_, 979 forms_seen_timestamp_,
988 state)); 980 state));
989 } 981 }
990 } 982 }
991 983
992 } // namespace autofill 984 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/renderer/autofill_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698