OLD | NEW |
---|---|
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 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/scoped_block.h" | 10 #include "base/mac/scoped_block.h" |
11 #include "base/stl_util.h" | |
11 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "components/autofill/core/browser/password_generator.h" | 14 #include "components/autofill/core/browser/password_generator.h" |
14 #include "components/autofill/core/common/form_data.h" | 15 #include "components/autofill/core/common/form_data.h" |
15 #include "components/autofill/core/common/password_form.h" | 16 #include "components/autofill/core/common/password_form.h" |
16 #include "components/autofill/core/common/password_generation_util.h" | 17 #include "components/autofill/core/common/password_generation_util.h" |
17 #import "components/autofill/ios/browser/js_suggestion_manager.h" | 18 #import "components/autofill/ios/browser/js_suggestion_manager.h" |
18 #include "components/password_manager/core/browser/password_manager.h" | 19 #include "components/password_manager/core/browser/password_manager.h" |
19 #include "google_apis/gaia/gaia_urls.h" | 20 #include "google_apis/gaia/gaia_urls.h" |
20 #import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" | 21 #import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
36 namespace { | 37 namespace { |
37 | 38 |
38 // Target length of generated passwords. | 39 // Target length of generated passwords. |
39 const int kGeneratedPasswordLength = 20; | 40 const int kGeneratedPasswordLength = 20; |
40 | 41 |
41 // The minimum number of text fields that a form needs to be considered as | 42 // The minimum number of text fields that a form needs to be considered as |
42 // an account creation form. | 43 // an account creation form. |
43 const size_t kMinimumTextFieldsForAccountCreation = 3; | 44 const size_t kMinimumTextFieldsForAccountCreation = 3; |
44 | 45 |
45 // Returns true if |urls| contains |url|. | 46 // Returns true if |urls| contains |url|. |
46 bool VectorContainsURL(const std::vector<GURL>& urls, const GURL& url) { | 47 bool VectorContainsURL(const std::vector<GURL>& urls, const GURL& url) { |
sdefresne
2017/06/23 14:31:21
There is only one call site for VectorContainsURL
Tripta
2017/06/27 06:41:28
Done.
| |
47 return std::find(urls.begin(), urls.end(), url) != urls.end(); | 48 return base::ContainsValue(urls, url); |
48 } | 49 } |
49 | 50 |
50 // Returns whether |field| should be considered a text field. Implementation | 51 // Returns whether |field| should be considered a text field. Implementation |
51 // mirrors that of password_controller.js. | 52 // mirrors that of password_controller.js. |
52 // TODO(crbug.com/433856): Figure out how to determine if |field| is visible. | 53 // TODO(crbug.com/433856): Figure out how to determine if |field| is visible. |
53 bool IsTextField(const autofill::FormFieldData& field) { | 54 bool IsTextField(const autofill::FormFieldData& field) { |
54 return field.form_control_type == "text" || | 55 return field.form_control_type == "text" || |
55 field.form_control_type == "email" || | 56 field.form_control_type == "email" || |
56 field.form_control_type == "number" || | 57 field.form_control_type == "number" || |
57 field.form_control_type == "tel" || field.form_control_type == "url" || | 58 field.form_control_type == "tel" || field.form_control_type == "url" || |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 DCHECK(_accessoryViewReadyCompletion); | 437 DCHECK(_accessoryViewReadyCompletion); |
437 _accessoryViewReadyCompletion([self currentAccessoryView], self); | 438 _accessoryViewReadyCompletion([self currentAccessoryView], self); |
438 } | 439 } |
439 | 440 |
440 - (BOOL)getLogKeyboardAccessoryMetrics { | 441 - (BOOL)getLogKeyboardAccessoryMetrics { |
441 // Only store metrics for regular Autofill, not passwords. | 442 // Only store metrics for regular Autofill, not passwords. |
442 return NO; | 443 return NO; |
443 } | 444 } |
444 | 445 |
445 @end | 446 @end |
OLD | NEW |