| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 virtual void StartSystemTracing() OVERRIDE {} | 568 virtual void StartSystemTracing() OVERRIDE {} |
| 569 virtual bool RequestStopSystemTracing(const StopSystemTracingCallback& | 569 virtual bool RequestStopSystemTracing(const StopSystemTracingCallback& |
| 570 callback) OVERRIDE { | 570 callback) OVERRIDE { |
| 571 std::string no_data; | 571 std::string no_data; |
| 572 callback.Run(base::RefCountedString::TakeString(&no_data)); | 572 callback.Run(base::RefCountedString::TakeString(&no_data)); |
| 573 return true; | 573 return true; |
| 574 } | 574 } |
| 575 virtual void GetRoutes(bool numeric, bool ipv6, | 575 virtual void GetRoutes(bool numeric, bool ipv6, |
| 576 const GetRoutesCallback& callback) OVERRIDE { | 576 const GetRoutesCallback& callback) OVERRIDE { |
| 577 std::vector<std::string> empty; | 577 std::vector<std::string> empty; |
| 578 MessageLoop::current()->PostTask(FROM_HERE, | 578 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 579 base::Bind(callback, false, empty)); | 579 base::Bind(callback, false, empty)); |
| 580 } | 580 } |
| 581 virtual void GetNetworkStatus(const GetNetworkStatusCallback& callback) | 581 virtual void GetNetworkStatus(const GetNetworkStatusCallback& callback) |
| 582 OVERRIDE { | 582 OVERRIDE { |
| 583 MessageLoop::current()->PostTask(FROM_HERE, | 583 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 584 base::Bind(callback, false, "")); | 584 base::Bind(callback, false, "")); |
| 585 } | 585 } |
| 586 virtual void GetModemStatus(const GetModemStatusCallback& callback) | 586 virtual void GetModemStatus(const GetModemStatusCallback& callback) |
| 587 OVERRIDE { | 587 OVERRIDE { |
| 588 MessageLoop::current()->PostTask(FROM_HERE, | 588 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 589 base::Bind(callback, false, "")); | 589 base::Bind(callback, false, "")); |
| 590 } | 590 } |
| 591 virtual void GetNetworkInterfaces( | 591 virtual void GetNetworkInterfaces( |
| 592 const GetNetworkInterfacesCallback& callback) OVERRIDE { | 592 const GetNetworkInterfacesCallback& callback) OVERRIDE { |
| 593 MessageLoop::current()->PostTask(FROM_HERE, | 593 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 594 base::Bind(callback, false, "")); | 594 base::Bind(callback, false, "")); |
| 595 } | 595 } |
| 596 virtual void GetPerfData(uint32_t duration, | 596 virtual void GetPerfData(uint32_t duration, |
| 597 const GetPerfDataCallback& callback) OVERRIDE { | 597 const GetPerfDataCallback& callback) OVERRIDE { |
| 598 std::vector<uint8> data; | 598 std::vector<uint8> data; |
| 599 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, data)); | 599 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 600 base::Bind(callback, data)); |
| 600 } | 601 } |
| 601 virtual void GetAllLogs(const GetLogsCallback& callback) OVERRIDE { | 602 virtual void GetAllLogs(const GetLogsCallback& callback) OVERRIDE { |
| 602 std::map<std::string, std::string> empty; | 603 std::map<std::string, std::string> empty; |
| 603 MessageLoop::current()->PostTask(FROM_HERE, | 604 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 604 base::Bind(callback, false, empty)); | 605 base::Bind(callback, false, empty)); |
| 605 } | 606 } |
| 606 virtual void GetUserLogFiles(const GetLogsCallback& callback) OVERRIDE { | 607 virtual void GetUserLogFiles(const GetLogsCallback& callback) OVERRIDE { |
| 607 std::map<std::string, std::string> user_logs; | 608 std::map<std::string, std::string> user_logs; |
| 608 user_logs["preferences"] = "Preferences"; | 609 user_logs["preferences"] = "Preferences"; |
| 609 user_logs["invalid_file"] = "Invalid File"; | 610 user_logs["invalid_file"] = "Invalid File"; |
| 610 MessageLoop::current()->PostTask(FROM_HERE, | 611 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 611 base::Bind(callback, true, user_logs)); | 612 base::Bind(callback, true, user_logs)); |
| 612 } | 613 } |
| 613 | 614 |
| 614 virtual void TestICMP(const std::string& ip_address, | 615 virtual void TestICMP(const std::string& ip_address, |
| 615 const TestICMPCallback& callback) OVERRIDE { | 616 const TestICMPCallback& callback) OVERRIDE { |
| 616 MessageLoop::current()->PostTask(FROM_HERE, | 617 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 617 base::Bind(callback, false, "")); | 618 base::Bind(callback, false, "")); |
| 618 } | 619 } |
| 619 }; | 620 }; |
| 620 | 621 |
| 621 DebugDaemonClient::DebugDaemonClient() { | 622 DebugDaemonClient::DebugDaemonClient() { |
| 622 } | 623 } |
| 623 | 624 |
| 624 DebugDaemonClient::~DebugDaemonClient() { | 625 DebugDaemonClient::~DebugDaemonClient() { |
| 625 } | 626 } |
| 626 | 627 |
| 627 // static | 628 // static |
| 628 DebugDaemonClient::StopSystemTracingCallback | 629 DebugDaemonClient::StopSystemTracingCallback |
| 629 DebugDaemonClient::EmptyStopSystemTracingCallback() { | 630 DebugDaemonClient::EmptyStopSystemTracingCallback() { |
| 630 return base::Bind(&EmptyStopSystemTracingCallbackBody); | 631 return base::Bind(&EmptyStopSystemTracingCallbackBody); |
| 631 } | 632 } |
| 632 | 633 |
| 633 // static | 634 // static |
| 634 DebugDaemonClient* DebugDaemonClient::Create(DBusClientImplementationType type, | 635 DebugDaemonClient* DebugDaemonClient::Create(DBusClientImplementationType type, |
| 635 dbus::Bus* bus) { | 636 dbus::Bus* bus) { |
| 636 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 637 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 637 return new DebugDaemonClientImpl(bus); | 638 return new DebugDaemonClientImpl(bus); |
| 638 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 639 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
| 639 return new DebugDaemonClientStubImpl(); | 640 return new DebugDaemonClientStubImpl(); |
| 640 } | 641 } |
| 641 | 642 |
| 642 } // namespace chromeos | 643 } // namespace chromeos |
| OLD | NEW |