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 debugd::kGetAllLogs); |
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, | |
257 weak_ptr_factory_.GetWeakPtr(), | |
258 callback)); | |
259 } | |
260 | |
261 virtual void GetFeedbackLogs(const GetAllLogsCallback& callback) | |
262 OVERRIDE { | |
263 dbus::MethodCall method_call(debugd::kDebugdInterface, | |
264 debugd::kGetFeedbackLogs); | |
265 debugdaemon_proxy_->CallMethod( | |
266 &method_call, | |
267 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | |
256 base::Bind(&DebugDaemonClientImpl::OnGetAllLogs, | 268 base::Bind(&DebugDaemonClientImpl::OnGetAllLogs, |
257 weak_ptr_factory_.GetWeakPtr(), | 269 weak_ptr_factory_.GetWeakPtr(), |
258 callback)); | 270 callback)); |
259 } | 271 } |
260 | 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); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 }; | 513 }; |
502 | 514 |
503 // The DebugDaemonClient implementation used on Linux desktop, | 515 // The DebugDaemonClient implementation used on Linux desktop, |
504 // which does nothing. | 516 // which does nothing. |
505 class DebugDaemonClientStubImpl : public DebugDaemonClient { | 517 class DebugDaemonClientStubImpl : public DebugDaemonClient { |
506 // DebugDaemonClient overrides. | 518 // DebugDaemonClient overrides. |
507 virtual void GetDebugLogs(base::PlatformFile file, | 519 virtual void GetDebugLogs(base::PlatformFile file, |
508 const GetDebugLogsCallback& callback) OVERRIDE { | 520 const GetDebugLogsCallback& callback) OVERRIDE { |
509 callback.Run(false); | 521 callback.Run(false); |
510 } | 522 } |
523 | |
511 virtual void SetDebugMode(const std::string& subsystem, | 524 virtual void SetDebugMode(const std::string& subsystem, |
512 const SetDebugModeCallback& callback) OVERRIDE { | 525 const SetDebugModeCallback& callback) OVERRIDE { |
513 callback.Run(false); | 526 callback.Run(false); |
514 } | 527 } |
528 | |
515 virtual void StartSystemTracing() OVERRIDE {} | 529 virtual void StartSystemTracing() OVERRIDE {} |
530 | |
516 virtual bool RequestStopSystemTracing(const StopSystemTracingCallback& | 531 virtual bool RequestStopSystemTracing(const StopSystemTracingCallback& |
517 callback) OVERRIDE { | 532 callback) OVERRIDE { |
518 std::string no_data; | 533 std::string no_data; |
519 callback.Run(base::RefCountedString::TakeString(&no_data)); | 534 callback.Run(base::RefCountedString::TakeString(&no_data)); |
520 return true; | 535 return true; |
521 } | 536 } |
537 | |
522 virtual void GetRoutes(bool numeric, bool ipv6, | 538 virtual void GetRoutes(bool numeric, bool ipv6, |
523 const GetRoutesCallback& callback) OVERRIDE { | 539 const GetRoutesCallback& callback) OVERRIDE { |
524 std::vector<std::string> empty; | 540 std::vector<std::string> empty; |
525 callback.Run(false, empty); | 541 callback.Run(false, empty); |
526 } | 542 } |
543 | |
527 virtual void GetNetworkStatus(const GetNetworkStatusCallback& callback) | 544 virtual void GetNetworkStatus(const GetNetworkStatusCallback& callback) |
528 OVERRIDE { | 545 OVERRIDE { |
529 callback.Run(false, ""); | 546 callback.Run(false, ""); |
530 } | 547 } |
548 | |
531 virtual void GetModemStatus(const GetModemStatusCallback& callback) | 549 virtual void GetModemStatus(const GetModemStatusCallback& callback) |
532 OVERRIDE { | 550 OVERRIDE { |
533 callback.Run(false, ""); | 551 callback.Run(false, ""); |
534 } | 552 } |
553 | |
535 virtual void GetNetworkInterfaces( | 554 virtual void GetNetworkInterfaces( |
536 const GetNetworkInterfacesCallback& callback) OVERRIDE { | 555 const GetNetworkInterfacesCallback& callback) OVERRIDE { |
537 callback.Run(false, ""); | 556 callback.Run(false, ""); |
538 } | 557 } |
558 | |
539 virtual void GetAllLogs(const GetAllLogsCallback& callback) OVERRIDE { | 559 virtual void GetAllLogs(const GetAllLogsCallback& callback) OVERRIDE { |
540 std::map<std::string, std::string> empty; | 560 std::map<std::string, std::string> empty; |
541 callback.Run(false, empty); | 561 callback.Run(false, empty); |
542 } | 562 } |
satorux1
2012/11/01 01:59:10
nit: put a blank line here
| |
563 virtual void GetFeedbackLogs(const GetAllLogsCallback& callback) OVERRIDE { | |
564 std::map<std::string, std::string> empty; | |
565 callback.Run(false, empty); | |
566 } | |
543 | 567 |
544 virtual void TestICMP(const std::string& ip_address, | 568 virtual void TestICMP(const std::string& ip_address, |
545 const TestICMPCallback& callback) OVERRIDE { | 569 const TestICMPCallback& callback) OVERRIDE { |
546 callback.Run(false, ""); | 570 callback.Run(false, ""); |
547 } | 571 } |
548 }; | 572 }; |
549 | 573 |
550 DebugDaemonClient::DebugDaemonClient() { | 574 DebugDaemonClient::DebugDaemonClient() { |
551 } | 575 } |
552 | 576 |
553 DebugDaemonClient::~DebugDaemonClient() { | 577 DebugDaemonClient::~DebugDaemonClient() { |
554 } | 578 } |
555 | 579 |
556 // static | 580 // static |
557 DebugDaemonClient::StopSystemTracingCallback | 581 DebugDaemonClient::StopSystemTracingCallback |
558 DebugDaemonClient::EmptyStopSystemTracingCallback() { | 582 DebugDaemonClient::EmptyStopSystemTracingCallback() { |
559 return base::Bind(&EmptyStopSystemTracingCallbackBody); | 583 return base::Bind(&EmptyStopSystemTracingCallbackBody); |
560 } | 584 } |
561 | 585 |
562 // static | 586 // static |
563 DebugDaemonClient* DebugDaemonClient::Create(DBusClientImplementationType type, | 587 DebugDaemonClient* DebugDaemonClient::Create(DBusClientImplementationType type, |
564 dbus::Bus* bus) { | 588 dbus::Bus* bus) { |
565 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 589 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
566 return new DebugDaemonClientImpl(bus); | 590 return new DebugDaemonClientImpl(bus); |
567 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 591 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
568 return new DebugDaemonClientStubImpl(); | 592 return new DebugDaemonClientStubImpl(); |
569 } | 593 } |
570 | 594 |
571 } // namespace chromeos | 595 } // namespace chromeos |
OLD | NEW |