Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <fcntl.h> | 5 #include <fcntl.h> |
| 6 #include <unistd.h> | 6 #include <unistd.h> |
| 7 | 7 |
| 8 #include "chromeos/dbus/debug_daemon_client.h" | 8 #include "chromeos/dbus/debug_daemon_client.h" |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 &method_call, | 242 &method_call, |
| 243 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 243 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 244 base::Bind(&DebugDaemonClientImpl::OnGetNetworkInterfaces, | 244 base::Bind(&DebugDaemonClientImpl::OnGetNetworkInterfaces, |
| 245 weak_ptr_factory_.GetWeakPtr(), | 245 weak_ptr_factory_.GetWeakPtr(), |
| 246 callback)); | 246 callback)); |
| 247 } | 247 } |
| 248 | 248 |
| 249 virtual void GetAllLogs(const GetAllLogsCallback& callback) | 249 virtual void GetAllLogs(const GetAllLogsCallback& callback) |
| 250 OVERRIDE { | 250 OVERRIDE { |
| 251 dbus::MethodCall method_call(debugd::kDebugdInterface, | 251 dbus::MethodCall method_call(debugd::kDebugdInterface, |
| 252 "GetAllLogs"); | 252 "GetAllLogs"); |
|
satorux1
2012/10/05 06:23:57
Please define and use a constant for this.
tudalex(Chromium)
2012/10/31 10:53:16
Done.
| |
| 253 debugdaemon_proxy_->CallMethod( | 253 debugdaemon_proxy_->CallMethod( |
| 254 &method_call, | 254 &method_call, |
| 255 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 255 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 256 base::Bind(&DebugDaemonClientImpl::OnGetAllLogs, | 256 base::Bind(&DebugDaemonClientImpl::OnGetAllLogs, |
| 257 weak_ptr_factory_.GetWeakPtr(), | 257 weak_ptr_factory_.GetWeakPtr(), |
| 258 callback)); | 258 callback)); |
| 259 } | 259 } |
| 260 | 260 |
| 261 virtual void GetFeedbackLogs(const GetAllLogsCallback& callback) | |
| 262 OVERRIDE { | |
| 263 dbus::MethodCall method_call(debugd::kDebugdInterface, | |
| 264 "GetFeedbackLogs"); | |
|
satorux1
2012/10/05 06:23:57
Please define and use a constant for this.
tudalex(Chromium)
2012/10/31 10:53:16
Done.
| |
| 265 debugdaemon_proxy_->CallMethod( | |
| 266 &method_call, | |
| 267 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | |
| 268 base::Bind(&DebugDaemonClientImpl::OnGetAllLogs, | |
| 269 weak_ptr_factory_.GetWeakPtr(), | |
| 270 callback)); | |
| 271 } | |
| 272 | |
| 261 virtual void StartSystemTracing() OVERRIDE { | 273 virtual void StartSystemTracing() OVERRIDE { |
| 262 dbus::MethodCall method_call( | 274 dbus::MethodCall method_call( |
| 263 debugd::kDebugdInterface, | 275 debugd::kDebugdInterface, |
| 264 debugd::kSystraceStart); | 276 debugd::kSystraceStart); |
| 265 dbus::MessageWriter writer(&method_call); | 277 dbus::MessageWriter writer(&method_call); |
| 266 writer.AppendString("all"); // TODO(sleffler) parameterize category list | 278 writer.AppendString("all"); // TODO(sleffler) parameterize category list |
| 267 | 279 |
| 268 DVLOG(1) << "Requesting a systrace start"; | 280 DVLOG(1) << "Requesting a systrace start"; |
| 269 debugdaemon_proxy_->CallMethod( | 281 debugdaemon_proxy_->CallMethod( |
| 270 &method_call, | 282 &method_call, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 }; | 510 }; |
| 499 | 511 |
| 500 // The DebugDaemonClient implementation used on Linux desktop, | 512 // The DebugDaemonClient implementation used on Linux desktop, |
| 501 // which does nothing. | 513 // which does nothing. |
| 502 class DebugDaemonClientStubImpl : public DebugDaemonClient { | 514 class DebugDaemonClientStubImpl : public DebugDaemonClient { |
| 503 // DebugDaemonClient overrides. | 515 // DebugDaemonClient overrides. |
| 504 virtual void GetDebugLogs(base::PlatformFile file, | 516 virtual void GetDebugLogs(base::PlatformFile file, |
| 505 const GetDebugLogsCallback& callback) OVERRIDE { | 517 const GetDebugLogsCallback& callback) OVERRIDE { |
| 506 callback.Run(false); | 518 callback.Run(false); |
| 507 } | 519 } |
| 520 | |
| 508 virtual void SetDebugMode(const std::string& subsystem, | 521 virtual void SetDebugMode(const std::string& subsystem, |
| 509 const SetDebugModeCallback& callback) OVERRIDE { | 522 const SetDebugModeCallback& callback) OVERRIDE { |
| 510 callback.Run(false); | 523 callback.Run(false); |
| 511 } | 524 } |
| 525 | |
| 512 virtual void StartSystemTracing() OVERRIDE {} | 526 virtual void StartSystemTracing() OVERRIDE {} |
| 527 | |
| 513 virtual bool RequestStopSystemTracing(const StopSystemTracingCallback& | 528 virtual bool RequestStopSystemTracing(const StopSystemTracingCallback& |
| 514 callback) OVERRIDE { | 529 callback) OVERRIDE { |
| 515 std::string no_data; | 530 std::string no_data; |
| 516 callback.Run(base::RefCountedString::TakeString(&no_data)); | 531 callback.Run(base::RefCountedString::TakeString(&no_data)); |
| 517 return true; | 532 return true; |
| 518 } | 533 } |
| 534 | |
| 519 virtual void GetRoutes(bool numeric, bool ipv6, | 535 virtual void GetRoutes(bool numeric, bool ipv6, |
| 520 const GetRoutesCallback& callback) OVERRIDE { | 536 const GetRoutesCallback& callback) OVERRIDE { |
| 521 std::vector<std::string> empty; | 537 std::vector<std::string> empty; |
| 522 callback.Run(false, empty); | 538 callback.Run(false, empty); |
| 523 } | 539 } |
| 540 | |
| 524 virtual void GetNetworkStatus(const GetNetworkStatusCallback& callback) | 541 virtual void GetNetworkStatus(const GetNetworkStatusCallback& callback) |
| 525 OVERRIDE { | 542 OVERRIDE { |
| 526 callback.Run(false, ""); | 543 callback.Run(false, ""); |
| 527 } | 544 } |
| 545 | |
| 528 virtual void GetModemStatus(const GetModemStatusCallback& callback) | 546 virtual void GetModemStatus(const GetModemStatusCallback& callback) |
| 529 OVERRIDE { | 547 OVERRIDE { |
| 530 callback.Run(false, ""); | 548 callback.Run(false, ""); |
| 531 } | 549 } |
| 550 | |
| 532 virtual void GetNetworkInterfaces( | 551 virtual void GetNetworkInterfaces( |
| 533 const GetNetworkInterfacesCallback& callback) OVERRIDE { | 552 const GetNetworkInterfacesCallback& callback) OVERRIDE { |
| 534 callback.Run(false, ""); | 553 callback.Run(false, ""); |
| 535 } | 554 } |
| 555 | |
| 536 virtual void GetAllLogs(const GetAllLogsCallback& callback) OVERRIDE { | 556 virtual void GetAllLogs(const GetAllLogsCallback& callback) OVERRIDE { |
| 537 std::map<std::string, std::string> empty; | 557 std::map<std::string, std::string> empty; |
| 538 callback.Run(false, empty); | 558 callback.Run(false, empty); |
| 539 } | 559 } |
| 560 virtual void GetFeedbackLogs(const GetAllLogsCallback& callback) OVERRIDE { | |
|
rkc
2012/10/02 19:33:20
New line above this one too.
| |
| 561 std::map<std::string, std::string> empty; | |
| 562 callback.Run(false, empty); | |
| 563 } | |
| 540 | 564 |
| 541 virtual void TestICMP(const std::string& ip_address, | 565 virtual void TestICMP(const std::string& ip_address, |
| 542 const TestICMPCallback& callback) OVERRIDE { | 566 const TestICMPCallback& callback) OVERRIDE { |
| 543 callback.Run(false, ""); | 567 callback.Run(false, ""); |
| 544 } | 568 } |
| 545 }; | 569 }; |
| 546 | 570 |
| 547 DebugDaemonClient::DebugDaemonClient() { | 571 DebugDaemonClient::DebugDaemonClient() { |
| 548 } | 572 } |
| 549 | 573 |
| 550 DebugDaemonClient::~DebugDaemonClient() { | 574 DebugDaemonClient::~DebugDaemonClient() { |
| 551 } | 575 } |
| 552 | 576 |
| 553 // static | 577 // static |
| 554 DebugDaemonClient::StopSystemTracingCallback | 578 DebugDaemonClient::StopSystemTracingCallback |
| 555 DebugDaemonClient::EmptyStopSystemTracingCallback() { | 579 DebugDaemonClient::EmptyStopSystemTracingCallback() { |
| 556 return base::Bind(&EmptyStopSystemTracingCallbackBody); | 580 return base::Bind(&EmptyStopSystemTracingCallbackBody); |
| 557 } | 581 } |
| 558 | 582 |
| 559 // static | 583 // static |
| 560 DebugDaemonClient* DebugDaemonClient::Create(DBusClientImplementationType type, | 584 DebugDaemonClient* DebugDaemonClient::Create(DBusClientImplementationType type, |
| 561 dbus::Bus* bus) { | 585 dbus::Bus* bus) { |
| 562 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 586 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 563 return new DebugDaemonClientImpl(bus); | 587 return new DebugDaemonClientImpl(bus); |
| 564 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 588 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
| 565 return new DebugDaemonClientStubImpl(); | 589 return new DebugDaemonClientStubImpl(); |
| 566 } | 590 } |
| 567 | 591 |
| 568 } // namespace chromeos | 592 } // namespace chromeos |
| OLD | NEW |