| OLD | NEW |
| 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "components/autofill/browser/autocomplete_history_manager.h" | 6 #include "components/autofill/browser/autocomplete_history_manager.h" |
| 7 #include "components/autofill/browser/autofill_external_delegate.h" | 7 #include "components/autofill/browser/autofill_external_delegate.h" |
| 8 #include "components/autofill/browser/autofill_manager.h" | 8 #include "components/autofill/browser/autofill_manager.h" |
| 9 #include "components/autofill/common/autofill_messages.h" | 9 #include "components/autofill/common/autofill_messages.h" |
| 10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 if (values.empty()) { | 128 if (values.empty()) { |
| 129 // No suggestions, any popup currently showing is obsolete. | 129 // No suggestions, any popup currently showing is obsolete. |
| 130 autofill_manager_->delegate()->HideAutofillPopup(); | 130 autofill_manager_->delegate()->HideAutofillPopup(); |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Send to display. | 134 // Send to display. |
| 135 if (autofill_query_field_.is_focusable) { | 135 if (autofill_query_field_.is_focusable) { |
| 136 autofill_manager_->delegate()->ShowAutofillPopup( | 136 autofill_manager_->delegate()->ShowAutofillPopup( |
| 137 element_bounds_, values, labels, icons, ids, GetWeakPtr()); | 137 element_bounds_, |
| 138 autofill_query_field_.is_rtl, |
| 139 values, |
| 140 labels, |
| 141 icons, |
| 142 ids, |
| 143 GetWeakPtr()); |
| 138 } | 144 } |
| 139 } | 145 } |
| 140 | 146 |
| 141 void AutofillExternalDelegate::OnShowPasswordSuggestions( | 147 void AutofillExternalDelegate::OnShowPasswordSuggestions( |
| 142 const std::vector<base::string16>& suggestions, | 148 const std::vector<base::string16>& suggestions, |
| 143 const FormFieldData& field, | 149 const FormFieldData& field, |
| 144 const gfx::RectF& element_bounds) { | 150 const gfx::RectF& element_bounds) { |
| 145 autofill_query_field_ = field; | 151 autofill_query_field_ = field; |
| 146 element_bounds_ = element_bounds; | 152 element_bounds_ = element_bounds; |
| 147 | 153 |
| 148 if (suggestions.empty()) { | 154 if (suggestions.empty()) { |
| 149 autofill_manager_->delegate()->HideAutofillPopup(); | 155 autofill_manager_->delegate()->HideAutofillPopup(); |
| 150 return; | 156 return; |
| 151 } | 157 } |
| 152 | 158 |
| 153 std::vector<base::string16> empty(suggestions.size()); | 159 std::vector<base::string16> empty(suggestions.size()); |
| 154 std::vector<int> password_ids(suggestions.size(), | 160 std::vector<int> password_ids(suggestions.size(), |
| 155 WebAutofillClient::MenuItemIDPasswordEntry); | 161 WebAutofillClient::MenuItemIDPasswordEntry); |
| 156 autofill_manager_->delegate()->ShowAutofillPopup( | 162 autofill_manager_->delegate()->ShowAutofillPopup( |
| 157 element_bounds_, suggestions, empty, empty, password_ids, GetWeakPtr()); | 163 element_bounds_, |
| 164 autofill_query_field_.is_rtl, |
| 165 suggestions, |
| 166 empty, |
| 167 empty, |
| 168 password_ids, |
| 169 GetWeakPtr()); |
| 158 } | 170 } |
| 159 | 171 |
| 160 void AutofillExternalDelegate::SetCurrentDataListValues( | 172 void AutofillExternalDelegate::SetCurrentDataListValues( |
| 161 const std::vector<base::string16>& data_list_values, | 173 const std::vector<base::string16>& data_list_values, |
| 162 const std::vector<base::string16>& data_list_labels, | 174 const std::vector<base::string16>& data_list_labels, |
| 163 const std::vector<base::string16>& data_list_icons, | 175 const std::vector<base::string16>& data_list_icons, |
| 164 const std::vector<int>& data_list_unique_ids) { | 176 const std::vector<int>& data_list_unique_ids) { |
| 165 data_list_values_ = data_list_values; | 177 data_list_values_ = data_list_values; |
| 166 data_list_labels_ = data_list_labels; | 178 data_list_labels_ = data_list_labels; |
| 167 data_list_icons_ = data_list_icons; | 179 data_list_icons_ = data_list_icons; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 if (!*content::Details<bool>(details).ptr()) | 395 if (!*content::Details<bool>(details).ptr()) |
| 384 autofill_manager_->delegate()->HideAutofillPopup(); | 396 autofill_manager_->delegate()->HideAutofillPopup(); |
| 385 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { | 397 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { |
| 386 autofill_manager_->delegate()->HideAutofillPopup(); | 398 autofill_manager_->delegate()->HideAutofillPopup(); |
| 387 } else { | 399 } else { |
| 388 NOTREACHED(); | 400 NOTREACHED(); |
| 389 } | 401 } |
| 390 } | 402 } |
| 391 | 403 |
| 392 } // namespace autofill | 404 } // namespace autofill |
| OLD | NEW |