| Index: chrome/renderer/render_view.cc
|
| diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
|
| index 1931d098af365ace51dc65cc302fa01885eacb69..4d5613298d623d7e495ed04951515c03d008bcee 100644
|
| --- a/chrome/renderer/render_view.cc
|
| +++ b/chrome/renderer/render_view.cc
|
| @@ -1514,41 +1514,45 @@ void RenderView::OnAutoFillSuggestionsReturned(
|
| int query_id,
|
| const std::vector<string16>& values,
|
| const std::vector<string16>& labels) {
|
| - if (webview() && query_id == autofill_query_id_) {
|
| - std::vector<string16> v(values);
|
| - std::vector<string16> l(labels);
|
| - int separator_index = -1;
|
| -
|
| - // The form has been auto-filled, so give the user the chance to clear the
|
| - // form. Append the 'Clear form' menu item.
|
| - if (form_manager_.FormWithNodeIsAutoFilled(autofill_query_node_)) {
|
| - v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_CLEAR_FORM_MENU_ITEM));
|
| - l.push_back(string16());
|
| - suggestions_clear_index_ = v.size() - 1;
|
| - separator_index = values.size();
|
| - }
|
| -
|
| - size_t labeled_item_count = 0;
|
| - for (size_t i = 0; i < l.size(); ++i) {
|
| - if (!l[i].empty())
|
| - labeled_item_count++;
|
| - }
|
| -
|
| - // Only include "AutoFill Options" special menu item if we have labeled
|
| - // items.
|
| - if (labeled_item_count > 0) {
|
| - // Append the 'AutoFill Options...' menu item.
|
| - v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS));
|
| - l.push_back(string16());
|
| - suggestions_options_index_ = v.size() - 1;
|
| - separator_index = values.size();
|
| - }
|
| + if (!webview() || query_id != autofill_query_id_)
|
| + return;
|
|
|
| - // Send to WebKit for display.
|
| - if (!v.empty())
|
| - webview()->applyAutoFillSuggestions(
|
| - autofill_query_node_, v, l, separator_index);
|
| - }
|
| + // Any popup currently showing is now obsolete.
|
| + webview()->hidePopups();
|
| +
|
| + std::vector<string16> v(values);
|
| + std::vector<string16> l(labels);
|
| + int separator_index = -1;
|
| +
|
| + // The form has been auto-filled, so give the user the chance to clear the
|
| + // form. Append the 'Clear form' menu item.
|
| + if (form_manager_.FormWithNodeIsAutoFilled(autofill_query_node_)) {
|
| + v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_CLEAR_FORM_MENU_ITEM));
|
| + l.push_back(string16());
|
| + suggestions_clear_index_ = v.size() - 1;
|
| + separator_index = values.size();
|
| + }
|
| +
|
| + size_t labeled_item_count = 0;
|
| + for (size_t i = 0; i < l.size(); ++i) {
|
| + if (!l[i].empty())
|
| + labeled_item_count++;
|
| + }
|
| +
|
| + // Only include "AutoFill Options" special menu item if we have labeled
|
| + // items.
|
| + if (labeled_item_count > 0) {
|
| + // Append the 'AutoFill Options...' menu item.
|
| + v.push_back(l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS));
|
| + l.push_back(string16());
|
| + suggestions_options_index_ = v.size() - 1;
|
| + separator_index = values.size();
|
| + }
|
| +
|
| + // Send to WebKit for display.
|
| + if (!v.empty())
|
| + webview()->applyAutoFillSuggestions(
|
| + autofill_query_node_, v, l, separator_index);
|
| }
|
|
|
| void RenderView::OnAutoFillFormDataFilled(int query_id,
|
|
|