OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog, | 304 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowAutofillDialog, |
305 OnShowAutofillDialog) | 305 OnShowAutofillDialog) |
306 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData, | 306 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillAutofillFormData, |
307 OnFillAutofillFormData) | 307 OnFillAutofillFormData) |
308 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, | 308 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, |
309 OnDidPreviewAutofillFormData) | 309 OnDidPreviewAutofillFormData) |
310 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, | 310 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, |
311 OnDidFillAutofillFormData) | 311 OnDidFillAutofillFormData) |
312 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, | 312 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, |
313 OnDidShowAutofillSuggestions) | 313 OnDidShowAutofillSuggestions) |
| 314 IPC_MESSAGE_HANDLER(AutofillDelegateMsg_ShowAutofillSuggestions, |
| 315 ShowAutofillSuggestions) |
| 316 IPC_MESSAGE_HANDLER(AutofillDelegateMsg_AutofillElementBounds, |
| 317 SetAutofillElementBounds) |
| 318 IPC_MESSAGE_HANDLER(AutofillDelegateMsg_HideAutofillPopup, |
| 319 HideAutofillPopup) |
314 IPC_MESSAGE_UNHANDLED(handled = false) | 320 IPC_MESSAGE_UNHANDLED(handled = false) |
315 IPC_END_MESSAGE_MAP() | 321 IPC_END_MESSAGE_MAP() |
316 | 322 |
317 return handled; | 323 return handled; |
318 } | 324 } |
319 | 325 |
320 bool AutofillManager::OnFormSubmitted(const FormData& form, | 326 bool AutofillManager::OnFormSubmitted(const FormData& form, |
321 const TimeTicks& timestamp) { | 327 const TimeTicks& timestamp) { |
322 // Let AutoComplete know as well. | 328 // Let AutoComplete know as well. |
323 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form); | 329 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 metric_logger_->LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN); | 672 metric_logger_->LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN); |
667 | 673 |
668 if (!did_show_suggestions_) { | 674 if (!did_show_suggestions_) { |
669 did_show_suggestions_ = true; | 675 did_show_suggestions_ = true; |
670 metric_logger_->LogUserHappinessMetric( | 676 metric_logger_->LogUserHappinessMetric( |
671 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); | 677 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); |
672 } | 678 } |
673 } | 679 } |
674 } | 680 } |
675 | 681 |
| 682 void AutofillManager::ShowAutofillSuggestions( |
| 683 int query_id, |
| 684 const std::vector<string16>& autofill_values, |
| 685 const std::vector<string16>& autofill_labels, |
| 686 const std::vector<string16>& autofill_icons, |
| 687 const std::vector<int>& autofill_unique_ids) { |
| 688 external_delegate_->OnSuggestionsReturned(query_id, |
| 689 autofill_values, |
| 690 autofill_labels, |
| 691 autofill_icons, |
| 692 autofill_unique_ids); |
| 693 external_delegate_->ShowAutofillPopup(); |
| 694 } |
| 695 |
| 696 void AutofillManager::SetAutofillElementBounds( |
| 697 int x, |
| 698 int y, |
| 699 int width, |
| 700 int height) { |
| 701 external_delegate_->SetAutofillElementBounds(gfx::Rect(x, y, width, height)); |
| 702 } |
| 703 |
| 704 void AutofillManager::HideAutofillPopup() { |
| 705 external_delegate_->HideAutofillPopup(); |
| 706 } |
| 707 |
676 void AutofillManager::OnLoadedServerPredictions( | 708 void AutofillManager::OnLoadedServerPredictions( |
677 const std::string& response_xml) { | 709 const std::string& response_xml) { |
678 // Parse and store the server predictions. | 710 // Parse and store the server predictions. |
679 FormStructure::ParseQueryResponse(response_xml, | 711 FormStructure::ParseQueryResponse(response_xml, |
680 form_structures_.get(), | 712 form_structures_.get(), |
681 *metric_logger_); | 713 *metric_logger_); |
682 | 714 |
683 // If the corresponding flag is set, annotate forms with the predicted types. | 715 // If the corresponding flag is set, annotate forms with the predicted types. |
684 SendAutofillTypePredictions(form_structures_.get()); | 716 SendAutofillTypePredictions(form_structures_.get()); |
685 } | 717 } |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 *profile_guid = IDToGUID(profile_id); | 1309 *profile_guid = IDToGUID(profile_id); |
1278 } | 1310 } |
1279 | 1311 |
1280 void AutofillManager::UpdateInitialInteractionTimestamp( | 1312 void AutofillManager::UpdateInitialInteractionTimestamp( |
1281 const TimeTicks& interaction_timestamp) { | 1313 const TimeTicks& interaction_timestamp) { |
1282 if (initial_interaction_timestamp_.is_null() || | 1314 if (initial_interaction_timestamp_.is_null() || |
1283 interaction_timestamp < initial_interaction_timestamp_) { | 1315 interaction_timestamp < initial_interaction_timestamp_) { |
1284 initial_interaction_timestamp_ = interaction_timestamp; | 1316 initial_interaction_timestamp_ = interaction_timestamp; |
1285 } | 1317 } |
1286 } | 1318 } |
OLD | NEW |