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

Unified Diff: chromeos/dbus/debug_daemon_client.cc

Issue 10024056: Added functionality to chrome://net-internals/#chromeos page that user (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed MockDebugDaemonClient. Created 8 years, 8 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: chromeos/dbus/debug_daemon_client.cc
diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc
index bc8e06dc71bb46f8e18cfd5afb05bf0aa8f0cade..1426abd0fdc27eb565ea6fda20613e232b9a92f2 100644
--- a/chromeos/dbus/debug_daemon_client.cc
+++ b/chromeos/dbus/debug_daemon_client.cc
@@ -150,6 +150,20 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
virtual ~DebugDaemonClientImpl() {}
// DebugDaemonClient override.
+ virtual void SetDebugMode(const std::string& subsystem,
+ const SetDebugModeCallback& callback) OVERRIDE {
+ dbus::MethodCall method_call(debugd::kDebugdInterface,
+ debugd::kSetDebugMode);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(subsystem);
+ debugdaemon_proxy_->CallMethod(
+ &method_call,
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&DebugDaemonClientImpl::OnSetDebugMode,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback));
+ }
+
virtual void StartSystemTracing() OVERRIDE {
dbus::MethodCall method_call(
debugd::kDebugdInterface,
@@ -209,6 +223,17 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
}
private:
+ // Called when a response for SetDebugMode() is received.
+ void OnSetDebugMode(const SetDebugModeCallback& callback,
+ dbus::Response* response) {
+ if (!response) {
+ LOG(ERROR) << "Failed to change debug mode";
+ callback.Run(false);
+ } else {
+ callback.Run(true);
+ }
+ }
+
// Called when a response for StartSystemTracing() is received.
void OnStartSystemTracing(dbus::Response* response) {
if (!response) {
@@ -244,6 +269,10 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
// which does nothing.
class DebugDaemonClientStubImpl : public DebugDaemonClient {
// DebugDaemonClient overrides.
+ virtual void SetDebugMode(const std::string& subsystem,
+ const SetDebugModeCallback& callback) OVERRIDE {
+ callback.Run(false);
+ }
virtual void StartSystemTracing() OVERRIDE {}
virtual bool RequestStopSystemTracing(const StopSystemTracingCallback&
callback) OVERRIDE {

Powered by Google App Engine
This is Rietveld 408576698