| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup, | 353 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup, |
| 354 OnHideAutofillPopup) | 354 OnHideAutofillPopup) |
| 355 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup, | 355 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup, |
| 356 OnShowPasswordGenerationPopup) | 356 OnShowPasswordGenerationPopup) |
| 357 IPC_MESSAGE_HANDLER(AutofillHostMsg_AddPasswordFormMapping, | 357 IPC_MESSAGE_HANDLER(AutofillHostMsg_AddPasswordFormMapping, |
| 358 OnAddPasswordFormMapping) | 358 OnAddPasswordFormMapping) |
| 359 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordSuggestions, | 359 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordSuggestions, |
| 360 OnShowPasswordSuggestions) | 360 OnShowPasswordSuggestions) |
| 361 IPC_MESSAGE_HANDLER(AutofillHostMsg_SetDataList, | 361 IPC_MESSAGE_HANDLER(AutofillHostMsg_SetDataList, |
| 362 OnSetDataList) | 362 OnSetDataList) |
| 363 IPC_MESSAGE_HANDLER(AutofillHostMsg_RequestAutocomplete, |
| 364 OnRequestAutocomplete) |
| 363 IPC_MESSAGE_UNHANDLED(handled = false) | 365 IPC_MESSAGE_UNHANDLED(handled = false) |
| 364 IPC_END_MESSAGE_MAP() | 366 IPC_END_MESSAGE_MAP() |
| 365 | 367 |
| 366 return handled; | 368 return handled; |
| 367 } | 369 } |
| 368 | 370 |
| 369 void AutofillManager::WebContentsDestroyed(content::WebContents* web_contents) { | 371 void AutofillManager::WebContentsDestroyed(content::WebContents* web_contents) { |
| 370 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService(); | 372 ProfileSyncServiceBase* service = manager_delegate_->GetProfileSyncService(); |
| 371 if (service && service->HasObserver(this)) | 373 if (service && service->HasObserver(this)) |
| 372 service->RemoveObserver(this); | 374 service->RemoveObserver(this); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 const std::vector<string16>& icons, | 792 const std::vector<string16>& icons, |
| 791 const std::vector<int>& unique_ids) { | 793 const std::vector<int>& unique_ids) { |
| 792 if (external_delegate_) { | 794 if (external_delegate_) { |
| 793 external_delegate_->SetCurrentDataListValues(values, | 795 external_delegate_->SetCurrentDataListValues(values, |
| 794 labels, | 796 labels, |
| 795 icons, | 797 icons, |
| 796 unique_ids); | 798 unique_ids); |
| 797 } | 799 } |
| 798 } | 800 } |
| 799 | 801 |
| 802 void AutofillManager::OnRequestAutocomplete(int unique_id, |
| 803 const FormData& form) { |
| 804 // TODO(dbeam): implement interactive autocomplete UI. |
| 805 |
| 806 RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| 807 if (!host) |
| 808 return; |
| 809 |
| 810 // Just send a failure right away. |
| 811 host->Send(new AutofillMsg_RequestAutocompleteFinished( |
| 812 host->GetRoutingID(), unique_id, false)); |
| 813 } |
| 814 |
| 800 void AutofillManager::OnLoadedServerPredictions( | 815 void AutofillManager::OnLoadedServerPredictions( |
| 801 const std::string& response_xml) { | 816 const std::string& response_xml) { |
| 802 // Parse and store the server predictions. | 817 // Parse and store the server predictions. |
| 803 FormStructure::ParseQueryResponse(response_xml, | 818 FormStructure::ParseQueryResponse(response_xml, |
| 804 form_structures_.get(), | 819 form_structures_.get(), |
| 805 *metric_logger_); | 820 *metric_logger_); |
| 806 | 821 |
| 807 // If the corresponding flag is set, annotate forms with the predicted types. | 822 // If the corresponding flag is set, annotate forms with the predicted types. |
| 808 SendAutofillTypePredictions(form_structures_.get()); | 823 SendAutofillTypePredictions(form_structures_.get()); |
| 809 } | 824 } |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 *profile_guid = IDToGUID(profile_id); | 1428 *profile_guid = IDToGUID(profile_id); |
| 1414 } | 1429 } |
| 1415 | 1430 |
| 1416 void AutofillManager::UpdateInitialInteractionTimestamp( | 1431 void AutofillManager::UpdateInitialInteractionTimestamp( |
| 1417 const TimeTicks& interaction_timestamp) { | 1432 const TimeTicks& interaction_timestamp) { |
| 1418 if (initial_interaction_timestamp_.is_null() || | 1433 if (initial_interaction_timestamp_.is_null() || |
| 1419 interaction_timestamp < initial_interaction_timestamp_) { | 1434 interaction_timestamp < initial_interaction_timestamp_) { |
| 1420 initial_interaction_timestamp_ = interaction_timestamp; | 1435 initial_interaction_timestamp_ = interaction_timestamp; |
| 1421 } | 1436 } |
| 1422 } | 1437 } |
| OLD | NEW |