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/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 void AutofillAgent::AcceptDataListSuggestion( | 478 void AutofillAgent::AcceptDataListSuggestion( |
479 const base::string16& suggested_value) { | 479 const base::string16& suggested_value) { |
480 WebInputElement* input_element = toWebInputElement(&element_); | 480 WebInputElement* input_element = toWebInputElement(&element_); |
481 DCHECK(input_element); | 481 DCHECK(input_element); |
482 base::string16 new_value = suggested_value; | 482 base::string16 new_value = suggested_value; |
483 // If this element takes multiple values then replace the last part with | 483 // If this element takes multiple values then replace the last part with |
484 // the suggestion. | 484 // the suggestion. |
485 if (input_element->isMultiple() && input_element->isEmailField()) { | 485 if (input_element->isMultiple() && input_element->isEmailField()) { |
486 std::vector<base::string16> parts; | 486 std::vector<base::string16> parts; |
487 | 487 |
488 base::SplitStringDontTrim(input_element->editingValue(), ',', &parts); | 488 base::SplitStringDontTrim( |
| 489 base::StringPiece16(input_element->editingValue()), ',', &parts); |
489 if (parts.size() == 0) | 490 if (parts.size() == 0) |
490 parts.push_back(base::string16()); | 491 parts.push_back(base::string16()); |
491 | 492 |
492 base::string16 last_part = parts.back(); | 493 base::string16 last_part = parts.back(); |
493 // We want to keep just the leading whitespace. | 494 // We want to keep just the leading whitespace. |
494 for (size_t i = 0; i < last_part.size(); ++i) { | 495 for (size_t i = 0; i < last_part.size(); ++i) { |
495 if (!IsWhitespace(last_part[i])) { | 496 if (!IsWhitespace(last_part[i])) { |
496 last_part = last_part.substr(0, i); | 497 last_part = last_part.substr(0, i); |
497 break; | 498 break; |
498 } | 499 } |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 | 795 |
795 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { | 796 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { |
796 // No-op. Don't delete |this|. | 797 // No-op. Don't delete |this|. |
797 } | 798 } |
798 | 799 |
799 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { | 800 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
800 agent_->FocusChangeComplete(); | 801 agent_->FocusChangeComplete(); |
801 } | 802 } |
802 | 803 |
803 } // namespace autofill | 804 } // namespace autofill |
OLD | NEW |