diff options
author | gauravsh@chromium.org <gauravsh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 23:07:05 +0000 |
---|---|---|
committer | gauravsh@chromium.org <gauravsh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 23:07:05 +0000 |
commit | e45fb1adac21011c19c462f4e61e6bb8a3429aca (patch) | |
tree | a8325b4cb2aa4c5ab8eda2f60c91e1545c4b1d54 /chromeos | |
parent | 9fa87eda479a80faffe61d75135bd6d6036440a6 (diff) | |
download | chromium_src-e45fb1adac21011c19c462f4e61e6bb8a3429aca.zip chromium_src-e45fb1adac21011c19c462f4e61e6bb8a3429aca.tar.gz chromium_src-e45fb1adac21011c19c462f4e61e6bb8a3429aca.tar.bz2 |
Collect user logs that debugd can not access
Debugd can't access anything inside a user's cryptohome. So,
get a list of user logs files to collect from debugd, and
then read them.
BUG=chromium-os:34817
TEST=Navigate to chrome://system and verify chrome_user_log, login-times
and logout-times now show up.
Review URL: https://chromiumcodereview.appspot.com/11035014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/dbus/debug_daemon_client.cc | 31 | ||||
-rw-r--r-- | chromeos/dbus/debug_daemon_client.h | 11 | ||||
-rw-r--r-- | chromeos/dbus/mock_debug_daemon_client.h | 3 |
3 files changed, 36 insertions, 9 deletions
diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc index 05d3b39..4bd6464 100644 --- a/chromeos/dbus/debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon_client.cc @@ -246,10 +246,10 @@ class DebugDaemonClientImpl : public DebugDaemonClient { callback)); } - virtual void GetAllLogs(const GetAllLogsCallback& callback) + virtual void GetAllLogs(const GetLogsCallback& callback) OVERRIDE { dbus::MethodCall method_call(debugd::kDebugdInterface, - "GetAllLogs"); + debugd::kGetAllLogs); debugdaemon_proxy_->CallMethod( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, @@ -258,6 +258,18 @@ class DebugDaemonClientImpl : public DebugDaemonClient { callback)); } + virtual void GetUserLogFiles( + const GetLogsCallback& callback) OVERRIDE { + dbus::MethodCall method_call(debugd::kDebugdInterface, + debugd::kGetUserLogFiles); + debugdaemon_proxy_->CallMethod( + &method_call, + dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, + base::Bind(&DebugDaemonClientImpl::OnGetUserLogFiles, + weak_ptr_factory_.GetWeakPtr(), + callback)); + } + virtual void StartSystemTracing() OVERRIDE { dbus::MethodCall method_call( debugd::kDebugdInterface, @@ -395,7 +407,7 @@ class DebugDaemonClientImpl : public DebugDaemonClient { } void OnGetModemStatus(const GetModemStatusCallback& callback, - dbus::Response* response) { + dbus::Response* response) { std::string status; if (response && dbus::MessageReader(response).PopString(&status)) callback.Run(true, status); @@ -412,7 +424,7 @@ class DebugDaemonClientImpl : public DebugDaemonClient { callback.Run(false, ""); } - void OnGetAllLogs(const GetAllLogsCallback& callback, + void OnGetAllLogs(const GetLogsCallback& callback, dbus::Response* response) { std::map<std::string, std::string> logs; bool broken = false; // did we see a broken (k,v) pair? @@ -435,6 +447,11 @@ class DebugDaemonClientImpl : public DebugDaemonClient { callback.Run(!sub_reader.HasMoreData() && !broken, logs); } + void OnGetUserLogFiles(const GetLogsCallback& callback, + dbus::Response* response) { + return OnGetAllLogs(callback, response); + } + // Called when a response for StartSystemTracing() is received. void OnStartSystemTracing(dbus::Response* response) { if (!response) { @@ -536,7 +553,11 @@ class DebugDaemonClientStubImpl : public DebugDaemonClient { const GetNetworkInterfacesCallback& callback) OVERRIDE { callback.Run(false, ""); } - virtual void GetAllLogs(const GetAllLogsCallback& callback) OVERRIDE { + virtual void GetAllLogs(const GetLogsCallback& callback) OVERRIDE { + std::map<std::string, std::string> empty; + callback.Run(false, empty); + } + virtual void GetUserLogFiles(const GetLogsCallback& callback) OVERRIDE { std::map<std::string, std::string> empty; callback.Run(false, empty); } diff --git a/chromeos/dbus/debug_daemon_client.h b/chromeos/dbus/debug_daemon_client.h index 8159354..073189c 100644 --- a/chromeos/dbus/debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon_client.h @@ -75,11 +75,16 @@ class CHROMEOS_EXPORT DebugDaemonClient { virtual void GetNetworkInterfaces( const GetNetworkInterfacesCallback& callback) = 0; - // Called once GetAllLogs() is complete. + // Callback type for GetAllLogs() or GetUserLogFiles(). typedef base::Callback<void(bool succeeded, const std::map<std::string, std::string>& logs)> - GetAllLogsCallback; - virtual void GetAllLogs(const GetAllLogsCallback& callback) = 0; + GetLogsCallback; + + // Gets all logs collected by debugd. + virtual void GetAllLogs(const GetLogsCallback& callback) = 0; + + // Gets list of user log files that must be read by Chrome. + virtual void GetUserLogFiles(const GetLogsCallback& callback) = 0; // Requests to start system/kernel tracing. virtual void StartSystemTracing() = 0; diff --git a/chromeos/dbus/mock_debug_daemon_client.h b/chromeos/dbus/mock_debug_daemon_client.h index fe8d933..56cd2c4 100644 --- a/chromeos/dbus/mock_debug_daemon_client.h +++ b/chromeos/dbus/mock_debug_daemon_client.h @@ -23,7 +23,8 @@ class MockDebugDaemonClient : public DebugDaemonClient { MOCK_METHOD1(GetNetworkStatus, void(const GetNetworkStatusCallback&)); MOCK_METHOD1(GetModemStatus, void(const GetModemStatusCallback&)); MOCK_METHOD1(GetNetworkInterfaces, void(const GetNetworkInterfacesCallback&)); - MOCK_METHOD1(GetAllLogs, void(const GetAllLogsCallback&)); + MOCK_METHOD1(GetAllLogs, void(const GetLogsCallback&)); + MOCK_METHOD1(GetUserLogFiles, void(const GetLogsCallback&)); MOCK_METHOD1(RequestStopSystemTracing, bool(const StopSystemTracingCallback&)); MOCK_METHOD0(StartSystemTracing, void()); |