OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/credential_manager_logger.h" | 5 #include "components/password_manager/core/browser/credential_manager_logger.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "components/autofill/core/common/save_password_progress_logger.h" | 10 #include "components/autofill/core/common/save_password_progress_logger.h" |
11 #include "components/password_manager/core/browser/log_manager.h" | 11 #include "components/password_manager/core/browser/log_manager.h" |
12 | 12 |
13 using autofill::SavePasswordProgressLogger; | 13 using autofill::SavePasswordProgressLogger; |
14 | 14 |
15 namespace password_manager { | 15 namespace password_manager { |
16 | 16 |
17 CredentialManagerLogger::CredentialManagerLogger(const LogManager* log_manager) | 17 CredentialManagerLogger::CredentialManagerLogger(const LogManager* log_manager) |
18 : log_manager_(log_manager) {} | 18 : log_manager_(log_manager) {} |
19 | 19 |
20 CredentialManagerLogger::~CredentialManagerLogger() = default; | 20 CredentialManagerLogger::~CredentialManagerLogger() = default; |
21 | 21 |
22 void CredentialManagerLogger::LogRequestCredential( | 22 void CredentialManagerLogger::LogRequestCredential( |
23 const GURL& url, | 23 const GURL& url, |
24 bool zero_click_only, | 24 CredentialMediationRequirement mediation, |
25 const std::vector<GURL>& federations) { | 25 const std::vector<GURL>& federations) { |
26 std::string s("CM API get credentials: origin=" + | 26 std::string s("CM API get credentials: origin=" + |
27 SavePasswordProgressLogger::ScrubURL(url)); | 27 SavePasswordProgressLogger::ScrubURL(url)); |
28 s += ", zero_click_only=" + base::IntToString(zero_click_only); | 28 s += ", mediation="; |
| 29 switch (mediation) { |
| 30 case CredentialMediationRequirement::kSilent: |
| 31 s += "silent"; |
| 32 break; |
| 33 case CredentialMediationRequirement::kOptional: |
| 34 s += "optional"; |
| 35 break; |
| 36 case CredentialMediationRequirement::kRequired: |
| 37 s += "required"; |
| 38 break; |
| 39 } |
29 s += ", federations="; | 40 s += ", federations="; |
30 for (const GURL& federation_provider : federations) | 41 for (const GURL& federation_provider : federations) |
31 s += SavePasswordProgressLogger::ScrubURL(federation_provider) + ", "; | 42 s += SavePasswordProgressLogger::ScrubURL(federation_provider) + ", "; |
32 | 43 |
33 log_manager_->LogSavePasswordProgress(s); | 44 log_manager_->LogSavePasswordProgress(s); |
34 } | 45 } |
35 | 46 |
36 void CredentialManagerLogger::LogSendCredential(const GURL& url, | 47 void CredentialManagerLogger::LogSendCredential(const GURL& url, |
37 CredentialType type) { | 48 CredentialType type) { |
38 std::string s("CM API send a credential: origin=" + | 49 std::string s("CM API send a credential: origin=" + |
(...skipping 10 matching lines...) Expand all Loading... |
49 log_manager_->LogSavePasswordProgress(s); | 60 log_manager_->LogSavePasswordProgress(s); |
50 } | 61 } |
51 | 62 |
52 void CredentialManagerLogger::LogRequireUserMediation(const GURL& url) { | 63 void CredentialManagerLogger::LogRequireUserMediation(const GURL& url) { |
53 std::string s("CM API sign out: origin=" + | 64 std::string s("CM API sign out: origin=" + |
54 SavePasswordProgressLogger::ScrubURL(url)); | 65 SavePasswordProgressLogger::ScrubURL(url)); |
55 log_manager_->LogSavePasswordProgress(s); | 66 log_manager_->LogSavePasswordProgress(s); |
56 } | 67 } |
57 | 68 |
58 } // namespace password_manager | 69 } // namespace password_manager |
OLD | NEW |