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

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

Issue 2972333002: autofill : Use ContainsValue() instead of std::find() in components/autofill (Closed)
Patch Set: Created 3 years, 5 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_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
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ToWebInputElement(&control_element); 51 ToWebInputElement(&control_element);
52 if (input_element && input_element->IsTextField() && 52 if (input_element && input_element->IsTextField() &&
53 input_element->IsPasswordField()) { 53 input_element->IsPasswordField()) {
54 passwords->push_back(*input_element); 54 passwords->push_back(*input_element);
55 } 55 }
56 } 56 }
57 return !passwords->empty(); 57 return !passwords->empty();
58 } 58 }
59 59
60 bool ContainsURL(const std::vector<GURL>& urls, const GURL& url) { 60 bool ContainsURL(const std::vector<GURL>& urls, const GURL& url) {
61 return std::find(urls.begin(), urls.end(), url) != urls.end(); 61 return base::ContainsValue(urls, url);
vabr (Chromium) 2017/07/09 18:23:59 Please also #include "base/stl_util.h" in this fil
deejay 2017/07/10 03:47:16 Done.
62 } 62 }
63 63
64 // Calculates the signature of |form| and searches it in |forms|. 64 // Calculates the signature of |form| and searches it in |forms|.
65 const PasswordFormGenerationData* FindFormGenerationData( 65 const PasswordFormGenerationData* FindFormGenerationData(
66 const std::vector<PasswordFormGenerationData>& forms, 66 const std::vector<PasswordFormGenerationData>& forms,
67 const PasswordForm& form) { 67 const PasswordForm& form) {
68 FormSignature form_signature = CalculateFormSignature(form.form_data); 68 FormSignature form_signature = CalculateFormSignature(form.form_data);
69 for (const auto& form_it : forms) { 69 for (const auto& form_it : forms) {
70 if (form_it.form_signature == form_signature) 70 if (form_it.form_signature == form_signature)
71 return &form_it; 71 return &form_it;
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 653
654 void PasswordGenerationAgent::LogNumber(Logger::StringID message_id, 654 void PasswordGenerationAgent::LogNumber(Logger::StringID message_id,
655 int number) { 655 int number) {
656 if (!password_agent_->logging_state_active()) 656 if (!password_agent_->logging_state_active())
657 return; 657 return;
658 RendererSavePasswordProgressLogger logger(GetPasswordManagerDriver().get()); 658 RendererSavePasswordProgressLogger logger(GetPasswordManagerDriver().get());
659 logger.LogNumber(message_id, number); 659 logger.LogNumber(message_id, number);
660 } 660 }
661 661
662 } // namespace autofill 662 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698