OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/password_manager/core/browser/password_manager.h" | 5 #include "components/password_manager/core/browser/password_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/command_line.h" | |
12 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
14 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
16 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
17 #include "build/build_config.h" | 16 #include "build/build_config.h" |
18 #include "components/autofill/core/browser/autofill_field.h" | 17 #include "components/autofill/core/browser/autofill_field.h" |
19 #include "components/autofill/core/browser/form_structure.h" | 18 #include "components/autofill/core/browser/form_structure.h" |
20 #include "components/autofill/core/common/form_data_predictions.h" | 19 #include "components/autofill/core/common/form_data_predictions.h" |
21 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 20 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
22 #include "components/password_manager/core/browser/affiliation_utils.h" | 21 #include "components/password_manager/core/browser/affiliation_utils.h" |
23 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" | 22 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" |
24 #include "components/password_manager/core/browser/keychain_migration_status_mac
.h" | 23 #include "components/password_manager/core/browser/keychain_migration_status_mac
.h" |
25 #include "components/password_manager/core/browser/log_manager.h" | 24 #include "components/password_manager/core/browser/log_manager.h" |
26 #include "components/password_manager/core/browser/password_autofill_manager.h" | 25 #include "components/password_manager/core/browser/password_autofill_manager.h" |
27 #include "components/password_manager/core/browser/password_form_manager.h" | 26 #include "components/password_manager/core/browser/password_form_manager.h" |
28 #include "components/password_manager/core/browser/password_manager_client.h" | 27 #include "components/password_manager/core/browser/password_manager_client.h" |
29 #include "components/password_manager/core/browser/password_manager_driver.h" | 28 #include "components/password_manager/core/browser/password_manager_driver.h" |
30 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 29 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
31 #include "components/password_manager/core/browser/password_manager_util.h" | 30 #include "components/password_manager/core/browser/password_manager_util.h" |
| 31 #include "components/password_manager/core/common/password_manager_features.h" |
32 #include "components/password_manager/core/common/password_manager_pref_names.h" | 32 #include "components/password_manager/core/common/password_manager_pref_names.h" |
33 #include "components/password_manager/core/common/password_manager_switches.h" | |
34 #include "components/pref_registry/pref_registry_syncable.h" | 33 #include "components/pref_registry/pref_registry_syncable.h" |
35 #include "components/prefs/pref_service.h" | 34 #include "components/prefs/pref_service.h" |
36 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 35 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
37 | 36 |
38 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
39 #include "components/prefs/pref_registry_simple.h" | 38 #include "components/prefs/pref_registry_simple.h" |
40 #endif | 39 #endif |
41 | 40 |
42 using autofill::PasswordForm; | 41 using autofill::PasswordForm; |
43 using autofill::PasswordFormMap; | 42 using autofill::PasswordFormMap; |
44 | 43 |
45 namespace password_manager { | 44 namespace password_manager { |
46 | 45 |
47 namespace { | 46 namespace { |
48 | 47 |
49 const char kSpdyProxyRealm[] = "/SpdyProxy"; | 48 const char kSpdyProxyRealm[] = "/SpdyProxy"; |
50 | 49 |
51 // Shorten the name to spare line breaks. The code provides enough context | 50 // Shorten the name to spare line breaks. The code provides enough context |
52 // already. | 51 // already. |
53 typedef autofill::SavePasswordProgressLogger Logger; | 52 typedef autofill::SavePasswordProgressLogger Logger; |
54 | 53 |
55 bool ShouldDropSyncCredential() { | 54 bool ShouldDropSyncCredential() { |
56 std::string group_name = | 55 std::string group_name = |
57 base::FieldTrialList::FindFullName("PasswordManagerDropSyncCredential"); | 56 base::FieldTrialList::FindFullName("PasswordManagerDropSyncCredential"); |
58 | 57 |
59 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 58 if (base::FeatureList::IsEnabled(features::kDropSyncCredential)) |
60 if (command_line->HasSwitch(switches::kEnableDropSyncCredential)) | |
61 return true; | 59 return true; |
62 | 60 |
63 if (command_line->HasSwitch(switches::kDisableDropSyncCredential)) | 61 if (password_manager_util::IsFeatureDisabledFromCommandLine( |
| 62 features::kDropSyncCredential)) { |
64 return false; | 63 return false; |
| 64 } |
65 | 65 |
66 // Default to not saving. | 66 // Default to not saving. |
67 return group_name != "Disabled"; | 67 return group_name != "Disabled"; |
68 } | 68 } |
69 | 69 |
70 bool URLsEqualUpToScheme(const GURL& a, const GURL& b) { | 70 bool URLsEqualUpToScheme(const GURL& a, const GURL& b) { |
71 return (a.GetContent() == b.GetContent()); | 71 return (a.GetContent() == b.GetContent()); |
72 } | 72 } |
73 | 73 |
74 bool URLsEqualUpToHttpHttpsSubstitution(const GURL& a, const GURL& b) { | 74 bool URLsEqualUpToHttpHttpsSubstitution(const GURL& a, const GURL& b) { |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 matched_manager_it = iter; | 845 matched_manager_it = iter; |
846 current_match_result = result; | 846 current_match_result = result; |
847 } | 847 } |
848 } | 848 } |
849 if (matched_manager_it != pending_login_managers_.end()) | 849 if (matched_manager_it != pending_login_managers_.end()) |
850 return *matched_manager_it; | 850 return *matched_manager_it; |
851 return nullptr; | 851 return nullptr; |
852 } | 852 } |
853 | 853 |
854 } // namespace password_manager | 854 } // namespace password_manager |
OLD | NEW |