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