| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/core/browser/autofill_external_delegate.h" | 5 #include "components/autofill/core/browser/autofill_external_delegate.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 8 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
| 9 #include "components/autofill/core/browser/autofill_manager.h" | 9 #include "components/autofill/core/browser/autofill_manager.h" |
| 10 #include "components/autofill/core/common/autofill_messages.h" | 10 #include "components/autofill/core/common/autofill_messages.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 registered_keyboard_listener_with_->AddKeyboardListener(listener); | 162 registered_keyboard_listener_with_->AddKeyboardListener(listener); |
| 163 } | 163 } |
| 164 | 164 |
| 165 autofill_manager_->OnDidShowAutofillSuggestions( | 165 autofill_manager_->OnDidShowAutofillSuggestions( |
| 166 has_autofill_suggestion_ && !has_shown_autofill_popup_for_current_edit_); | 166 has_autofill_suggestion_ && !has_shown_autofill_popup_for_current_edit_); |
| 167 has_shown_autofill_popup_for_current_edit_ |= has_autofill_suggestion_; | 167 has_shown_autofill_popup_for_current_edit_ |= has_autofill_suggestion_; |
| 168 } | 168 } |
| 169 | 169 |
| 170 void AutofillExternalDelegate::OnPopupHidden( | 170 void AutofillExternalDelegate::OnPopupHidden( |
| 171 content::KeyboardListener* listener) { | 171 content::KeyboardListener* listener) { |
| 172 if (registered_keyboard_listener_with_ == web_contents_->GetRenderViewHost()) | 172 if ((!web_contents_->IsBeingDestroyed()) && |
| 173 (registered_keyboard_listener_with_ == |
| 174 web_contents_->GetRenderViewHost())) { |
| 173 web_contents_->GetRenderViewHost()->RemoveKeyboardListener(listener); | 175 web_contents_->GetRenderViewHost()->RemoveKeyboardListener(listener); |
| 176 } |
| 174 | 177 |
| 175 registered_keyboard_listener_with_ = NULL; | 178 registered_keyboard_listener_with_ = NULL; |
| 176 } | 179 } |
| 177 | 180 |
| 178 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) { | 181 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) { |
| 179 ClearPreviewedForm(); | 182 ClearPreviewedForm(); |
| 180 | 183 |
| 181 // Only preview the data if it is a profile. | 184 // Only preview the data if it is a profile. |
| 182 if (identifier > 0) | 185 if (identifier > 0) |
| 183 FillAutofillFormData(identifier, true); | 186 FillAutofillFormData(identifier, true); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 data_list_labels_.end()); | 370 data_list_labels_.end()); |
| 368 autofill_icons->insert(autofill_icons->begin(), | 371 autofill_icons->insert(autofill_icons->begin(), |
| 369 data_list_icons_.begin(), | 372 data_list_icons_.begin(), |
| 370 data_list_icons_.end()); | 373 data_list_icons_.end()); |
| 371 autofill_unique_ids->insert(autofill_unique_ids->begin(), | 374 autofill_unique_ids->insert(autofill_unique_ids->begin(), |
| 372 data_list_unique_ids_.begin(), | 375 data_list_unique_ids_.begin(), |
| 373 data_list_unique_ids_.end()); | 376 data_list_unique_ids_.end()); |
| 374 } | 377 } |
| 375 | 378 |
| 376 } // namespace autofill | 379 } // namespace autofill |
| OLD | NEW |