1 // Copyright 2013 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 CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_PRIVATE_API_H_
8 #include "chrome/browser/extensions/chrome_extension_function.h"
9 #include "chrome/common/extensions/api/webrtc_logging_private.h"
13 class RenderProcessHost;
17 namespace extensions {
19 // TODO(grunell). Merge this with WebrtcAudioPrivateTabIdFunction.
20 class WebrtcLoggingPrivateTabIdFunction : public ChromeAsyncExtensionFunction {
22 virtual ~WebrtcLoggingPrivateTabIdFunction() {}
24 content::RenderProcessHost* RphFromTabIdAndSecurityOrigin(
25 int tab_id, const std::string& security_origin);
28 class WebrtcLoggingPrivateSetMetaDataFunction
29 : public WebrtcLoggingPrivateTabIdFunction {
31 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.setMetaData",
32 WEBRTCLOGGINGPRIVATE_SETMETADATA)
33 WebrtcLoggingPrivateSetMetaDataFunction();
36 virtual ~WebrtcLoggingPrivateSetMetaDataFunction();
38 // ExtensionFunction overrides.
39 virtual bool RunAsync() OVERRIDE;
41 // Must be called on UI thread.
42 void SetMetaDataCallback(bool success, const std::string& error_message);
45 class WebrtcLoggingPrivateStartFunction
46 : public WebrtcLoggingPrivateTabIdFunction {
48 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.start",
49 WEBRTCLOGGINGPRIVATE_START)
50 WebrtcLoggingPrivateStartFunction();
53 virtual ~WebrtcLoggingPrivateStartFunction();
55 // ExtensionFunction overrides.
56 virtual bool RunAsync() OVERRIDE;
58 // Must be called on UI thread.
59 void StartCallback(bool success, const std::string& error_message);
62 class WebrtcLoggingPrivateSetUploadOnRenderCloseFunction
63 : public WebrtcLoggingPrivateTabIdFunction {
65 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.setUploadOnRenderClose",
66 WEBRTCLOGGINGPRIVATE_SETUPLOADONRENDERCLOSE)
67 WebrtcLoggingPrivateSetUploadOnRenderCloseFunction();
70 virtual ~WebrtcLoggingPrivateSetUploadOnRenderCloseFunction();
72 // ExtensionFunction overrides.
73 virtual bool RunAsync() OVERRIDE;
76 class WebrtcLoggingPrivateStopFunction
77 : public WebrtcLoggingPrivateTabIdFunction {
79 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.stop",
80 WEBRTCLOGGINGPRIVATE_STOP)
81 WebrtcLoggingPrivateStopFunction();
84 virtual ~WebrtcLoggingPrivateStopFunction();
86 // ExtensionFunction overrides.
87 virtual bool RunAsync() OVERRIDE;
89 // Must be called on UI thread.
90 void StopCallback(bool success, const std::string& error_message);
93 class WebrtcLoggingPrivateUploadFunction
94 : public WebrtcLoggingPrivateTabIdFunction {
96 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.upload",
97 WEBRTCLOGGINGPRIVATE_UPLOAD)
98 WebrtcLoggingPrivateUploadFunction();
101 virtual ~WebrtcLoggingPrivateUploadFunction();
103 // ExtensionFunction overrides.
104 virtual bool RunAsync() OVERRIDE;
106 // Must be called on UI thread.
107 void UploadCallback(bool success, const std::string& report_id,
108 const std::string& error_message);
111 class WebrtcLoggingPrivateDiscardFunction
112 : public WebrtcLoggingPrivateTabIdFunction {
114 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.discard",
115 WEBRTCLOGGINGPRIVATE_DISCARD)
116 WebrtcLoggingPrivateDiscardFunction();
119 virtual ~WebrtcLoggingPrivateDiscardFunction();
121 // ExtensionFunction overrides.
122 virtual bool RunAsync() OVERRIDE;
124 // Must be called on UI thread.
125 void DiscardCallback(bool success, const std::string& error_message);
128 class WebrtcLoggingPrivateStartRtpDumpFunction
129 : public WebrtcLoggingPrivateTabIdFunction {
131 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.startRtpDump",
132 WEBRTCLOGGINGPRIVATE_STARTRTPDUMP)
133 WebrtcLoggingPrivateStartRtpDumpFunction();
136 virtual ~WebrtcLoggingPrivateStartRtpDumpFunction();
138 // ExtensionFunction overrides.
139 virtual bool RunAsync() OVERRIDE;
141 // Must be called on UI thread.
142 void StartRtpDumpCallback(bool success, const std::string& error_message);
145 class WebrtcLoggingPrivateStopRtpDumpFunction
146 : public WebrtcLoggingPrivateTabIdFunction {
148 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.stopRtpDump",
149 WEBRTCLOGGINGPRIVATE_STOPRTPDUMP)
150 WebrtcLoggingPrivateStopRtpDumpFunction();
153 virtual ~WebrtcLoggingPrivateStopRtpDumpFunction();
155 // ExtensionFunction overrides.
156 virtual bool RunAsync() OVERRIDE;
158 // Must be called on UI thread.
159 void StopRtpDumpCallback(bool success, const std::string& error_message);
162 } // namespace extensions
164 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_PRIVATE_API_H_