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 "chrome/browser/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 base::Callback<void(const FormStructure*)> callback = | 772 base::Callback<void(const FormStructure*)> callback = |
773 base::Bind(&AutofillManager::ReturnAutocompleteData, this); | 773 base::Bind(&AutofillManager::ReturnAutocompleteData, this); |
774 autofill::AutofillDialogController* controller = | 774 autofill::AutofillDialogController* controller = |
775 new autofill::AutofillDialogController(web_contents(), | 775 new autofill::AutofillDialogController(web_contents(), |
776 form, | 776 form, |
777 callback); | 777 callback); |
778 controller->Show(); | 778 controller->Show(); |
779 } | 779 } |
780 | 780 |
781 void AutofillManager::ReturnAutocompleteData(const FormStructure* result) { | 781 void AutofillManager::ReturnAutocompleteData(const FormStructure* result) { |
| 782 // web_contents() will be NULL when the interactive autocomplete is closed due |
| 783 // to a tab or browser window closing. |
| 784 if (!web_contents()) |
| 785 return; |
| 786 |
782 RenderViewHost* host = web_contents()->GetRenderViewHost(); | 787 RenderViewHost* host = web_contents()->GetRenderViewHost(); |
783 if (!host) | 788 if (!host) |
784 return; | 789 return; |
785 | 790 |
786 if (!result) { | 791 if (!result) { |
787 host->Send(new AutofillMsg_RequestAutocompleteFinished( | 792 host->Send(new AutofillMsg_RequestAutocompleteFinished( |
788 host->GetRoutingID(), WebKit::WebFormElement::AutocompleteResultError)); | 793 host->GetRoutingID(), WebKit::WebFormElement::AutocompleteResultError)); |
789 } else { | 794 } else { |
790 // TODO(estade): implement non-failure case. | 795 // TODO(estade): implement non-failure case. |
791 host->Send(new AutofillMsg_RequestAutocompleteFinished( | 796 host->Send(new AutofillMsg_RequestAutocompleteFinished( |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 *profile_guid = IDToGUID(profile_id); | 1319 *profile_guid = IDToGUID(profile_id); |
1315 } | 1320 } |
1316 | 1321 |
1317 void AutofillManager::UpdateInitialInteractionTimestamp( | 1322 void AutofillManager::UpdateInitialInteractionTimestamp( |
1318 const TimeTicks& interaction_timestamp) { | 1323 const TimeTicks& interaction_timestamp) { |
1319 if (initial_interaction_timestamp_.is_null() || | 1324 if (initial_interaction_timestamp_.is_null() || |
1320 interaction_timestamp < initial_interaction_timestamp_) { | 1325 interaction_timestamp < initial_interaction_timestamp_) { |
1321 initial_interaction_timestamp_ = interaction_timestamp; | 1326 initial_interaction_timestamp_ = interaction_timestamp; |
1322 } | 1327 } |
1323 } | 1328 } |
OLD | NEW |