Add layer tree settings flag for pinch virtual viewport.
[chromium-blink-merge.git] / chromeos / dbus / debug_daemon_client.h
blob1ed02156777332ee71bd092eb565e3c439c30a9c
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_
6 #define CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_
8 #include "base/callback.h"
9 #include "base/platform_file.h"
10 #include "base/memory/ref_counted_memory.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/dbus_client_implementation_type.h"
14 #include <map>
16 namespace dbus {
17 class Bus;
18 } // namespace dbus
20 namespace metrics {
21 class PerfDataProto;
24 namespace chromeos {
26 // DebugDaemonClient is used to communicate with the debug daemon.
27 class CHROMEOS_EXPORT DebugDaemonClient {
28 public:
29 virtual ~DebugDaemonClient();
31 // Called once GetDebugLogs() is complete. Takes one parameter:
32 // - succeeded: was the logs stored successfully.
33 typedef base::Callback<void(bool succeeded)> GetDebugLogsCallback;
35 // Requests to store debug logs into |file| and calls |callback|
36 // when completed. Debug logs will be stored in the .tgz format.
37 virtual void GetDebugLogs(base::PlatformFile file,
38 const GetDebugLogsCallback& callback) = 0;
40 // Called once SetDebugMode() is complete. Takes one parameter:
41 // - succeeded: debug mode was changed successfully.
42 typedef base::Callback<void(bool succeeded)> SetDebugModeCallback;
44 // Requests to change debug mode to given |subsystem| and calls
45 // |callback| when completed. |subsystem| should be one of the
46 // following: "wifi", "ethernet", "cellular" or "none".
47 virtual void SetDebugMode(const std::string& subsystem,
48 const SetDebugModeCallback& callback) = 0;
50 // Called once GetRoutes() is complete.
51 typedef base::Callback<void(bool succeeded,
52 const std::vector<std::string>& routes)>
53 GetRoutesCallback;
54 virtual void GetRoutes(bool numeric, bool ipv6,
55 const GetRoutesCallback& callback) = 0;
57 // Called once GetNetworkStatus() is complete.
58 typedef base::Callback<void(bool succeeded, const std::string& status)>
59 GetNetworkStatusCallback;
61 // Gets information about network status as json.
62 virtual void GetNetworkStatus(const GetNetworkStatusCallback& callback) = 0;
64 // Called once GetModemStatus() is complete.
65 typedef base::Callback<void(bool succeeded, const std::string& status)>
66 GetModemStatusCallback;
68 // Gets information about modem status as json.
69 virtual void GetModemStatus(const GetModemStatusCallback& callback) = 0;
71 // Called once GetNetworkInterfaces() is complete. Takes two parameters:
72 // - succeeded: information was obtained successfully.
73 // - status: network interfaces information in json. For details, please refer
74 // to http://gerrit.chromium.org/gerrit/#/c/28045/5/src/helpers/netif.cc
75 typedef base::Callback<void(bool succeeded, const std::string& status)>
76 GetNetworkInterfacesCallback;
78 // Gets information about network interfaces as json.
79 virtual void GetNetworkInterfaces(
80 const GetNetworkInterfacesCallback& callback) = 0;
82 // Called once GetPerfData() is complete only if the the data is successfully
83 // obtained from debugd.
84 typedef base::Callback<void(const std::vector<uint8>& data)>
85 GetPerfDataCallback;
87 // Runs perf for |duration| seconds and returns data collected.
88 virtual void GetPerfData(uint32_t duration,
89 const GetPerfDataCallback& callback) = 0;
91 // Callback type for GetAllLogs() or GetUserLogFiles().
92 typedef base::Callback<void(bool succeeded,
93 const std::map<std::string, std::string>& logs)>
94 GetLogsCallback;
96 // Gets all logs collected by debugd.
97 virtual void GetAllLogs(const GetLogsCallback& callback) = 0;
99 // Gets list of user log files that must be read by Chrome.
100 virtual void GetUserLogFiles(const GetLogsCallback& callback) = 0;
102 // Requests to start system/kernel tracing.
103 virtual void StartSystemTracing() = 0;
105 // Called once RequestStopSystemTracing() is complete. Takes one parameter:
106 // - result: the data collected while tracing was active
107 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&
108 result)> StopSystemTracingCallback;
110 // Requests to stop system tracing and calls |callback| when completed.
111 virtual bool RequestStopSystemTracing(const StopSystemTracingCallback&
112 callback) = 0;
114 // Returns an empty SystemTracingCallback that does nothing.
115 static StopSystemTracingCallback EmptyStopSystemTracingCallback();
117 // Called once TestICMP() is complete. Takes two parameters:
118 // - succeeded: information was obtained successfully.
119 // - status: information about ICMP connectivity to a specified host as json.
120 // For details please refer to
121 // https://gerrit.chromium.org/gerrit/#/c/30310/2/src/helpers/icmp.cc
122 typedef base::Callback<void(bool succeeded, const std::string& status)>
123 TestICMPCallback;
125 // Tests ICMP connectivity to a specified host. The |ip_address| contains the
126 // IPv4 or IPv6 address of the host, for example "8.8.8.8".
127 virtual void TestICMP(const std::string& ip_address,
128 const TestICMPCallback& callback) = 0;
130 // Factory function, creates a new instance and returns ownership.
131 // For normal usage, access the singleton via DBusThreadManager::Get().
132 static DebugDaemonClient* Create(DBusClientImplementationType type,
133 dbus::Bus* bus);
134 protected:
135 // Create() should be used instead.
136 DebugDaemonClient();
138 private:
139 DISALLOW_COPY_AND_ASSIGN(DebugDaemonClient);
142 } // namespace chromeos
144 #endif // CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_