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

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

Issue 13973004: Convert string16 -> base::string16 in components/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // (so to avoid sending long strings through IPC). 59 // (so to avoid sending long strings through IPC).
60 const size_t kMaximumTextSizeForAutofill = 1000; 60 const size_t kMaximumTextSizeForAutofill = 1000;
61 61
62 // The maximum number of data list elements to send to the browser process 62 // The maximum number of data list elements to send to the browser process
63 // via IPC (to prevent long IPC messages). 63 // via IPC (to prevent long IPC messages).
64 const size_t kMaximumDataListSizeForAutofill = 30; 64 const size_t kMaximumDataListSizeForAutofill = 30;
65 65
66 const int kAutocheckoutClickTimeout = 3; 66 const int kAutocheckoutClickTimeout = 3;
67 67
68 void AppendDataListSuggestions(const WebKit::WebInputElement& element, 68 void AppendDataListSuggestions(const WebKit::WebInputElement& element,
69 std::vector<string16>* values, 69 std::vector<base::string16>* values,
70 std::vector<string16>* labels, 70 std::vector<base::string16>* labels,
71 std::vector<string16>* icons, 71 std::vector<base::string16>* icons,
72 std::vector<int>* item_ids) { 72 std::vector<int>* item_ids) {
73 WebNodeCollection options = element.dataListOptions(); 73 WebNodeCollection options = element.dataListOptions();
74 if (options.isNull()) 74 if (options.isNull())
75 return; 75 return;
76 76
77 string16 prefix = element.editingValue(); 77 base::string16 prefix = element.editingValue();
78 if (element.isMultiple() && 78 if (element.isMultiple() &&
79 element.formControlType() == WebString::fromUTF8("email")) { 79 element.formControlType() == WebString::fromUTF8("email")) {
80 std::vector<string16> parts; 80 std::vector<base::string16> parts;
81 base::SplitStringDontTrim(prefix, ',', &parts); 81 base::SplitStringDontTrim(prefix, ',', &parts);
82 if (parts.size() > 0) 82 if (parts.size() > 0)
83 TrimWhitespace(parts[parts.size() - 1], TRIM_LEADING, &prefix); 83 TrimWhitespace(parts[parts.size() - 1], TRIM_LEADING, &prefix);
84 } 84 }
85 for (WebOptionElement option = options.firstItem().to<WebOptionElement>(); 85 for (WebOptionElement option = options.firstItem().to<WebOptionElement>();
86 !option.isNull(); option = options.nextItem().to<WebOptionElement>()) { 86 !option.isNull(); option = options.nextItem().to<WebOptionElement>()) {
87 if (!StartsWith(option.value(), prefix, false) || 87 if (!StartsWith(option.value(), prefix, false) ||
88 option.value() == prefix || 88 option.value() == prefix ||
89 !element.isValidValue(option.value())) 89 !element.isValidValue(option.value()))
90 continue; 90 continue;
91 91
92 values->push_back(option.value()); 92 values->push_back(option.value());
93 if (option.value() != option.label()) 93 if (option.value() != option.label())
94 labels->push_back(option.label()); 94 labels->push_back(option.label());
95 else 95 else
96 labels->push_back(string16()); 96 labels->push_back(base::string16());
97 icons->push_back(string16()); 97 icons->push_back(base::string16());
98 item_ids->push_back(WebAutofillClient::MenuItemIDDataListEntry); 98 item_ids->push_back(WebAutofillClient::MenuItemIDDataListEntry);
99 } 99 }
100 } 100 }
101 101
102 // Trim the vectors before sending them to the browser process to ensure we 102 // Trim the vectors before sending them to the browser process to ensure we
103 // don't send too much data through the IPC. 103 // don't send too much data through the IPC.
104 void TrimDataListsForIPC(std::vector<string16>* values, 104 void TrimDataListsForIPC(std::vector<base::string16>* values,
105 std::vector<string16>* labels, 105 std::vector<base::string16>* labels,
106 std::vector<string16>* icons, 106 std::vector<base::string16>* icons,
107 std::vector<int>* unique_ids) { 107 std::vector<int>* unique_ids) {
108 // Limit the size of the vectors. 108 // Limit the size of the vectors.
109 if (values->size() > kMaximumDataListSizeForAutofill) { 109 if (values->size() > kMaximumDataListSizeForAutofill) {
110 values->resize(kMaximumDataListSizeForAutofill); 110 values->resize(kMaximumDataListSizeForAutofill);
111 labels->resize(kMaximumDataListSizeForAutofill); 111 labels->resize(kMaximumDataListSizeForAutofill);
112 icons->resize(kMaximumDataListSizeForAutofill); 112 icons->resize(kMaximumDataListSizeForAutofill);
113 unique_ids->resize(kMaximumDataListSizeForAutofill); 113 unique_ids->resize(kMaximumDataListSizeForAutofill);
114 } 114 }
115 115
116 // Limit the size of the strings in the vectors 116 // Limit the size of the strings in the vectors
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 if (password_autofill_agent_->TextFieldHandlingKeyDown(element, event)) { 488 if (password_autofill_agent_->TextFieldHandlingKeyDown(element, event)) {
489 element_ = element; 489 element_ = element;
490 return; 490 return;
491 } 491 }
492 492
493 if (event.windowsKeyCode == ui::VKEY_DOWN || 493 if (event.windowsKeyCode == ui::VKEY_DOWN ||
494 event.windowsKeyCode == ui::VKEY_UP) 494 event.windowsKeyCode == ui::VKEY_UP)
495 ShowSuggestions(element, true, true, true); 495 ShowSuggestions(element, true, true, true);
496 } 496 }
497 497
498 void AutofillAgent::OnSuggestionsReturned(int query_id, 498 void AutofillAgent::OnSuggestionsReturned(
499 const std::vector<string16>& values, 499 int query_id,
500 const std::vector<string16>& labels, 500 const std::vector<base::string16>& values,
501 const std::vector<string16>& icons, 501 const std::vector<base::string16>& labels,
502 const std::vector<int>& unique_ids) { 502 const std::vector<base::string16>& icons,
503 const std::vector<int>& unique_ids) {
503 if (query_id != autofill_query_id_) 504 if (query_id != autofill_query_id_)
504 return; 505 return;
505 506
506 if (element_.isNull() || !element_.isFocusable()) 507 if (element_.isNull() || !element_.isFocusable())
507 return; 508 return;
508 509
509 std::vector<string16> v(values); 510 std::vector<base::string16> v(values);
510 std::vector<string16> l(labels); 511 std::vector<base::string16> l(labels);
511 std::vector<string16> i(icons); 512 std::vector<base::string16> i(icons);
512 std::vector<int> ids(unique_ids); 513 std::vector<int> ids(unique_ids);
513 514
514 if (!element_.autoComplete() && !v.empty()) { 515 if (!element_.autoComplete() && !v.empty()) {
515 // If autofill is disabled and we had suggestions, show a warning instead. 516 // If autofill is disabled and we had suggestions, show a warning instead.
516 v.assign(1, l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED)); 517 v.assign(1, l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED));
517 l.assign(1, string16()); 518 l.assign(1, base::string16());
518 i.assign(1, string16()); 519 i.assign(1, base::string16());
519 ids.assign(1, WebAutofillClient::MenuItemIDWarningMessage); 520 ids.assign(1, WebAutofillClient::MenuItemIDWarningMessage);
520 } else if (ids.size() > 1 && 521 } else if (ids.size() > 1 &&
521 ids[0] == WebAutofillClient::MenuItemIDWarningMessage) { 522 ids[0] == WebAutofillClient::MenuItemIDWarningMessage) {
522 // If we received an autofill warning plus some autocomplete suggestions, 523 // If we received an autofill warning plus some autocomplete suggestions,
523 // remove the autofill warning. 524 // remove the autofill warning.
524 v.erase(v.begin()); 525 v.erase(v.begin());
525 l.erase(l.begin()); 526 l.erase(l.begin());
526 i.erase(i.begin()); 527 i.erase(i.begin());
527 ids.erase(ids.begin()); 528 ids.erase(ids.begin());
528 } 529 }
(...skipping 11 matching lines...) Expand all
540 // items, identified by |unique_ids| having at least one valid value. 541 // items, identified by |unique_ids| having at least one valid value.
541 bool has_autofill_item = false; 542 bool has_autofill_item = false;
542 for (size_t i = 0; i < ids.size(); ++i) { 543 for (size_t i = 0; i < ids.size(); ++i) {
543 if (ids[i] > 0) { 544 if (ids[i] > 0) {
544 has_autofill_item = true; 545 has_autofill_item = true;
545 break; 546 break;
546 } 547 }
547 } 548 }
548 549
549 if (has_autofill_item) { 550 if (has_autofill_item) {
550 v.push_back(string16()); 551 v.push_back(base::string16());
551 l.push_back(string16()); 552 l.push_back(base::string16());
552 i.push_back(string16()); 553 i.push_back(base::string16());
553 ids.push_back(WebAutofillClient::MenuItemIDSeparator); 554 ids.push_back(WebAutofillClient::MenuItemIDSeparator);
554 555
555 if (FormWithElementIsAutofilled(element_)) { 556 if (FormWithElementIsAutofilled(element_)) {
556 // The form has been auto-filled, so give the user the chance to clear the 557 // The form has been auto-filled, so give the user the chance to clear the
557 // form. Append the 'Clear form' menu item. 558 // form. Append the 'Clear form' menu item.
558 v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_CLEAR_FORM_MENU_ITEM)); 559 v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_CLEAR_FORM_MENU_ITEM));
559 l.push_back(string16()); 560 l.push_back(base::string16());
560 i.push_back(string16()); 561 i.push_back(base::string16());
561 ids.push_back(WebAutofillClient::MenuItemIDClearForm); 562 ids.push_back(WebAutofillClient::MenuItemIDClearForm);
562 } 563 }
563 564
564 // Append the 'Chrome Autofill options' menu item; 565 // Append the 'Chrome Autofill options' menu item;
565 v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS_POPUP)); 566 v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS_POPUP));
566 l.push_back(string16()); 567 l.push_back(base::string16());
567 i.push_back(string16()); 568 i.push_back(base::string16());
568 ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions); 569 ids.push_back(WebAutofillClient::MenuItemIDAutofillOptions);
569 } 570 }
570 571
571 CombineDataListEntriesAndShow(element_, v, l, i, ids, has_autofill_item); 572 CombineDataListEntriesAndShow(element_, v, l, i, ids, has_autofill_item);
572 } 573 }
573 574
574 void AutofillAgent::CombineDataListEntriesAndShow( 575 void AutofillAgent::CombineDataListEntriesAndShow(
575 const WebKit::WebInputElement& element, 576 const WebKit::WebInputElement& element,
576 const std::vector<string16>& values, 577 const std::vector<base::string16>& values,
577 const std::vector<string16>& labels, 578 const std::vector<base::string16>& labels,
578 const std::vector<string16>& icons, 579 const std::vector<base::string16>& icons,
579 const std::vector<int>& item_ids, 580 const std::vector<int>& item_ids,
580 bool has_autofill_item) { 581 bool has_autofill_item) {
581 std::vector<string16> v; 582 std::vector<base::string16> v;
582 std::vector<string16> l; 583 std::vector<base::string16> l;
583 std::vector<string16> i; 584 std::vector<base::string16> i;
584 std::vector<int> ids; 585 std::vector<int> ids;
585 586
586 AppendDataListSuggestions(element, &v, &l, &i, &ids); 587 AppendDataListSuggestions(element, &v, &l, &i, &ids);
587 588
588 // If there are both <datalist> items and Autofill suggestions, add a 589 // If there are both <datalist> items and Autofill suggestions, add a
589 // separator between them. 590 // separator between them.
590 if (!v.empty() && !values.empty()) { 591 if (!v.empty() && !values.empty()) {
591 v.push_back(string16()); 592 v.push_back(base::string16());
592 l.push_back(string16()); 593 l.push_back(base::string16());
593 i.push_back(string16()); 594 i.push_back(base::string16());
594 ids.push_back(WebAutofillClient::MenuItemIDSeparator); 595 ids.push_back(WebAutofillClient::MenuItemIDSeparator);
595 } 596 }
596 597
597 // Append the Autofill suggestions. 598 // Append the Autofill suggestions.
598 v.insert(v.end(), values.begin(), values.end()); 599 v.insert(v.end(), values.begin(), values.end());
599 l.insert(l.end(), labels.begin(), labels.end()); 600 l.insert(l.end(), labels.begin(), labels.end());
600 i.insert(i.end(), icons.begin(), icons.end()); 601 i.insert(i.end(), icons.begin(), icons.end());
601 ids.insert(ids.end(), item_ids.begin(), item_ids.end()); 602 ids.insert(ids.end(), item_ids.begin(), item_ids.end());
602 603
603 if (v.empty()) { 604 if (v.empty()) {
604 // No suggestions, any popup currently showing is obsolete. 605 // No suggestions, any popup currently showing is obsolete.
605 HideAutofillUi(); 606 HideAutofillUi();
606 return; 607 return;
607 } 608 }
608 609
609 WebKit::WebView* web_view = render_view()->GetWebView(); 610 WebKit::WebView* web_view = render_view()->GetWebView();
610 if (!web_view) 611 if (!web_view)
611 return; 612 return;
612 613
613 // Send to WebKit for display. 614 // Send to WebKit for display.
614 web_view->applyAutofillSuggestions(element, v, l, i, ids); 615 web_view->applyAutofillSuggestions(element, v, l, i, ids);
615 616
616 Send(new AutofillHostMsg_DidShowAutofillSuggestions( 617 Send(new AutofillHostMsg_DidShowAutofillSuggestions(
617 routing_id(), 618 routing_id(),
618 has_autofill_item && !has_shown_autofill_popup_for_current_edit_)); 619 has_autofill_item && !has_shown_autofill_popup_for_current_edit_));
619 has_shown_autofill_popup_for_current_edit_ |= has_autofill_item; 620 has_shown_autofill_popup_for_current_edit_ |= has_autofill_item;
620 } 621 }
621 622
622 void AutofillAgent::AcceptDataListSuggestion(const string16& suggested_value) { 623 void AutofillAgent::AcceptDataListSuggestion(
623 string16 new_value = suggested_value; 624 const base::string16& suggested_value) {
625 base::string16 new_value = suggested_value;
624 // If this element takes multiple values then replace the last part with 626 // If this element takes multiple values then replace the last part with
625 // the suggestion. 627 // the suggestion.
626 if (element_.isMultiple() && 628 if (element_.isMultiple() &&
627 element_.formControlType() == WebString::fromUTF8("email")) { 629 element_.formControlType() == WebString::fromUTF8("email")) {
628 std::vector<string16> parts; 630 std::vector<base::string16> parts;
629 631
630 base::SplitStringDontTrim(element_.editingValue(), ',', &parts); 632 base::SplitStringDontTrim(element_.editingValue(), ',', &parts);
631 if (parts.size() == 0) 633 if (parts.size() == 0)
632 parts.push_back(string16()); 634 parts.push_back(base::string16());
633 635
634 string16 last_part = parts.back(); 636 base::string16 last_part = parts.back();
635 // We want to keep just the leading whitespace. 637 // We want to keep just the leading whitespace.
636 for (size_t i = 0; i < last_part.size(); ++i) { 638 for (size_t i = 0; i < last_part.size(); ++i) {
637 if (!IsWhitespace(last_part[i])) { 639 if (!IsWhitespace(last_part[i])) {
638 last_part = last_part.substr(0, i); 640 last_part = last_part.substr(0, i);
639 break; 641 break;
640 } 642 }
641 } 643 }
642 last_part.append(suggested_value); 644 last_part.append(suggested_value);
643 parts[parts.size() - 1] = last_part; 645 parts[parts.size() - 1] = last_part;
644 646
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 } 688 }
687 689
688 void AutofillAgent::OnSetAutofillActionPreview() { 690 void AutofillAgent::OnSetAutofillActionPreview() {
689 autofill_action_ = AUTOFILL_PREVIEW; 691 autofill_action_ = AUTOFILL_PREVIEW;
690 } 692 }
691 693
692 void AutofillAgent::OnClearPreviewedForm() { 694 void AutofillAgent::OnClearPreviewedForm() {
693 didClearAutofillSelection(element_); 695 didClearAutofillSelection(element_);
694 } 696 }
695 697
696 void AutofillAgent::OnSetNodeText(const string16& value) { 698 void AutofillAgent::OnSetNodeText(const base::string16& value) {
697 SetNodeText(value, &element_); 699 SetNodeText(value, &element_);
698 } 700 }
699 701
700 void AutofillAgent::OnAcceptDataListSuggestion(const string16& value) { 702 void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) {
701 AcceptDataListSuggestion(value); 703 AcceptDataListSuggestion(value);
702 } 704 }
703 705
704 void AutofillAgent::OnAcceptPasswordAutofillSuggestion(const string16& value) { 706 void AutofillAgent::OnAcceptPasswordAutofillSuggestion(
707 const base::string16& value) {
705 // We need to make sure this is handled here because the browser process 708 // We need to make sure this is handled here because the browser process
706 // skipped it handling because it believed it would be handled here. If it 709 // skipped it handling because it believed it would be handled here. If it
707 // isn't handled here then the browser logic needs to be updated. 710 // isn't handled here then the browser logic needs to be updated.
708 bool handled = password_autofill_agent_->DidAcceptAutofillSuggestion( 711 bool handled = password_autofill_agent_->DidAcceptAutofillSuggestion(
709 element_, 712 element_,
710 value); 713 value);
711 DCHECK(handled); 714 DCHECK(handled);
712 } 715 }
713 716
714 void AutofillAgent::OnGetAllForms() { 717 void AutofillAgent::OnGetAllForms() {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 return; 809 return;
807 810
808 // If autocomplete is disabled at the form level, then we might want to show a 811 // If autocomplete is disabled at the form level, then we might want to show a
809 // warning in place of suggestions. However, if autocomplete is disabled 812 // warning in place of suggestions. However, if autocomplete is disabled
810 // specifically for this field, we never want to show a warning. Otherwise, 813 // specifically for this field, we never want to show a warning. Otherwise,
811 // we might interfere with custom popups (e.g. search suggestions) used by the 814 // we might interfere with custom popups (e.g. search suggestions) used by the
812 // website. Note that we cannot use the WebKit method element.autoComplete() 815 // website. Note that we cannot use the WebKit method element.autoComplete()
813 // as it does not allow us to distinguish the case where autocomplete is 816 // as it does not allow us to distinguish the case where autocomplete is
814 // disabled for *both* the element and for the form. 817 // disabled for *both* the element and for the form.
815 // Also, if the field has no name, then we won't have values. 818 // Also, if the field has no name, then we won't have values.
816 const string16 autocomplete_attribute = element.getAttribute("autocomplete"); 819 const base::string16 autocomplete_attribute =
820 element.getAttribute("autocomplete");
817 if (LowerCaseEqualsASCII(autocomplete_attribute, "off") || 821 if (LowerCaseEqualsASCII(autocomplete_attribute, "off") ||
818 element.nameForAutofill().isEmpty()) { 822 element.nameForAutofill().isEmpty()) {
819 CombineDataListEntriesAndShow(element, std::vector<string16>(), 823 CombineDataListEntriesAndShow(element, std::vector<base::string16>(),
820 std::vector<string16>(), 824 std::vector<base::string16>(),
821 std::vector<string16>(), 825 std::vector<base::string16>(),
822 std::vector<int>(), false); 826 std::vector<int>(), false);
823 return; 827 return;
824 } 828 }
825 829
826 QueryAutofillSuggestions(element, display_warning_if_disabled); 830 QueryAutofillSuggestions(element, display_warning_if_disabled);
827 } 831 }
828 832
829 void AutofillAgent::QueryAutofillSuggestions(const WebInputElement& element, 833 void AutofillAgent::QueryAutofillSuggestions(const WebInputElement& element,
830 bool display_warning_if_disabled) { 834 bool display_warning_if_disabled) {
831 if (!element.document().frame()) 835 if (!element.document().frame())
(...skipping 19 matching lines...) Expand all
851 if (!FindFormAndFieldForInputElement(element, &form, &field, requirements)) { 855 if (!FindFormAndFieldForInputElement(element, &form, &field, requirements)) {
852 // If we didn't find the cached form, at least let autocomplete have a shot 856 // If we didn't find the cached form, at least let autocomplete have a shot
853 // at providing suggestions. 857 // at providing suggestions.
854 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field); 858 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field);
855 } 859 }
856 860
857 gfx::RectF bounding_box_scaled = 861 gfx::RectF bounding_box_scaled =
858 GetScaledBoundingBox(web_view_->pageScaleFactor(), &element_); 862 GetScaledBoundingBox(web_view_->pageScaleFactor(), &element_);
859 863
860 // Find the datalist values and send them to the browser process. 864 // Find the datalist values and send them to the browser process.
861 std::vector<string16> data_list_values; 865 std::vector<base::string16> data_list_values;
862 std::vector<string16> data_list_labels; 866 std::vector<base::string16> data_list_labels;
863 std::vector<string16> data_list_icons; 867 std::vector<base::string16> data_list_icons;
864 std::vector<int> data_list_unique_ids; 868 std::vector<int> data_list_unique_ids;
865 AppendDataListSuggestions(element_, 869 AppendDataListSuggestions(element_,
866 &data_list_values, 870 &data_list_values,
867 &data_list_labels, 871 &data_list_labels,
868 &data_list_icons, 872 &data_list_icons,
869 &data_list_unique_ids); 873 &data_list_unique_ids);
870 874
871 TrimDataListsForIPC(&data_list_values, 875 TrimDataListsForIPC(&data_list_values,
872 &data_list_labels, 876 &data_list_labels,
873 &data_list_icons, 877 &data_list_icons,
(...skipping 30 matching lines...) Expand all
904 if (!FindFormAndFieldForInputElement(node.toConst<WebInputElement>(), &form, 908 if (!FindFormAndFieldForInputElement(node.toConst<WebInputElement>(), &form,
905 &field, REQUIRE_AUTOCOMPLETE)) { 909 &field, REQUIRE_AUTOCOMPLETE)) {
906 return; 910 return;
907 } 911 }
908 912
909 autofill_action_ = action; 913 autofill_action_ = action;
910 Send(new AutofillHostMsg_FillAutofillFormData( 914 Send(new AutofillHostMsg_FillAutofillFormData(
911 routing_id(), autofill_query_id_, form, field, unique_id)); 915 routing_id(), autofill_query_id_, form, field, unique_id));
912 } 916 }
913 917
914 void AutofillAgent::SetNodeText(const string16& value, 918 void AutofillAgent::SetNodeText(const base::string16& value,
915 WebKit::WebInputElement* node) { 919 WebKit::WebInputElement* node) {
916 did_set_node_text_ = true; 920 did_set_node_text_ = true;
917 string16 substring = value; 921 base::string16 substring = value;
918 substring = substring.substr(0, node->maxLength()); 922 substring = substring.substr(0, node->maxLength());
919 923
920 node->setEditingValue(substring); 924 node->setEditingValue(substring);
921 } 925 }
922 926
923 void AutofillAgent::HideAutofillUi() { 927 void AutofillAgent::HideAutofillUi() {
924 WebKit::WebView* web_view = render_view()->GetWebView(); 928 WebKit::WebView* web_view = render_view()->GetWebView();
925 if (web_view) 929 if (web_view)
926 web_view->hidePopups(); 930 web_view->hidePopups();
927 931
928 HideHostAutofillUi(); 932 HideHostAutofillUi();
929 } 933 }
930 934
931 void AutofillAgent::HideHostAutofillUi() { 935 void AutofillAgent::HideHostAutofillUi() {
932 Send(new AutofillHostMsg_HideAutofillUi(routing_id())); 936 Send(new AutofillHostMsg_HideAutofillUi(routing_id()));
933 } 937 }
934 938
935 } // namespace autofill 939 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698