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

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

Issue 525793002: Make WebContentsObserver::web_contents() public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 6 years, 3 months 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"
(...skipping 48 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_->GetWebContents() will be NULL when the interactive 69 // autofill_driver_->web_contents() 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_->web_contents())
72 return; 72 return;
73 73
74 content::RenderViewHost* host = 74 content::RenderViewHost* host =
75 autofill_driver_->GetWebContents()->GetRenderViewHost(); 75 autofill_driver_->web_contents()->GetRenderViewHost();
76 if (!host) 76 if (!host)
77 return; 77 return;
78 78
79 FormData form_data; 79 FormData form_data;
80 if (form_structure) { 80 if (form_structure) {
81 form_data = form_structure->ToFormData(); 81 form_data = form_structure->ToFormData();
82 for (size_t i = 0; i < form_data.fields.size(); ++i) { 82 for (size_t i = 0; i < form_data.fields.size(); ++i) {
83 if(!form_data.fields[i].value.empty()) 83 if(!form_data.fields[i].value.empty())
84 form_data.fields[i].is_autofilled = true; 84 form_data.fields[i].is_autofilled = true;
85 } 85 }
86 } 86 }
87 87
88 host->Send(new AutofillMsg_RequestAutocompleteResult( 88 host->Send(new AutofillMsg_RequestAutocompleteResult(
89 host->GetRoutingID(), 89 host->GetRoutingID(),
90 ToWebkitAutocompleteResult(result), 90 ToWebkitAutocompleteResult(result),
91 debug_message, 91 debug_message,
92 form_data)); 92 form_data));
93 } 93 }
94 94
95 void RequestAutocompleteManager::ShowRequestAutocompleteDialog( 95 void RequestAutocompleteManager::ShowRequestAutocompleteDialog(
96 const FormData& form, 96 const FormData& form,
97 const GURL& source_url, 97 const GURL& source_url,
98 const AutofillClient::ResultCallback& callback) { 98 const AutofillClient::ResultCallback& callback) {
99 AutofillClient* client = autofill_driver_->autofill_manager()->client(); 99 AutofillClient* client = autofill_driver_->autofill_manager()->client();
100 client->ShowRequestAutocompleteDialog(form, source_url, callback); 100 client->ShowRequestAutocompleteDialog(form, source_url, callback);
101 } 101 }
102 102
103 } // namespace autofill 103 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/browser/content_autofill_driver.cc ('k') | content/browser/download/save_package.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698