| 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 #include "components/password_manager/core/browser/affiliation_utils.h" | 5 #include "components/password_manager/core/browser/affiliation_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 bool IsAffiliationBasedMatchingEnabled(const base::CommandLine& command_line) { | 295 bool IsAffiliationBasedMatchingEnabled(const base::CommandLine& command_line) { |
| 296 // Note: It is important to always query the field trial state, to ensure that | 296 // Note: It is important to always query the field trial state, to ensure that |
| 297 // UMA reports the correct group. | 297 // UMA reports the correct group. |
| 298 const std::string group_name = | 298 const std::string group_name = |
| 299 base::FieldTrialList::FindFullName(kFieldTrialName); | 299 base::FieldTrialList::FindFullName(kFieldTrialName); |
| 300 | 300 |
| 301 if (command_line.HasSwitch(switches::kDisableAffiliationBasedMatching)) | 301 if (command_line.HasSwitch(switches::kDisableAffiliationBasedMatching)) |
| 302 return false; | 302 return false; |
| 303 if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching)) | 303 if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching)) |
| 304 return true; | 304 return true; |
| 305 return base::StartsWithASCII(group_name, "Enabled", /*case_sensitive=*/false); | 305 return base::StartsWith(group_name, "Enabled", |
| 306 base::CompareCase::INSENSITIVE_ASCII); |
| 306 } | 307 } |
| 307 | 308 |
| 308 bool IsPropagatingPasswordChangesToWebCredentialsEnabled( | 309 bool IsPropagatingPasswordChangesToWebCredentialsEnabled( |
| 309 const base::CommandLine& command_line) { | 310 const base::CommandLine& command_line) { |
| 310 // Note: It is important to always query the variation param first, which, in | 311 // Note: It is important to always query the variation param first, which, in |
| 311 // turn, queries the field trial state, which ensures that UMA reports the | 312 // turn, queries the field trial state, which ensures that UMA reports the |
| 312 // correct group if it is forced by a command line flag. | 313 // correct group if it is forced by a command line flag. |
| 313 const std::string update_enabled = variations::GetVariationParamValue( | 314 const std::string update_enabled = variations::GetVariationParamValue( |
| 314 kFieldTrialName, "propagate_password_changes_to_web"); | 315 kFieldTrialName, "propagate_password_changes_to_web"); |
| 315 | 316 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 339 std::string GetHumanReadableOrigin(const autofill::PasswordForm& password_form, | 340 std::string GetHumanReadableOrigin(const autofill::PasswordForm& password_form, |
| 340 const std::string& languages) { | 341 const std::string& languages) { |
| 341 password_manager::FacetURI facet_uri = | 342 password_manager::FacetURI facet_uri = |
| 342 password_manager::FacetURI::FromPotentiallyInvalidSpec( | 343 password_manager::FacetURI::FromPotentiallyInvalidSpec( |
| 343 password_form.signon_realm); | 344 password_form.signon_realm); |
| 344 if (facet_uri.IsValidAndroidFacetURI()) | 345 if (facet_uri.IsValidAndroidFacetURI()) |
| 345 return facet_uri.scheme() + "://" + facet_uri.android_package_name(); | 346 return facet_uri.scheme() + "://" + facet_uri.android_package_name(); |
| 346 return base::UTF16ToUTF8(net::FormatUrl(password_form.origin, languages)); | 347 return base::UTF16ToUTF8(net::FormatUrl(password_form.origin, languages)); |
| 347 } | 348 } |
| 348 } // namespace password_manager | 349 } // namespace password_manager |
| OLD | NEW |