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

Side by Side Diff: ios/chrome/browser/passwords/password_generation_agent.mm

Issue 2458843003: Fix TODO style in password_generation_agent.mm (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ios/chrome/browser/passwords/password_generation_agent.h" 5 #import "ios/chrome/browser/passwords/password_generation_agent.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #import "base/ios/weak_nsobject.h" 9 #import "base/ios/weak_nsobject.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 29 matching lines...) Expand all
40 // an account creation form. 40 // an account creation form.
41 const size_t kMinimumTextFieldsForAccountCreation = 3; 41 const size_t kMinimumTextFieldsForAccountCreation = 3;
42 42
43 // Returns true if |urls| contains |url|. 43 // Returns true if |urls| contains |url|.
44 bool VectorContainsURL(const std::vector<GURL>& urls, const GURL& url) { 44 bool VectorContainsURL(const std::vector<GURL>& urls, const GURL& url) {
45 return std::find(urls.begin(), urls.end(), url) != urls.end(); 45 return std::find(urls.begin(), urls.end(), url) != urls.end();
46 } 46 }
47 47
48 // Returns whether |field| should be considered a text field. Implementation 48 // Returns whether |field| should be considered a text field. Implementation
49 // mirrors that of password_controller.js. 49 // mirrors that of password_controller.js.
50 // TODO(dconnelly): Figure out how (and if) to determine if |field| is visible. 50 // TODO(crbug.com/433856): Figure out how to determine if |field| is visible.
51 // http://crbug.com/433856
52 bool IsTextField(const autofill::FormFieldData& field) { 51 bool IsTextField(const autofill::FormFieldData& field) {
53 return field.form_control_type == "text" || 52 return field.form_control_type == "text" ||
54 field.form_control_type == "email" || 53 field.form_control_type == "email" ||
55 field.form_control_type == "number" || 54 field.form_control_type == "number" ||
56 field.form_control_type == "tel" || field.form_control_type == "url" || 55 field.form_control_type == "tel" || field.form_control_type == "url" ||
57 field.form_control_type == "search" || 56 field.form_control_type == "search" ||
58 field.form_control_type == "password"; 57 field.form_control_type == "password";
59 } 58 }
60 59
61 } // namespace 60 } // namespace
(...skipping 16 matching lines...) Expand all
78 77
79 // Returns a list of all password fields in |form|. 78 // Returns a list of all password fields in |form|.
80 - (std::vector<autofill::FormFieldData>)passwordFieldsInForm: 79 - (std::vector<autofill::FormFieldData>)passwordFieldsInForm:
81 (const autofill::PasswordForm&)form; 80 (const autofill::PasswordForm&)form;
82 81
83 // Merges the data from local heuristics, the autofill server, and the password 82 // Merges the data from local heuristics, the autofill server, and the password
84 // manager to find the field that should trigger the password generation UI 83 // manager to find the field that should trigger the password generation UI
85 // when selected by the user. The resulting field is stored in 84 // when selected by the user. The resulting field is stored in
86 // |_passwordGenerationField|. This logic is nearly identical to that of the 85 // |_passwordGenerationField|. This logic is nearly identical to that of the
87 // upstream autofill::PasswordGenerationAgent::DetermineGenerationElement. 86 // upstream autofill::PasswordGenerationAgent::DetermineGenerationElement.
88 // TODO(dconnelly): Try to find a way to share this code with the upstream
89 // implementation, even though it lives in the renderer.
90 // http://crbug.com/434679.
91 - (void)determinePasswordGenerationField; 87 - (void)determinePasswordGenerationField;
92 88
93 // Returns YES if the specified form and field should trigger the 89 // Returns YES if the specified form and field should trigger the
94 // password generation UI. 90 // password generation UI.
95 - (BOOL)isGenerationForm:(const base::string16&)formName 91 - (BOOL)isGenerationForm:(const base::string16&)formName
96 field:(const base::string16&)fieldName; 92 field:(const base::string16&)fieldName;
97 93
98 // The name of the form identified as an account creation form, if it exists. 94 // The name of the form identified as an account creation form, if it exists.
99 - (NSString*)passwordGenerationFormName; 95 - (NSString*)passwordGenerationFormName;
100 96
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 return passwordFields; 255 return passwordFields;
260 } 256 }
261 257
262 - (void)allowPasswordGenerationForForm:(const autofill::PasswordForm&)form { 258 - (void)allowPasswordGenerationForForm:(const autofill::PasswordForm&)form {
263 _allowedGenerationFormOrigins.push_back(form.origin); 259 _allowedGenerationFormOrigins.push_back(form.origin);
264 [self determinePasswordGenerationField]; 260 [self determinePasswordGenerationField];
265 } 261 }
266 262
267 - (void)processParsedPasswordForms: 263 - (void)processParsedPasswordForms:
268 (const std::vector<autofill::PasswordForm>&)forms { 264 (const std::vector<autofill::PasswordForm>&)forms {
269 // TODO(dconnelly): Find a way to share some of this logic with the desktop
270 // agent. http://crbug.com/434679.
271 for (const auto& passwordForm : forms) { 265 for (const auto& passwordForm : forms) {
272 if ([self formHasGAIARealm:passwordForm]) 266 if ([self formHasGAIARealm:passwordForm])
273 continue; 267 continue;
274 if (![self formHasEnoughTextFieldsForAccountCreation:passwordForm]) 268 if (![self formHasEnoughTextFieldsForAccountCreation:passwordForm])
275 continue; 269 continue;
276 std::vector<autofill::FormFieldData> passwordFields( 270 std::vector<autofill::FormFieldData> passwordFields(
277 [self passwordFieldsInForm:passwordForm]); 271 [self passwordFieldsInForm:passwordForm]);
278 if (passwordFields.empty()) 272 if (passwordFields.empty())
279 continue; 273 continue;
280 // This form checks out. 274 // This form checks out.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 DCHECK(_accessoryViewReadyCompletion); 439 DCHECK(_accessoryViewReadyCompletion);
446 _accessoryViewReadyCompletion.get()([self currentAccessoryView], self); 440 _accessoryViewReadyCompletion.get()([self currentAccessoryView], self);
447 } 441 }
448 442
449 - (BOOL)getLogKeyboardAccessoryMetrics { 443 - (BOOL)getLogKeyboardAccessoryMetrics {
450 // Only store metrics for regular Autofill, not passwords. 444 // Only store metrics for regular Autofill, not passwords.
451 return NO; 445 return NO;
452 } 446 }
453 447
454 @end 448 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698