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/render_view_host.h" | 50 #include "content/public/browser/render_view_host.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 content::RenderViewHost; | 64 using content::RenderViewHost; |
64 using switches::kEnableAutofillFeedback; | 65 using switches::kEnableAutofillFeedback; |
65 using webkit::forms::FormData; | 66 using webkit::forms::FormData; |
66 using webkit::forms::FormDataPredictions; | 67 using webkit::forms::FormDataPredictions; |
67 using webkit::forms::FormField; | 68 using webkit::forms::FormField; |
68 | 69 |
69 namespace { | 70 namespace { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, | 312 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidPreviewAutofillFormData, |
312 OnDidPreviewAutofillFormData) | 313 OnDidPreviewAutofillFormData) |
313 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, | 314 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidFillAutofillFormData, |
314 OnDidFillAutofillFormData) | 315 OnDidFillAutofillFormData) |
315 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, | 316 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidShowAutofillSuggestions, |
316 OnDidShowAutofillSuggestions) | 317 OnDidShowAutofillSuggestions) |
317 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidEndTextFieldEditing, | 318 IPC_MESSAGE_HANDLER(AutofillHostMsg_DidEndTextFieldEditing, |
318 OnDidEndTextFieldEditing) | 319 OnDidEndTextFieldEditing) |
319 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup, | 320 IPC_MESSAGE_HANDLER(AutofillHostMsg_HideAutofillPopup, |
320 OnHideAutofillPopup) | 321 OnHideAutofillPopup) |
322 IPC_MESSAGE_HANDLER(AutofillHostMsg_FrameClosing, | |
323 OnFrameClosing) | |
324 IPC_MESSAGE_HANDLER(AutofillHostMsg_FillPasswordForm, | |
325 OnFillPasswordForm) | |
321 IPC_MESSAGE_UNHANDLED(handled = false) | 326 IPC_MESSAGE_UNHANDLED(handled = false) |
322 IPC_END_MESSAGE_MAP() | 327 IPC_END_MESSAGE_MAP() |
323 | 328 |
324 return handled; | 329 return handled; |
325 } | 330 } |
326 | 331 |
327 bool AutofillManager::OnFormSubmitted(const FormData& form, | 332 bool AutofillManager::OnFormSubmitted(const FormData& form, |
328 const TimeTicks& timestamp) { | 333 const TimeTicks& timestamp) { |
329 // Let AutoComplete know as well. | 334 // Let AutoComplete know as well. |
330 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form); | 335 tab_contents_wrapper_->autocomplete_history_manager()->OnFormSubmitted(form); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); | 689 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); |
685 } | 690 } |
686 } | 691 } |
687 } | 692 } |
688 | 693 |
689 void AutofillManager::OnHideAutofillPopup() { | 694 void AutofillManager::OnHideAutofillPopup() { |
690 if (external_delegate_) | 695 if (external_delegate_) |
691 external_delegate_->HideAutofillPopup(); | 696 external_delegate_->HideAutofillPopup(); |
692 } | 697 } |
693 | 698 |
699 void AutofillManager::OnFrameClosing(int frame_id) { | |
Ilya Sherman
2012/03/08 23:22:14
nit: int -> long long?
csharp
2012/03/09 16:20:19
removed
| |
700 if (external_delegate_) | |
701 external_delegate_->FrameClosing(frame_id); | |
702 } | |
703 | |
704 void AutofillManager::OnFillPasswordForm( | |
705 const webkit::forms::FormField& form, | |
706 const webkit::forms::PasswordFormFillData fill_data, | |
707 int frame_id) { | |
Ilya Sherman
2012/03/08 23:22:14
nit: int -> long long?
csharp
2012/03/09 16:20:19
removed
| |
708 if (external_delegate_) | |
709 external_delegate_->FillPasswordForm(form, fill_data, frame_id); | |
710 } | |
711 | |
712 | |
694 void AutofillManager::OnLoadedServerPredictions( | 713 void AutofillManager::OnLoadedServerPredictions( |
695 const std::string& response_xml) { | 714 const std::string& response_xml) { |
696 // Parse and store the server predictions. | 715 // Parse and store the server predictions. |
697 FormStructure::ParseQueryResponse(response_xml, | 716 FormStructure::ParseQueryResponse(response_xml, |
698 form_structures_.get(), | 717 form_structures_.get(), |
699 *metric_logger_); | 718 *metric_logger_); |
700 | 719 |
701 // If the corresponding flag is set, annotate forms with the predicted types. | 720 // If the corresponding flag is set, annotate forms with the predicted types. |
702 SendAutofillTypePredictions(form_structures_.get()); | 721 SendAutofillTypePredictions(form_structures_.get()); |
703 } | 722 } |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1301 *profile_guid = IDToGUID(profile_id); | 1320 *profile_guid = IDToGUID(profile_id); |
1302 } | 1321 } |
1303 | 1322 |
1304 void AutofillManager::UpdateInitialInteractionTimestamp( | 1323 void AutofillManager::UpdateInitialInteractionTimestamp( |
1305 const TimeTicks& interaction_timestamp) { | 1324 const TimeTicks& interaction_timestamp) { |
1306 if (initial_interaction_timestamp_.is_null() || | 1325 if (initial_interaction_timestamp_.is_null() || |
1307 interaction_timestamp < initial_interaction_timestamp_) { | 1326 interaction_timestamp < initial_interaction_timestamp_) { |
1308 initial_interaction_timestamp_ = interaction_timestamp; | 1327 initial_interaction_timestamp_ = interaction_timestamp; |
1309 } | 1328 } |
1310 } | 1329 } |
OLD | NEW |