Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: components/autofill/core/browser/autofill_external_delegate.cc

Issue 18272015: Hide autofill popup before WebContentsImpl is destroyed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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_ == web_contents_->GetRenderViewHost())
173 web_contents_->GetRenderViewHost()->RemoveKeyboardListener(listener); 174 web_contents_->GetRenderViewHost()->RemoveKeyboardListener(listener);
Ilya Sherman 2013/07/03 19:56:49 nit: Please add curly braces now that the conditio
blundell 2013/07/04 08:32:45 Done.
174 175
175 registered_keyboard_listener_with_ = NULL; 176 registered_keyboard_listener_with_ = NULL;
176 } 177 }
177 178
178 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) { 179 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) {
179 ClearPreviewedForm(); 180 ClearPreviewedForm();
180 181
181 // Only preview the data if it is a profile. 182 // Only preview the data if it is a profile.
182 if (identifier > 0) 183 if (identifier > 0)
183 FillAutofillFormData(identifier, true); 184 FillAutofillFormData(identifier, true);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 data_list_labels_.end()); 357 data_list_labels_.end());
357 autofill_icons->insert(autofill_icons->begin(), 358 autofill_icons->insert(autofill_icons->begin(),
358 data_list_icons_.begin(), 359 data_list_icons_.begin(),
359 data_list_icons_.end()); 360 data_list_icons_.end());
360 autofill_unique_ids->insert(autofill_unique_ids->begin(), 361 autofill_unique_ids->insert(autofill_unique_ids->begin(),
361 data_list_unique_ids_.begin(), 362 data_list_unique_ids_.begin(),
362 data_list_unique_ids_.end()); 363 data_list_unique_ids_.end());
363 } 364 }
364 365
365 } // namespace autofill 366 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698