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

Side by Side Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 3071003: AutoFill: Display a right-aligned generic CC icon in the suggestions popup for (Closed)
Patch Set: Rebase. Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/render_view_host.h" 5 #include "chrome/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 // the render view. 1603 // the render view.
1604 if (autofill_delegate && 1604 if (autofill_delegate &&
1605 autofill_delegate->GetAutoFillSuggestions(query_id, 1605 autofill_delegate->GetAutoFillSuggestions(query_id,
1606 form_autofilled, 1606 form_autofilled,
1607 field)) { 1607 field)) {
1608 } else { 1608 } else {
1609 // No suggestions provided, so supply an empty vector as the results. 1609 // No suggestions provided, so supply an empty vector as the results.
1610 AutoFillSuggestionsReturned(query_id, 1610 AutoFillSuggestionsReturned(query_id,
1611 std::vector<string16>(), 1611 std::vector<string16>(),
1612 std::vector<string16>(), 1612 std::vector<string16>(),
1613 std::vector<string16>(),
1613 std::vector<int>()); 1614 std::vector<int>());
1614 } 1615 }
1615 1616
1616 RenderViewHostDelegate::Autocomplete* autocomplete_delegate = 1617 RenderViewHostDelegate::Autocomplete* autocomplete_delegate =
1617 delegate_->GetAutocompleteDelegate(); 1618 delegate_->GetAutocompleteDelegate();
1618 if (autocomplete_delegate && 1619 if (autocomplete_delegate &&
1619 autocomplete_delegate->GetAutocompleteSuggestions( 1620 autocomplete_delegate->GetAutocompleteSuggestions(
1620 query_id, field.name(), field.value())) { 1621 query_id, field.name(), field.value())) {
1621 } else { 1622 } else {
1622 // No suggestions provided, so send an empty vector as the results. 1623 // No suggestions provided, so send an empty vector as the results.
(...skipping 29 matching lines...) Expand all
1652 return; 1653 return;
1653 1654
1654 autofill_delegate->FillAutoFillFormData( 1655 autofill_delegate->FillAutoFillFormData(
1655 query_id, form, name, label, unique_id); 1656 query_id, form, name, label, unique_id);
1656 } 1657 }
1657 1658
1658 void RenderViewHost::AutoFillSuggestionsReturned( 1659 void RenderViewHost::AutoFillSuggestionsReturned(
1659 int query_id, 1660 int query_id,
1660 const std::vector<string16>& names, 1661 const std::vector<string16>& names,
1661 const std::vector<string16>& labels, 1662 const std::vector<string16>& labels,
1663 const std::vector<string16>& icons,
1662 const std::vector<int>& unique_ids) { 1664 const std::vector<int>& unique_ids) {
1663 autofill_query_id_ = query_id; 1665 autofill_query_id_ = query_id;
1664 autofill_values_.assign(names.begin(), names.end()); 1666 autofill_values_.assign(names.begin(), names.end());
1665 autofill_labels_.assign(labels.begin(), labels.end()); 1667 autofill_labels_.assign(labels.begin(), labels.end());
1668 autofill_icons_.assign(icons.begin(), icons.end());
1666 autofill_unique_ids_.assign(unique_ids.begin(), unique_ids.end()); 1669 autofill_unique_ids_.assign(unique_ids.begin(), unique_ids.end());
1667 } 1670 }
1668 1671
1669 void RenderViewHost::AutocompleteSuggestionsReturned( 1672 void RenderViewHost::AutocompleteSuggestionsReturned(
1670 int query_id, const std::vector<string16>& suggestions) { 1673 int query_id, const std::vector<string16>& suggestions) {
1671 // When query IDs match we are responding to an AutoFill and Autocomplete 1674 // When query IDs match we are responding to an AutoFill and Autocomplete
1672 // combined query response. 1675 // combined query response.
1673 // Otherwise Autocomplete is canceling, so we only send suggestions (usually 1676 // Otherwise Autocomplete is canceling, so we only send suggestions (usually
1674 // an empty list). 1677 // an empty list).
1675 if (autofill_query_id_ != query_id) { 1678 if (autofill_query_id_ != query_id) {
1676 // Autocomplete is canceling. 1679 // Autocomplete is canceling.
1677 autofill_values_.clear(); 1680 autofill_values_.clear();
1678 autofill_labels_.clear(); 1681 autofill_labels_.clear();
1682 autofill_icons_.clear();
1679 autofill_unique_ids_.clear(); 1683 autofill_unique_ids_.clear();
1680 } 1684 }
1681 1685
1682 // Combine AutoFill and Autocomplete values into values and labels. 1686 // Combine AutoFill and Autocomplete values into values and labels.
1683 for (size_t i = 0; i < suggestions.size(); ++i) { 1687 for (size_t i = 0; i < suggestions.size(); ++i) {
1684 bool unique = true; 1688 bool unique = true;
1685 for (size_t j = 0; j < autofill_values_.size(); ++j) { 1689 for (size_t j = 0; j < autofill_values_.size(); ++j) {
1686 // If the AutoFill label is empty, we need to make sure we don't add a 1690 // If the AutoFill label is empty, we need to make sure we don't add a
1687 // duplicate value. 1691 // duplicate value.
1688 if (autofill_labels_[j].empty() && 1692 if (autofill_labels_[j].empty() &&
1689 autofill_values_[j] == suggestions[i]) { 1693 autofill_values_[j] == suggestions[i]) {
1690 unique = false; 1694 unique = false;
1691 break; 1695 break;
1692 } 1696 }
1693 } 1697 }
1694 1698
1695 if (unique) { 1699 if (unique) {
1696 autofill_values_.push_back(suggestions[i]); 1700 autofill_values_.push_back(suggestions[i]);
1697 autofill_labels_.push_back(string16()); 1701 autofill_labels_.push_back(string16());
1702 autofill_icons_.push_back(string16());
1698 autofill_unique_ids_.push_back(0); // 0 means no profile. 1703 autofill_unique_ids_.push_back(0); // 0 means no profile.
1699 } 1704 }
1700 } 1705 }
1701 1706
1702 Send(new ViewMsg_AutoFillSuggestionsReturned(routing_id(), 1707 Send(new ViewMsg_AutoFillSuggestionsReturned(routing_id(),
1703 query_id, 1708 query_id,
1704 autofill_values_, 1709 autofill_values_,
1705 autofill_labels_, 1710 autofill_labels_,
1711 autofill_icons_,
1706 autofill_unique_ids_)); 1712 autofill_unique_ids_));
1707 } 1713 }
1708 1714
1709 void RenderViewHost::AutoFillFormDataFilled(int query_id, 1715 void RenderViewHost::AutoFillFormDataFilled(int query_id,
1710 const FormData& form) { 1716 const FormData& form) {
1711 Send(new ViewMsg_AutoFillFormDataFilled(routing_id(), query_id, form)); 1717 Send(new ViewMsg_AutoFillFormDataFilled(routing_id(), query_id, form));
1712 } 1718 }
1713 1719
1714 void RenderViewHost::WindowMoveOrResizeStarted() { 1720 void RenderViewHost::WindowMoveOrResizeStarted() {
1715 Send(new ViewMsg_MoveOrResizeStarted(routing_id())); 1721 Send(new ViewMsg_MoveOrResizeStarted(routing_id()));
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 delegate_->GetContentSettingsDelegate(); 1975 delegate_->GetContentSettingsDelegate();
1970 if (content_settings_delegate) 1976 if (content_settings_delegate)
1971 content_settings_delegate->OnWebDatabaseAccessed( 1977 content_settings_delegate->OnWebDatabaseAccessed(
1972 url, name, display_name, estimated_size, blocked_by_policy); 1978 url, name, display_name, estimated_size, blocked_by_policy);
1973 } 1979 }
1974 1980
1975 void RenderViewHost::OnSetDisplayingPDFContent() { 1981 void RenderViewHost::OnSetDisplayingPDFContent() {
1976 delegate_->SetDisplayingPDFContent(); 1982 delegate_->SetDisplayingPDFContent();
1977 } 1983 }
1978 1984
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698