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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "content/public/browser/notification_source.h" | 50 #include "content/public/browser/notification_source.h" |
51 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
52 #include "googleurl/src/gurl.h" | 52 #include "googleurl/src/gurl.h" |
53 #include "grit/generated_resources.h" | 53 #include "grit/generated_resources.h" |
54 #include "ipc/ipc_message_macros.h" | 54 #include "ipc/ipc_message_macros.h" |
55 #include "ui/base/l10n/l10n_util.h" | 55 #include "ui/base/l10n/l10n_util.h" |
56 #include "ui/gfx/rect.h" | 56 #include "ui/gfx/rect.h" |
57 #include "webkit/forms/form_data.h" | 57 #include "webkit/forms/form_data.h" |
58 #include "webkit/forms/form_data_predictions.h" | 58 #include "webkit/forms/form_data_predictions.h" |
59 #include "webkit/forms/form_field.h" | 59 #include "webkit/forms/form_field.h" |
| 60 #include "webkit/forms/password_form_dom_manager.h" |
60 | 61 |
61 using base::TimeTicks; | 62 using base::TimeTicks; |
62 using content::BrowserThread; | 63 using content::BrowserThread; |
63 using switches::kEnableAutofillFeedback; | 64 using switches::kEnableAutofillFeedback; |
64 using webkit::forms::FormData; | 65 using webkit::forms::FormData; |
65 using webkit::forms::FormDataPredictions; | 66 using webkit::forms::FormDataPredictions; |
66 using webkit::forms::FormField; | 67 using webkit::forms::FormField; |
67 | 68 |
68 namespace { | 69 namespace { |
69 | 70 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, | 311 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, |
311 OnDidPreviewAutofillFormData) | 312 OnDidPreviewAutofillFormData) |
312 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, | 313 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, |
313 OnDidFillAutofillFormData) | 314 OnDidFillAutofillFormData) |
314 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, | 315 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, |
315 OnDidShowAutofillSuggestions) | 316 OnDidShowAutofillSuggestions) |
316 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidEndTextFieldEditing, | 317 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidEndTextFieldEditing, |
317 OnDidEndTextFieldEditing) | 318 OnDidEndTextFieldEditing) |
318 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup, | 319 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup, |
319 OnHideAutofillPopup) | 320 OnHideAutofillPopup) |
| 321 IPC_MESSAGE_HANDLER(AutofillHostMsg_FrameClosing, |
| 322 OnFrameClosing) |
| 323 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillPasswordForm, |
| 324 OnFillPasswordForm) |
320 IPC_MESSAGE_UNHANDLED(handled = false) | 325 IPC_MESSAGE_UNHANDLED(handled = false) |
321 IPC_END_MESSAGE_MAP() | 326 IPC_END_MESSAGE_MAP() |
322 | 327 |
323 return handled; | 328 return handled; |
324 } | 329 } |
325 | 330 |
326 bool AutofillManager::OnFormSubmitted(const FormData& form, | 331 bool AutofillManager::OnFormSubmitted(const FormData& form, |
327 const TimeTicks& timestamp) { | 332 const TimeTicks& timestamp) { |
328 // Let AutoComplete know as well. | 333 // Let AutoComplete know as well. |
329 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form); | 334 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); | 688 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); |
684 } | 689 } |
685 } | 690 } |
686 } | 691 } |
687 | 692 |
688 void AutofillManager::OnHideAutofillPopup() { | 693 void AutofillManager::OnHideAutofillPopup() { |
689 if (external_delegate_) | 694 if (external_delegate_) |
690 external_delegate_->HideAutofillPopup(); | 695 external_delegate_->HideAutofillPopup(); |
691 } | 696 } |
692 | 697 |
| 698 void AutofillManager::OnFrameClosing(int frame_id) { |
| 699 if (external_delegate_) |
| 700 external_delegate_->FrameClosing(frame_id); |
| 701 } |
| 702 |
| 703 void AutofillManager::OnFillPasswordForm( |
| 704 const webkit::forms::FormField& form, |
| 705 const webkit::forms::PasswordFormFillData fill_data, |
| 706 int frame_id) { |
| 707 if (external_delegate_) |
| 708 external_delegate_->FillPasswordForm(form, fill_data, frame_id); |
| 709 } |
| 710 |
| 711 |
693 void AutofillManager::OnLoadedServerPredictions( | 712 void AutofillManager::OnLoadedServerPredictions( |
694 const std::string& response_xml) { | 713 const std::string& response_xml) { |
695 // Parse and store the server predictions. | 714 // Parse and store the server predictions. |
696 FormStructure::ParseQueryResponse(response_xml, | 715 FormStructure::ParseQueryResponse(response_xml, |
697 form_structures_.get(), | 716 form_structures_.get(), |
698 *metric_logger_); | 717 *metric_logger_); |
699 | 718 |
700 // If the corresponding flag is set, annotate forms with the predicted types. | 719 // If the corresponding flag is set, annotate forms with the predicted types. |
701 SendAutofillTypePredictions(form_structures_.get()); | 720 SendAutofillTypePredictions(form_structures_.get()); |
702 } | 721 } |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 *profile_guid = IDToGUID(profile_id); | 1319 *profile_guid = IDToGUID(profile_id); |
1301 } | 1320 } |
1302 | 1321 |
1303 void AutofillManager::UpdateInitialInteractionTimestamp( | 1322 void AutofillManager::UpdateInitialInteractionTimestamp( |
1304 const TimeTicks& interaction_timestamp) { | 1323 const TimeTicks& interaction_timestamp) { |
1305 if (initial_interaction_timestamp_.is_null() || | 1324 if (initial_interaction_timestamp_.is_null() || |
1306 interaction_timestamp < initial_interaction_timestamp_) { | 1325 interaction_timestamp < initial_interaction_timestamp_) { |
1307 initial_interaction_timestamp_ = interaction_timestamp; | 1326 initial_interaction_timestamp_ = interaction_timestamp; |
1308 } | 1327 } |
1309 } | 1328 } |
OLD | NEW |