OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/sync/browser/sync_credentials_filter.h" | 5 #include "components/password_manager/sync/browser/sync_credentials_filter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | |
10 #include "base/macros.h" | 9 #include "base/macros.h" |
11 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
12 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
13 #include "base/metrics/user_metrics.h" | 12 #include "base/metrics/user_metrics.h" |
14 #include "components/password_manager/core/common/password_manager_switches.h" | 13 #include "components/password_manager/core/common/password_manager_features.h" |
15 #include "components/password_manager/sync/browser/password_sync_util.h" | 14 #include "components/password_manager/sync/browser/password_sync_util.h" |
16 #include "google_apis/gaia/gaia_urls.h" | 15 #include "google_apis/gaia/gaia_urls.h" |
17 #include "net/base/url_util.h" | 16 #include "net/base/url_util.h" |
18 | 17 |
19 using autofill::PasswordForm; | 18 using autofill::PasswordForm; |
20 | 19 |
21 namespace password_manager { | 20 namespace password_manager { |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 base::RecordAction( | 83 base::RecordAction( |
85 base::UserMetricsAction("PasswordManager_SyncCredentialUsed")); | 84 base::UserMetricsAction("PasswordManager_SyncCredentialUsed")); |
86 } | 85 } |
87 | 86 |
88 // static | 87 // static |
89 SyncCredentialsFilter::AutofillForSyncCredentialsState | 88 SyncCredentialsFilter::AutofillForSyncCredentialsState |
90 SyncCredentialsFilter::GetAutofillForSyncCredentialsState() { | 89 SyncCredentialsFilter::GetAutofillForSyncCredentialsState() { |
91 std::string group_name = | 90 std::string group_name = |
92 base::FieldTrialList::FindFullName("AutofillSyncCredential"); | 91 base::FieldTrialList::FindFullName("AutofillSyncCredential"); |
93 | 92 |
94 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 93 if (base::FeatureList::IsEnabled(features::kAllowAutofillSyncCredential)) |
95 if (command_line->HasSwitch(switches::kAllowAutofillSyncCredential)) | |
96 return ALLOW_SYNC_CREDENTIALS; | 94 return ALLOW_SYNC_CREDENTIALS; |
97 if (command_line->HasSwitch( | 95 |
98 switches::kDisallowAutofillSyncCredentialForReauth)) { | 96 if (base::FeatureList::IsEnabled( |
| 97 features::kDisallowAutofillSyncCredentialForReauth)) |
99 return DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 98 return DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
100 } | 99 |
101 if (command_line->HasSwitch(switches::kDisallowAutofillSyncCredential)) | 100 if (base::FeatureList::IsEnabled(features::kDisallowAutofillSyncCredential)) |
102 return DISALLOW_SYNC_CREDENTIALS; | 101 return DISALLOW_SYNC_CREDENTIALS; |
103 | 102 |
104 if (group_name == "DisallowSyncCredentialsForReauth") | 103 if (group_name == "DisallowSyncCredentialsForReauth") |
105 return DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 104 return DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
| 105 |
106 if (group_name == "DisallowSyncCredentials") | 106 if (group_name == "DisallowSyncCredentials") |
107 return DISALLOW_SYNC_CREDENTIALS; | 107 return DISALLOW_SYNC_CREDENTIALS; |
108 | 108 |
109 // Allow by default. | 109 // Allow by default. |
110 return ALLOW_SYNC_CREDENTIALS; | 110 return ALLOW_SYNC_CREDENTIALS; |
111 } | 111 } |
112 | 112 |
113 } // namespace password_manager | 113 } // namespace password_manager |
OLD | NEW |