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

Side by Side Diff: components/autofill/content/renderer/password_autofill_agent.cc

Issue 2609703002: Remove ScopedVector from autofill. (Closed)
Patch Set: drop the using Created 3 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
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/renderer/password_autofill_agent.h" 5 #include "components/autofill/content/renderer/password_autofill_agent.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector>
12 13
13 #include "base/bind.h" 14 #include "base/bind.h"
14 #include "base/i18n/case_conversion.h" 15 #include "base/i18n/case_conversion.h"
15 #include "base/memory/linked_ptr.h" 16 #include "base/memory/linked_ptr.h"
16 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
17 #include "base/memory/scoped_vector.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/metrics/histogram_macros.h" 19 #include "base/metrics/histogram_macros.h"
20 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "components/autofill/content/renderer/form_autofill_util.h" 24 #include "components/autofill/content/renderer/form_autofill_util.h"
25 #include "components/autofill/content/renderer/password_form_conversion_utils.h" 25 #include "components/autofill/content/renderer/password_form_conversion_utils.h"
26 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h" 26 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h"
27 #include "components/autofill/core/common/autofill_constants.h" 27 #include "components/autofill/core/common/autofill_constants.h"
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 if (provisionally_saved_form_) { 1171 if (provisionally_saved_form_) {
1172 if (logger) { 1172 if (logger) {
1173 logger->LogPasswordForm( 1173 logger->LogPasswordForm(
1174 Logger::STRING_PROVISIONALLY_SAVED_FORM_FOR_FRAME, 1174 Logger::STRING_PROVISIONALLY_SAVED_FORM_FOR_FRAME,
1175 *provisionally_saved_form_); 1175 *provisionally_saved_form_);
1176 } 1176 }
1177 GetPasswordManagerDriver()->PasswordFormSubmitted( 1177 GetPasswordManagerDriver()->PasswordFormSubmitted(
1178 *provisionally_saved_form_); 1178 *provisionally_saved_form_);
1179 provisionally_saved_form_.reset(); 1179 provisionally_saved_form_.reset();
1180 } else { 1180 } else {
1181 ScopedVector<PasswordForm> possible_submitted_forms; 1181 std::vector<std::unique_ptr<PasswordForm>> possible_submitted_forms;
1182 // Loop through the forms on the page looking for one that has been 1182 // Loop through the forms on the page looking for one that has been
1183 // filled out. If one exists, try and save the credentials. 1183 // filled out. If one exists, try and save the credentials.
1184 blink::WebVector<blink::WebFormElement> forms; 1184 blink::WebVector<blink::WebFormElement> forms;
1185 render_frame()->GetWebFrame()->document().forms(forms); 1185 render_frame()->GetWebFrame()->document().forms(forms);
1186 1186
1187 bool password_forms_found = false; 1187 bool password_forms_found = false;
1188 for (size_t i = 0; i < forms.size(); ++i) { 1188 for (size_t i = 0; i < forms.size(); ++i) {
1189 blink::WebFormElement form_element = forms[i]; 1189 blink::WebFormElement form_element = forms[i];
1190 if (logger) { 1190 if (logger) {
1191 LogHTMLForm(logger.get(), Logger::STRING_FORM_FOUND_ON_PAGE, 1191 LogHTMLForm(logger.get(), Logger::STRING_FORM_FOUND_ON_PAGE,
1192 form_element); 1192 form_element);
1193 } 1193 }
1194 possible_submitted_forms.push_back(CreatePasswordFormFromWebForm( 1194 possible_submitted_forms.push_back(CreatePasswordFormFromWebForm(
1195 form_element, &field_value_and_properties_map_, 1195 form_element, &field_value_and_properties_map_,
1196 &form_predictions_)); 1196 &form_predictions_));
1197 } 1197 }
1198 1198
1199 possible_submitted_forms.push_back( 1199 possible_submitted_forms.push_back(
1200 CreatePasswordFormFromUnownedInputElements( 1200 CreatePasswordFormFromUnownedInputElements(
1201 *render_frame()->GetWebFrame(), &field_value_and_properties_map_, 1201 *render_frame()->GetWebFrame(), &field_value_and_properties_map_,
1202 &form_predictions_)); 1202 &form_predictions_));
1203 1203
1204 for (const PasswordForm* password_form : possible_submitted_forms) { 1204 for (const auto& password_form : possible_submitted_forms) {
1205 if (password_form && !password_form->username_value.empty() && 1205 if (password_form && !password_form->username_value.empty() &&
1206 FormContainsNonDefaultPasswordValue(*password_form)) { 1206 FormContainsNonDefaultPasswordValue(*password_form)) {
1207 password_forms_found = true; 1207 password_forms_found = true;
1208 if (logger) { 1208 if (logger) {
1209 logger->LogPasswordForm(Logger::STRING_PASSWORD_FORM_FOUND_ON_PAGE, 1209 logger->LogPasswordForm(Logger::STRING_PASSWORD_FORM_FOUND_ON_PAGE,
1210 *password_form); 1210 *password_form);
1211 } 1211 }
1212 GetPasswordManagerDriver()->PasswordFormSubmitted(*password_form); 1212 GetPasswordManagerDriver()->PasswordFormSubmitted(*password_form);
1213 break; 1213 break;
1214 } 1214 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 PasswordAutofillAgent::GetPasswordManagerDriver() { 1489 PasswordAutofillAgent::GetPasswordManagerDriver() {
1490 if (!password_manager_driver_) { 1490 if (!password_manager_driver_) {
1491 render_frame()->GetRemoteInterfaces()->GetInterface( 1491 render_frame()->GetRemoteInterfaces()->GetInterface(
1492 mojo::MakeRequest(&password_manager_driver_)); 1492 mojo::MakeRequest(&password_manager_driver_));
1493 } 1493 }
1494 1494
1495 return password_manager_driver_; 1495 return password_manager_driver_;
1496 } 1496 }
1497 1497
1498 } // namespace autofill 1498 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698