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 "chrome/browser/autofill/autocomplete_history_manager.h" | 6 #include "chrome/browser/autofill/autocomplete_history_manager.h" |
7 #include "chrome/browser/autofill/autofill_external_delegate.h" | 7 #include "chrome/browser/autofill/autofill_external_delegate.h" |
8 #include "chrome/browser/autofill/autofill_manager.h" | 8 #include "chrome/browser/autofill/autofill_manager.h" |
9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
10 #include "chrome/common/autofill_messages.h" | 10 #include "chrome/common/autofill_messages.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 if (web_contents_) { | 272 if (web_contents_) { |
273 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 273 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
274 | 274 |
275 if (host) | 275 if (host) |
276 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); | 276 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 void AutofillExternalDelegate::HideAutofillPopup() { | 280 void AutofillExternalDelegate::HideAutofillPopup() { |
281 if (controller_) { | 281 if (controller_) { |
| 282 OnPopupHidden(controller_.get()); |
| 283 // Hide deletes the controller so all other actions must be done before it. |
282 controller_->Hide(); | 284 controller_->Hide(); |
283 OnPopupHidden(controller_.get()); | |
284 } | 285 } |
285 } | 286 } |
286 | 287 |
287 void AutofillExternalDelegate::Reset() { | 288 void AutofillExternalDelegate::Reset() { |
288 HideAutofillPopup(); | 289 HideAutofillPopup(); |
289 | 290 |
290 password_autofill_manager_.Reset(); | 291 password_autofill_manager_.Reset(); |
291 } | 292 } |
292 | 293 |
293 void AutofillExternalDelegate::AddPasswordFormMapping( | 294 void AutofillExternalDelegate::AddPasswordFormMapping( |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 const content::NotificationDetails& details) { | 417 const content::NotificationDetails& details) { |
417 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) { | 418 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) { |
418 if (!*content::Details<bool>(details).ptr()) | 419 if (!*content::Details<bool>(details).ptr()) |
419 HideAutofillPopup(); | 420 HideAutofillPopup(); |
420 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { | 421 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { |
421 HideAutofillPopup(); | 422 HideAutofillPopup(); |
422 } else { | 423 } else { |
423 NOTREACHED(); | 424 NOTREACHED(); |
424 } | 425 } |
425 } | 426 } |
OLD | NEW |