Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc

Issue 267623003: Adds StartRtpDump and StopRtpDump methods to webrtcLoggingPrivate API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
index 01b478c4ffb9f380f0b8c5782a421a0a8895ee4e..9d02674b65a561a2a92fde4c19d7f6d97cb503c2 100644
--- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
+++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
@@ -29,6 +29,8 @@ namespace SetUploadOnRenderClose =
namespace Stop = api::webrtc_logging_private::Stop;
namespace Upload = api::webrtc_logging_private::Upload;
namespace Discard = api::webrtc_logging_private::Discard;
+namespace StartRtpDump = api::webrtc_logging_private::StartRtpDump;
+namespace StopRtpDump = api::webrtc_logging_private::StopRtpDump;
using api::webrtc_logging_private::MetaDataEntry;
@@ -267,4 +269,86 @@ void WebrtcLoggingPrivateDiscardFunction::DiscardCallback(
SendResponse(success);
}
+WebrtcLoggingPrivateStartRtpDumpFunction::
+ WebrtcLoggingPrivateStartRtpDumpFunction() {}
+
+WebrtcLoggingPrivateStartRtpDumpFunction::
+ ~WebrtcLoggingPrivateStartRtpDumpFunction() {}
+
+bool WebrtcLoggingPrivateStartRtpDumpFunction::RunAsync() {
+ scoped_ptr<StartRtpDump::Params> params(StartRtpDump::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params.get());
+
+ content::RenderProcessHost* host =
+ RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin);
+ if (!host)
+ return false;
+
+ scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host(
+ base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host));
+
+ WebRtcLoggingHandlerHost::GenericDoneCallback callback = base::Bind(
+ &WebrtcLoggingPrivateStartRtpDumpFunction::StartRtpDumpCallback, this);
+
+ BrowserThread::PostTask(BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(&WebRtcLoggingHandlerHost::StartRtpDump,
+ webrtc_logging_handler_host,
+ params->incoming,
+ params->outgoing,
+ callback));
+
+ return true;
+}
+
+void WebrtcLoggingPrivateStartRtpDumpFunction::StartRtpDumpCallback(
+ bool success,
+ const std::string& error_message) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (!success)
+ SetError(error_message);
+ SendResponse(success);
+}
+
+WebrtcLoggingPrivateStopRtpDumpFunction::
+ WebrtcLoggingPrivateStopRtpDumpFunction() {}
+
+WebrtcLoggingPrivateStopRtpDumpFunction::
+ ~WebrtcLoggingPrivateStopRtpDumpFunction() {}
+
+bool WebrtcLoggingPrivateStopRtpDumpFunction::RunAsync() {
+ scoped_ptr<StopRtpDump::Params> params(StopRtpDump::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params.get());
+
+ content::RenderProcessHost* host =
+ RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin);
+ if (!host)
+ return false;
+
+ scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host(
+ base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host));
+
+ WebRtcLoggingHandlerHost::GenericDoneCallback callback = base::Bind(
+ &WebrtcLoggingPrivateStopRtpDumpFunction::StopRtpDumpCallback, this);
+
+ BrowserThread::PostTask(BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(&WebRtcLoggingHandlerHost::StopRtpDump,
+ webrtc_logging_handler_host,
+ params->incoming,
+ params->outgoing,
+ callback));
+
+ return true;
+}
+
+void WebrtcLoggingPrivateStopRtpDumpFunction::StopRtpDumpCallback(
+ bool success,
+ const std::string& error_message) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ if (!success)
+ SetError(error_message);
+ SendResponse(success);
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698