OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/content/browser/request_autocomplete_manager.h" | 5 #include "components/autofill/content/browser/request_autocomplete_manager.h" |
6 | 6 |
7 #include "components/autofill/content/browser/content_autofill_driver.h" | 7 #include "components/autofill/content/browser/content_autofill_driver.h" |
8 #include "components/autofill/content/common/autofill_messages.h" | 8 #include "components/autofill/content/common/autofill_messages.h" |
9 #include "components/autofill/core/browser/form_structure.h" | 9 #include "components/autofill/core/browser/form_structure.h" |
10 #include "components/autofill/core/common/autofill_data_validation.h" | 10 #include "components/autofill/core/common/autofill_data_validation.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // autofill_driver_->GetWebContents() will be NULL when the interactive | 69 // autofill_driver_->GetWebContents() will be NULL when the interactive |
70 // autocomplete is closed due to a tab or browser window closing. | 70 // autocomplete is closed due to a tab or browser window closing. |
71 if (!autofill_driver_->GetWebContents()) | 71 if (!autofill_driver_->GetWebContents()) |
72 return; | 72 return; |
73 | 73 |
74 content::RenderViewHost* host = | 74 content::RenderViewHost* host = |
75 autofill_driver_->GetWebContents()->GetRenderViewHost(); | 75 autofill_driver_->GetWebContents()->GetRenderViewHost(); |
76 if (!host) | 76 if (!host) |
77 return; | 77 return; |
78 | 78 |
| 79 FormData form_data; |
| 80 if (form_structure) { |
| 81 form_data = form_structure->ToFormData(); |
| 82 for (size_t i = 0; i < form_data.fields.size(); ++i) { |
| 83 if(!form_data.fields[i].value.empty()) |
| 84 form_data.fields[i].is_autofilled = true; |
| 85 } |
| 86 } |
| 87 |
79 host->Send(new AutofillMsg_RequestAutocompleteResult( | 88 host->Send(new AutofillMsg_RequestAutocompleteResult( |
80 host->GetRoutingID(), | 89 host->GetRoutingID(), |
81 ToWebkitAutocompleteResult(result), | 90 ToWebkitAutocompleteResult(result), |
82 debug_message, | 91 debug_message, |
83 form_structure ? form_structure->ToFormData() : FormData())); | 92 form_data)); |
84 } | 93 } |
85 | 94 |
86 void RequestAutocompleteManager::ShowRequestAutocompleteDialog( | 95 void RequestAutocompleteManager::ShowRequestAutocompleteDialog( |
87 const FormData& form, | 96 const FormData& form, |
88 const GURL& source_url, | 97 const GURL& source_url, |
89 const AutofillManagerDelegate::ResultCallback& callback) { | 98 const AutofillManagerDelegate::ResultCallback& callback) { |
90 AutofillManagerDelegate* delegate = | 99 AutofillManagerDelegate* delegate = |
91 autofill_driver_->autofill_manager()->delegate(); | 100 autofill_driver_->autofill_manager()->delegate(); |
92 delegate->ShowRequestAutocompleteDialog(form, source_url, callback); | 101 delegate->ShowRequestAutocompleteDialog(form, source_url, callback); |
93 } | 102 } |
94 | 103 |
95 } // namespace autofill | 104 } // namespace autofill |
OLD | NEW |