diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc index 3936c1f97a7b15..ca1c064af428f5 100644 --- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc +++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc @@ -19,6 +19,7 @@ #include "base/task/thread_pool.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/common/chrome_switches.h" +#include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/debug_daemon/debug_daemon_client.h" #include "components/user_manager/user.h" @@ -167,8 +168,13 @@ void DebugDaemonLogSource::Fetch(SysLogsSourceCallback callback) { ++num_pending_requests_; if (scrub_) { - client->GetScrubbedBigLogs(base::BindOnce(&DebugDaemonLogSource::OnGetLogs, - weak_ptr_factory_.GetWeakPtr())); + const user_manager::User* user = + user_manager::UserManager::Get()->GetActiveUser(); + client->GetScrubbedBigLogs( + cryptohome::CreateAccountIdentifierFromAccountId( + user ? user->GetAccountId() : EmptyAccountId()), + base::BindOnce(&DebugDaemonLogSource::OnGetLogs, + weak_ptr_factory_.GetWeakPtr())); } else { client->GetAllLogs(base::BindOnce(&DebugDaemonLogSource::OnGetLogs, weak_ptr_factory_.GetWeakPtr())); diff --git a/chromeos/dbus/debug_daemon/BUILD.gn b/chromeos/dbus/debug_daemon/BUILD.gn index a8b94d89cc4c28..11e4eb46e70da9 100644 --- a/chromeos/dbus/debug_daemon/BUILD.gn +++ b/chromeos/dbus/debug_daemon/BUILD.gn @@ -10,6 +10,8 @@ component("debug_daemon") { deps = [ "//base", "//chromeos/dbus:common", + "//chromeos/dbus/cryptohome", + "//chromeos/dbus/cryptohome:cryptohome_proto", "//dbus", ] diff --git a/chromeos/dbus/debug_daemon/debug_daemon_client.cc b/chromeos/dbus/debug_daemon/debug_daemon_client.cc index 3e5b18ba38c30f..2c474d1fd3982f 100644 --- a/chromeos/dbus/debug_daemon/debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon/debug_daemon_client.cc @@ -30,6 +30,8 @@ #include "base/task/thread_pool.h" #include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/trace_config.h" +#include "chromeos/dbus/cryptohome/cryptohome_client.h" +#include "chromeos/dbus/cryptohome/rpc.pb.h" #include "chromeos/dbus/pipe_reader.h" #include "dbus/bus.h" #include "dbus/message.h" @@ -232,7 +234,8 @@ class DebugDaemonClientImpl : public DebugDaemonClient { weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } - void GetScrubbedBigLogs(GetLogsCallback callback) override { + void GetScrubbedBigLogs(const cryptohome::AccountIdentifier& id, + GetLogsCallback callback) override { // The PipeReaderWrapper is a self-deleting object; we don't have to worry // about ownership or lifetime. We need to create a new one for each Big // Logs requests in order to queue these requests. One request can take a @@ -245,6 +248,7 @@ class DebugDaemonClientImpl : public DebugDaemonClient { debugd::kGetBigFeedbackLogs); dbus::MessageWriter writer(&method_call); writer.AppendFileDescriptor(pipe_write_end.get()); + writer.AppendString(id.account_id()); DVLOG(1) << "Requesting big feedback logs"; debugdaemon_proxy_->CallMethod( diff --git a/chromeos/dbus/debug_daemon/debug_daemon_client.h b/chromeos/dbus/debug_daemon/debug_daemon_client.h index f331e34a10f609..ad6ada0f4f7458 100644 --- a/chromeos/dbus/debug_daemon/debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon/debug_daemon_client.h @@ -23,6 +23,9 @@ #include "chromeos/dbus/dbus_method_call_status.h" #include "third_party/cros_system_api/dbus/service_constants.h" +namespace cryptohome { +class AccountIdentifier; +} namespace chromeos { // A DbusLibraryError represents an error response received from D-Bus. @@ -97,7 +100,10 @@ class COMPONENT_EXPORT(DEBUG_DAEMON) DebugDaemonClient // Gets the scrubbed logs from debugd that are very large and cannot be // returned directly from D-Bus. These logs will include ARC and cheets // system information. - virtual void GetScrubbedBigLogs(GetLogsCallback callback) = 0; + // |id|: Cryptohome Account identifier for the user to get + // logs for. + virtual void GetScrubbedBigLogs(const cryptohome::AccountIdentifier& id, + GetLogsCallback callback) = 0; // Gets all logs collected by debugd. virtual void GetAllLogs(GetLogsCallback callback) = 0; diff --git a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc index 249b6a3c73cdc6..de4ad0af42d7cb 100644 --- a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc @@ -118,7 +118,9 @@ void FakeDebugDaemonClient::GetPerfOutput( void FakeDebugDaemonClient::StopPerf(uint64_t session_id, VoidDBusMethodCallback callback) {} -void FakeDebugDaemonClient::GetScrubbedBigLogs(GetLogsCallback callback) { +void FakeDebugDaemonClient::GetScrubbedBigLogs( + const cryptohome::AccountIdentifier& id, + GetLogsCallback callback) { std::map sample; sample["Sample Scrubbed Big Log"] = "Your email address is xxxxxxxx"; base::ThreadTaskRunnerHandle::Get()->PostTask( diff --git a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h index a74ddd40b61e01..30c81b05cb88c0 100644 --- a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h @@ -56,7 +56,8 @@ class COMPONENT_EXPORT(DEBUG_DAEMON) FakeDebugDaemonClient int file_descriptor, DBusMethodCallback callback) override; void StopPerf(uint64_t session_id, VoidDBusMethodCallback callback) override; - void GetScrubbedBigLogs(GetLogsCallback callback) override; + void GetScrubbedBigLogs(const cryptohome::AccountIdentifier& id, + GetLogsCallback callback) override; void GetAllLogs(GetLogsCallback callback) override; void GetLog(const std::string& log_name, DBusMethodCallback callback) override;