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/renderer/password_generation_agent.h" | 5 #include "components/autofill/content/renderer/password_generation_agent.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/stl_util.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
14 #include "components/autofill/content/renderer/form_autofill_util.h" | 15 #include "components/autofill/content/renderer/form_autofill_util.h" |
15 #include "components/autofill/content/renderer/form_classifier.h" | 16 #include "components/autofill/content/renderer/form_classifier.h" |
16 #include "components/autofill/content/renderer/password_autofill_agent.h" | 17 #include "components/autofill/content/renderer/password_autofill_agent.h" |
17 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | 18 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
18 #include "components/autofill/core/common/autofill_switches.h" | 19 #include "components/autofill/core/common/autofill_switches.h" |
19 #include "components/autofill/core/common/form_data.h" | 20 #include "components/autofill/core/common/form_data.h" |
20 #include "components/autofill/core/common/password_form.h" | 21 #include "components/autofill/core/common/password_form.h" |
21 #include "components/autofill/core/common/password_form_generation_data.h" | 22 #include "components/autofill/core/common/password_form_generation_data.h" |
22 #include "components/autofill/core/common/password_generation_util.h" | 23 #include "components/autofill/core/common/password_generation_util.h" |
(...skipping 28 matching lines...) Expand all Loading... |
51 ToWebInputElement(&control_element); | 52 ToWebInputElement(&control_element); |
52 if (input_element && input_element->IsTextField() && | 53 if (input_element && input_element->IsTextField() && |
53 input_element->IsPasswordField()) { | 54 input_element->IsPasswordField()) { |
54 passwords->push_back(*input_element); | 55 passwords->push_back(*input_element); |
55 } | 56 } |
56 } | 57 } |
57 return !passwords->empty(); | 58 return !passwords->empty(); |
58 } | 59 } |
59 | 60 |
60 bool ContainsURL(const std::vector<GURL>& urls, const GURL& url) { | 61 bool ContainsURL(const std::vector<GURL>& urls, const GURL& url) { |
61 return std::find(urls.begin(), urls.end(), url) != urls.end(); | 62 return base::ContainsValue(urls, url); |
62 } | 63 } |
63 | 64 |
64 // Calculates the signature of |form| and searches it in |forms|. | 65 // Calculates the signature of |form| and searches it in |forms|. |
65 const PasswordFormGenerationData* FindFormGenerationData( | 66 const PasswordFormGenerationData* FindFormGenerationData( |
66 const std::vector<PasswordFormGenerationData>& forms, | 67 const std::vector<PasswordFormGenerationData>& forms, |
67 const PasswordForm& form) { | 68 const PasswordForm& form) { |
68 FormSignature form_signature = CalculateFormSignature(form.form_data); | 69 FormSignature form_signature = CalculateFormSignature(form.form_data); |
69 for (const auto& form_it : forms) { | 70 for (const auto& form_it : forms) { |
70 if (form_it.form_signature == form_signature) | 71 if (form_it.form_signature == form_signature) |
71 return &form_it; | 72 return &form_it; |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 654 |
654 void PasswordGenerationAgent::LogNumber(Logger::StringID message_id, | 655 void PasswordGenerationAgent::LogNumber(Logger::StringID message_id, |
655 int number) { | 656 int number) { |
656 if (!password_agent_->logging_state_active()) | 657 if (!password_agent_->logging_state_active()) |
657 return; | 658 return; |
658 RendererSavePasswordProgressLogger logger(GetPasswordManagerDriver().get()); | 659 RendererSavePasswordProgressLogger logger(GetPasswordManagerDriver().get()); |
659 logger.LogNumber(message_id, number); | 660 logger.LogNumber(message_id, number); |
660 } | 661 } |
661 | 662 |
662 } // namespace autofill | 663 } // namespace autofill |
OLD | NEW |