| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 ShowRequestAutocompleteDialog(form, frame_url, callback); | 60 ShowRequestAutocompleteDialog(form, frame_url, callback); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void RequestAutocompleteManager::OnCancelRequestAutocomplete() { | 63 void RequestAutocompleteManager::OnCancelRequestAutocomplete() { |
| 64 autofill_driver_->autofill_manager()->delegate()-> | 64 autofill_driver_->autofill_manager()->delegate()-> |
| 65 HideRequestAutocompleteDialog(); | 65 HideRequestAutocompleteDialog(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void RequestAutocompleteManager::ReturnAutocompleteResult( | 68 void RequestAutocompleteManager::ReturnAutocompleteResult( |
| 69 AutofillManagerDelegate::RequestAutocompleteResult result, | 69 AutofillManagerDelegate::RequestAutocompleteResult result, |
| 70 const base::string16& debug_message, |
| 70 const FormStructure* form_structure) { | 71 const FormStructure* form_structure) { |
| 71 // autofill_driver_->GetWebContents() will be NULL when the interactive | 72 // autofill_driver_->GetWebContents() will be NULL when the interactive |
| 72 // autocomplete is closed due to a tab or browser window closing. | 73 // autocomplete is closed due to a tab or browser window closing. |
| 73 if (!autofill_driver_->GetWebContents()) | 74 if (!autofill_driver_->GetWebContents()) |
| 74 return; | 75 return; |
| 75 | 76 |
| 76 content::RenderViewHost* host = | 77 content::RenderViewHost* host = |
| 77 autofill_driver_->GetWebContents()->GetRenderViewHost(); | 78 autofill_driver_->GetWebContents()->GetRenderViewHost(); |
| 78 if (!host) | 79 if (!host) |
| 79 return; | 80 return; |
| 80 | 81 |
| 81 host->Send(new AutofillMsg_RequestAutocompleteResult( | 82 host->Send(new AutofillMsg_RequestAutocompleteResult( |
| 82 host->GetRoutingID(), | 83 host->GetRoutingID(), |
| 83 ToWebkitAutocompleteResult(result), | 84 ToWebkitAutocompleteResult(result), |
| 85 debug_message, |
| 84 form_structure ? form_structure->ToFormData() : FormData())); | 86 form_structure ? form_structure->ToFormData() : FormData())); |
| 85 } | 87 } |
| 86 | 88 |
| 87 void RequestAutocompleteManager::ShowRequestAutocompleteDialog( | 89 void RequestAutocompleteManager::ShowRequestAutocompleteDialog( |
| 88 const FormData& form, | 90 const FormData& form, |
| 89 const GURL& source_url, | 91 const GURL& source_url, |
| 90 const AutofillManagerDelegate::ResultCallback& callback) { | 92 const AutofillManagerDelegate::ResultCallback& callback) { |
| 91 AutofillManagerDelegate* delegate = | 93 AutofillManagerDelegate* delegate = |
| 92 autofill_driver_->autofill_manager()->delegate(); | 94 autofill_driver_->autofill_manager()->delegate(); |
| 93 delegate->ShowRequestAutocompleteDialog(form, source_url, callback); | 95 delegate->ShowRequestAutocompleteDialog(form, source_url, callback); |
| 94 } | 96 } |
| 95 | 97 |
| 96 } // namespace autofill | 98 } // namespace autofill |
| OLD | NEW |