Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: components/autofill/content/browser/request_autocomplete_manager.cc

Issue 707173004: Refactor Autofill for out of process iframes (OOPIF). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mem leak Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "components/autofill/core/common/form_data.h" 11 #include "components/autofill/core/common/form_data.h"
12 #include "content/public/browser/render_view_host.h" 12 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "third_party/WebKit/public/web/WebFormElement.h" 14 #include "third_party/WebKit/public/web/WebFormElement.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 namespace autofill { 17 namespace autofill {
18 18
19 namespace { 19 namespace {
20 20
21 blink::WebFormElement::AutocompleteResult ToWebkitAutocompleteResult( 21 blink::WebFormElement::AutocompleteResult ToWebkitAutocompleteResult(
22 AutofillClient::RequestAutocompleteResult result) { 22 AutofillClient::RequestAutocompleteResult result) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 void RequestAutocompleteManager::OnCancelRequestAutocomplete() { 60 void RequestAutocompleteManager::OnCancelRequestAutocomplete() {
61 autofill_driver_->autofill_manager()->client() 61 autofill_driver_->autofill_manager()->client()
62 ->HideRequestAutocompleteDialog(); 62 ->HideRequestAutocompleteDialog();
63 } 63 }
64 64
65 void RequestAutocompleteManager::ReturnAutocompleteResult( 65 void RequestAutocompleteManager::ReturnAutocompleteResult(
66 AutofillClient::RequestAutocompleteResult result, 66 AutofillClient::RequestAutocompleteResult result,
67 const base::string16& debug_message, 67 const base::string16& debug_message,
68 const FormStructure* form_structure) { 68 const FormStructure* form_structure) {
69 // autofill_driver_->web_contents() will be NULL when the interactive 69 content::RenderFrameHost* host = autofill_driver_->render_frame_host();
70 // autocomplete is closed due to a tab or browser window closing.
71 if (!autofill_driver_->web_contents())
72 return;
73
74 content::RenderViewHost* host =
75 autofill_driver_->web_contents()->GetRenderViewHost();
76 if (!host) 70 if (!host)
77 return; 71 return;
78 72
79 FormData form_data; 73 FormData form_data;
80 if (form_structure) { 74 if (form_structure) {
81 form_data = form_structure->ToFormData(); 75 form_data = form_structure->ToFormData();
82 for (size_t i = 0; i < form_data.fields.size(); ++i) { 76 for (size_t i = 0; i < form_data.fields.size(); ++i) {
83 if(!form_data.fields[i].value.empty()) 77 if(!form_data.fields[i].value.empty())
84 form_data.fields[i].is_autofilled = true; 78 form_data.fields[i].is_autofilled = true;
85 } 79 }
86 } 80 }
87 81
88 host->Send(new AutofillMsg_RequestAutocompleteResult( 82 host->Send(new AutofillMsg_RequestAutocompleteResult(
89 host->GetRoutingID(), 83 host->GetRoutingID(),
90 ToWebkitAutocompleteResult(result), 84 ToWebkitAutocompleteResult(result),
91 debug_message, 85 debug_message,
92 form_data)); 86 form_data));
93 } 87 }
94 88
95 void RequestAutocompleteManager::ShowRequestAutocompleteDialog( 89 void RequestAutocompleteManager::ShowRequestAutocompleteDialog(
96 const FormData& form, 90 const FormData& form,
97 const GURL& source_url, 91 const GURL& source_url,
98 const AutofillClient::ResultCallback& callback) { 92 const AutofillClient::ResultCallback& callback) {
99 AutofillClient* client = autofill_driver_->autofill_manager()->client(); 93 AutofillClient* client = autofill_driver_->autofill_manager()->client();
100 client->ShowRequestAutocompleteDialog(form, source_url, callback); 94 client->ShowRequestAutocompleteDialog(form, source_url, callback);
101 } 95 }
102 96
103 } // namespace autofill 97 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698