Index: components/password_manager/core/browser/credential_manager_logger.cc |
diff --git a/components/password_manager/core/browser/credential_manager_logger.cc b/components/password_manager/core/browser/credential_manager_logger.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f5173c1868ac341eb453e20430e270c91eca7225 |
--- /dev/null |
+++ b/components/password_manager/core/browser/credential_manager_logger.cc |
@@ -0,0 +1,58 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "components/password_manager/core/browser/credential_manager_logger.h" |
+ |
+#include <string> |
+ |
+#include "base/strings/string_number_conversions.h" |
+#include "components/autofill/core/common/save_password_progress_logger.h" |
+#include "components/password_manager/core/browser/log_manager.h" |
+ |
+using autofill::SavePasswordProgressLogger; |
+ |
+namespace password_manager { |
+ |
+CredentialManagerLogger::CredentialManagerLogger(const LogManager* log_manager) |
+ : log_manager_(log_manager) {} |
+ |
+CredentialManagerLogger::~CredentialManagerLogger() = default; |
+ |
+void CredentialManagerLogger::LogRequestCredential( |
+ const GURL& url, |
+ bool zero_click_only, |
+ const std::vector<GURL>& federations) { |
+ std::string s("CM API get credentials: origin=" + |
+ SavePasswordProgressLogger::ScrubURL(url)); |
+ s += ", zero_click_only=" + base::IntToString(zero_click_only); |
+ s += ", federations="; |
+ for (const GURL& federation_provider : federations) |
+ s += SavePasswordProgressLogger::ScrubURL(federation_provider) + ", "; |
+ |
+ log_manager_->LogSavePasswordProgress(s); |
+} |
+ |
+void CredentialManagerLogger::LogSendCredential(const GURL& url, |
+ CredentialType type) { |
+ std::string s("CM API send a credential: origin=" + |
+ SavePasswordProgressLogger::ScrubURL(url)); |
+ s += ", CredentialType=" + CredentialTypeToString(type); |
+ log_manager_->LogSavePasswordProgress(s); |
+} |
+ |
+void CredentialManagerLogger::LogStoreCredential(const GURL& url, |
+ CredentialType type) { |
+ std::string s("CM API save a credential: origin=" + |
+ SavePasswordProgressLogger::ScrubURL(url)); |
+ s += ", CredentialType=" + CredentialTypeToString(type); |
+ log_manager_->LogSavePasswordProgress(s); |
+} |
+ |
+void CredentialManagerLogger::LogRequireUserMediation(const GURL& url) { |
+ std::string s("CM API sign out: origin=" + |
+ SavePasswordProgressLogger::ScrubURL(url)); |
+ log_manager_->LogSavePasswordProgress(s); |
+} |
+ |
+} // namespace password_manager |