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