| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 registered_keyboard_listener_with_->AddKeyboardListener(listener); | 175 registered_keyboard_listener_with_->AddKeyboardListener(listener); |
| 176 } | 176 } |
| 177 | 177 |
| 178 autofill_manager_->OnDidShowAutofillSuggestions( | 178 autofill_manager_->OnDidShowAutofillSuggestions( |
| 179 has_autofill_suggestion_ && !has_shown_autofill_popup_for_current_edit_); | 179 has_autofill_suggestion_ && !has_shown_autofill_popup_for_current_edit_); |
| 180 has_shown_autofill_popup_for_current_edit_ |= has_autofill_suggestion_; | 180 has_shown_autofill_popup_for_current_edit_ |= has_autofill_suggestion_; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void AutofillExternalDelegate::OnPopupHidden( | 183 void AutofillExternalDelegate::OnPopupHidden( |
| 184 content::KeyboardListener* listener) { | 184 content::KeyboardListener* listener) { |
| 185 if (registered_keyboard_listener_with_ == web_contents_->GetRenderViewHost()) | 185 if ((!web_contents_->IsBeingDestroyed()) && |
| 186 (registered_keyboard_listener_with_ == |
| 187 web_contents_->GetRenderViewHost())) { |
| 186 web_contents_->GetRenderViewHost()->RemoveKeyboardListener(listener); | 188 web_contents_->GetRenderViewHost()->RemoveKeyboardListener(listener); |
| 189 } |
| 187 | 190 |
| 188 registered_keyboard_listener_with_ = NULL; | 191 registered_keyboard_listener_with_ = NULL; |
| 189 } | 192 } |
| 190 | 193 |
| 191 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) { | 194 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) { |
| 192 ClearPreviewedForm(); | 195 ClearPreviewedForm(); |
| 193 | 196 |
| 194 // Only preview the data if it is a profile. | 197 // Only preview the data if it is a profile. |
| 195 if (identifier > 0) | 198 if (identifier > 0) |
| 196 FillAutofillFormData(identifier, true); | 199 FillAutofillFormData(identifier, true); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 if (!*content::Details<bool>(details).ptr()) | 386 if (!*content::Details<bool>(details).ptr()) |
| 384 autofill_manager_->delegate()->HideAutofillPopup(); | 387 autofill_manager_->delegate()->HideAutofillPopup(); |
| 385 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { | 388 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { |
| 386 autofill_manager_->delegate()->HideAutofillPopup(); | 389 autofill_manager_->delegate()->HideAutofillPopup(); |
| 387 } else { | 390 } else { |
| 388 NOTREACHED(); | 391 NOTREACHED(); |
| 389 } | 392 } |
| 390 } | 393 } |
| 391 | 394 |
| 392 } // namespace autofill | 395 } // namespace autofill |
| OLD | NEW |