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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 registrar_.Add( | 57 registrar_.Add( |
58 this, | 58 this, |
59 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 59 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
60 content::Source<content::NavigationController>( | 60 content::Source<content::NavigationController>( |
61 &(web_contents->GetController()))); | 61 &(web_contents->GetController()))); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 AutofillExternalDelegate::~AutofillExternalDelegate() { | 65 AutofillExternalDelegate::~AutofillExternalDelegate() { |
66 if (controller_) | 66 if (controller_) |
67 controller_->Hide(); | 67 controller_->Hide(); |
David Trainor- moved to gerrit
2013/02/12 21:13:36
Should we just call HideAutofillPopup() here to ma
Ilya Sherman
2013/02/12 21:15:25
Yeah, probably a good idea.
csharp
2013/02/12 21:15:28
No longer needed, Hide will properly deregister th
| |
68 } | 68 } |
69 | 69 |
70 void AutofillExternalDelegate::OnQuery(int query_id, | 70 void AutofillExternalDelegate::OnQuery(int query_id, |
71 const FormData& form, | 71 const FormData& form, |
72 const FormFieldData& field, | 72 const FormFieldData& field, |
73 const gfx::RectF& element_bounds, | 73 const gfx::RectF& element_bounds, |
74 bool display_warning_if_disabled) { | 74 bool display_warning_if_disabled) { |
75 autofill_query_form_ = form; | 75 autofill_query_form_ = form; |
76 autofill_query_field_ = field; | 76 autofill_query_field_ = field; |
77 display_warning_if_disabled_ = display_warning_if_disabled; | 77 display_warning_if_disabled_ = display_warning_if_disabled; |
(...skipping 194 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 |