Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Unified Diff: components/password_manager/core/browser/credential_manager_logger.cc

Issue 2293443002: Implement logging of the Credential Manager API calls to chrome://password-manager-internals. (Closed)
Patch Set: nits Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698