| 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 #include "components/autofill/content/renderer/autofill_agent.h" | 5 #include "components/autofill/content/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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 switches::kDisableSingleClickAutofill); | 315 switches::kDisableSingleClickAutofill); |
| 316 #else | 316 #else |
| 317 bool single_click_autofill = | 317 bool single_click_autofill = |
| 318 base::CommandLine::ForCurrentProcess()->HasSwitch( | 318 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 319 switches::kEnableSingleClickAutofill); | 319 switches::kEnableSingleClickAutofill); |
| 320 #endif | 320 #endif |
| 321 | 321 |
| 322 if (!single_click_autofill) { | 322 if (!single_click_autofill) { |
| 323 // Show full suggestions when clicking on an already-focused form field. On | 323 // Show full suggestions when clicking on an already-focused form field. On |
| 324 // the initial click (not focused yet), only show password suggestions. | 324 // the initial click (not focused yet), only show password suggestions. |
| 325 #if defined(OS_ANDROID) | |
| 326 // TODO(gcasto): Remove after crbug.com/430318 has been fixed. | |
| 327 if (!was_focused) | |
| 328 return; | |
| 329 #endif | |
| 330 | |
| 331 options.show_full_suggestion_list = | 325 options.show_full_suggestion_list = |
| 332 options.show_full_suggestion_list || was_focused; | 326 options.show_full_suggestion_list || was_focused; |
| 333 options.show_password_suggestions_only = !was_focused; | 327 options.show_password_suggestions_only = !was_focused; |
| 334 } | 328 } |
| 335 ShowSuggestions(element, options); | 329 ShowSuggestions(element, options); |
| 336 } | 330 } |
| 337 | 331 |
| 338 void AutofillAgent::textFieldDidEndEditing(const WebInputElement& element) { | 332 void AutofillAgent::textFieldDidEndEditing(const WebInputElement& element) { |
| 339 password_autofill_agent_->TextFieldDidEndEditing(element); | 333 password_autofill_agent_->TextFieldDidEndEditing(element); |
| 340 has_shown_autofill_popup_for_current_edit_ = false; | 334 has_shown_autofill_popup_for_current_edit_ = false; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 366 |
| 373 const WebInputElement* input_element = toWebInputElement(&element); | 367 const WebInputElement* input_element = toWebInputElement(&element); |
| 374 if (input_element) { | 368 if (input_element) { |
| 375 if (password_generation_agent_ && | 369 if (password_generation_agent_ && |
| 376 password_generation_agent_->TextDidChangeInTextField(*input_element)) { | 370 password_generation_agent_->TextDidChangeInTextField(*input_element)) { |
| 377 is_popup_possibly_visible_ = true; | 371 is_popup_possibly_visible_ = true; |
| 378 return; | 372 return; |
| 379 } | 373 } |
| 380 | 374 |
| 381 if (password_autofill_agent_->TextDidChangeInTextField(*input_element)) { | 375 if (password_autofill_agent_->TextDidChangeInTextField(*input_element)) { |
| 376 is_popup_possibly_visible_ = true; |
| 382 element_ = element; | 377 element_ = element; |
| 383 return; | 378 return; |
| 384 } | 379 } |
| 385 } | 380 } |
| 386 | 381 |
| 387 ShowSuggestionsOptions options; | 382 ShowSuggestionsOptions options; |
| 388 options.requires_caret_at_end = true; | 383 options.requires_caret_at_end = true; |
| 389 ShowSuggestions(element, options); | 384 ShowSuggestions(element, options); |
| 390 | 385 |
| 391 FormData form; | 386 FormData form; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 780 |
| 786 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { | 781 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { |
| 787 // No-op. Don't delete |this|. | 782 // No-op. Don't delete |this|. |
| 788 } | 783 } |
| 789 | 784 |
| 790 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { | 785 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
| 791 agent_->FocusChangeComplete(); | 786 agent_->FocusChangeComplete(); |
| 792 } | 787 } |
| 793 | 788 |
| 794 } // namespace autofill | 789 } // namespace autofill |
| OLD | NEW |