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

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

Issue 98753005: [Autofill] Sanitize all data that comes in over IPC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Loosen kMaxListSize a notch Created 6 years, 11 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 | Annotate | Revision Log
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/autofill_driver_impl.h" 7 #include "components/autofill/content/browser/autofill_driver_impl.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/form_data.h" 11 #include "components/autofill/core/common/form_data.h"
11 #include "content/public/browser/render_view_host.h" 12 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 namespace autofill { 16 namespace autofill {
16 17
17 RequestAutocompleteManager::RequestAutocompleteManager( 18 RequestAutocompleteManager::RequestAutocompleteManager(
18 AutofillDriverImpl* autofill_driver) 19 AutofillDriverImpl* autofill_driver)
19 : autofill_driver_(autofill_driver), 20 : autofill_driver_(autofill_driver),
20 weak_ptr_factory_(this) { 21 weak_ptr_factory_(this) {
21 DCHECK(autofill_driver_); 22 DCHECK(autofill_driver_);
22 } 23 }
23 24
24 RequestAutocompleteManager::~RequestAutocompleteManager() {} 25 RequestAutocompleteManager::~RequestAutocompleteManager() {}
25 26
26 void RequestAutocompleteManager::OnRequestAutocomplete( 27 void RequestAutocompleteManager::OnRequestAutocomplete(
27 const FormData& form, 28 const FormData& form,
28 const GURL& frame_url) { 29 const GURL& frame_url) {
30 if (!IsValidFormData(form))
31 return;
32
29 if (!autofill_driver_->autofill_manager()->IsAutofillEnabled()) { 33 if (!autofill_driver_->autofill_manager()->IsAutofillEnabled()) {
30 ReturnAutocompleteResult( 34 ReturnAutocompleteResult(
31 blink::WebFormElement::AutocompleteResultErrorDisabled, 35 blink::WebFormElement::AutocompleteResultErrorDisabled,
32 FormData()); 36 FormData());
33 return; 37 return;
34 } 38 }
35 39
36 base::Callback<void(const FormStructure*)> callback = 40 base::Callback<void(const FormStructure*)> callback =
37 base::Bind(&RequestAutocompleteManager::ReturnAutocompleteData, 41 base::Bind(&RequestAutocompleteManager::ReturnAutocompleteData,
38 weak_ptr_factory_.GetWeakPtr()); 42 weak_ptr_factory_.GetWeakPtr());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 void RequestAutocompleteManager::ShowRequestAutocompleteDialog( 75 void RequestAutocompleteManager::ShowRequestAutocompleteDialog(
72 const FormData& form, 76 const FormData& form,
73 const GURL& source_url, 77 const GURL& source_url,
74 const base::Callback<void(const FormStructure*)>& callback) { 78 const base::Callback<void(const FormStructure*)>& callback) {
75 AutofillManagerDelegate* delegate = 79 AutofillManagerDelegate* delegate =
76 autofill_driver_->autofill_manager()->delegate(); 80 autofill_driver_->autofill_manager()->delegate();
77 delegate->ShowRequestAutocompleteDialog(form, source_url, callback); 81 delegate->ShowRequestAutocompleteDialog(form, source_url, callback);
78 } 82 }
79 83
80 } // namespace autofill 84 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/browser/autofill_driver_impl.cc ('k') | components/autofill/content/common/autofill_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698