OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_PRIV
ATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_PRIV
ATE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_PRIV
ATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_PRIV
ATE_API_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
11 #if defined(ENABLE_WEBRTC) | 11 #include "chrome/common/extensions/api/webrtc_logging_private.h" |
| 12 #include "media/media_features.h" |
| 13 |
| 14 #if BUILDFLAG(ENABLE_WEBRTC) |
12 #include "chrome/browser/media/audio_debug_recordings_handler.h" | 15 #include "chrome/browser/media/audio_debug_recordings_handler.h" |
13 #include "chrome/browser/media/webrtc/webrtc_event_log_handler.h" | 16 #include "chrome/browser/media/webrtc/webrtc_event_log_handler.h" |
14 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" | 17 #include "chrome/browser/media/webrtc/webrtc_logging_handler_host.h" |
15 #endif | 18 #endif |
16 #include "chrome/common/extensions/api/webrtc_logging_private.h" | |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 | 21 |
20 class RenderProcessHost; | 22 class RenderProcessHost; |
21 | 23 |
22 } | 24 } |
23 | 25 |
24 namespace extensions { | 26 namespace extensions { |
25 | 27 |
26 class WebrtcLoggingPrivateFunction : public ChromeAsyncExtensionFunction { | 28 class WebrtcLoggingPrivateFunction : public ChromeAsyncExtensionFunction { |
27 protected: | 29 protected: |
28 ~WebrtcLoggingPrivateFunction() override {} | 30 ~WebrtcLoggingPrivateFunction() override {} |
29 | 31 |
30 #if defined(ENABLE_WEBRTC) | 32 #if BUILDFLAG(ENABLE_WEBRTC) |
31 // Returns the RenderProcessHost associated with the given |request| | 33 // Returns the RenderProcessHost associated with the given |request| |
32 // authorized by the |security_origin|. Returns null if unauthorized or | 34 // authorized by the |security_origin|. Returns null if unauthorized or |
33 // the RPH does not exist. | 35 // the RPH does not exist. |
34 content::RenderProcessHost* RphFromRequest( | 36 content::RenderProcessHost* RphFromRequest( |
35 const api::webrtc_logging_private::RequestInfo& request, | 37 const api::webrtc_logging_private::RequestInfo& request, |
36 const std::string& security_origin); | 38 const std::string& security_origin); |
37 | 39 |
38 scoped_refptr<WebRtcLoggingHandlerHost> LoggingHandlerFromRequest( | 40 scoped_refptr<WebRtcLoggingHandlerHost> LoggingHandlerFromRequest( |
39 const api::webrtc_logging_private::RequestInfo& request, | 41 const api::webrtc_logging_private::RequestInfo& request, |
40 const std::string& security_origin); | 42 const std::string& security_origin); |
41 #endif | 43 #endif |
42 }; | 44 }; |
43 | 45 |
44 class WebrtcLoggingPrivateFunctionWithGenericCallback | 46 class WebrtcLoggingPrivateFunctionWithGenericCallback |
45 : public WebrtcLoggingPrivateFunction { | 47 : public WebrtcLoggingPrivateFunction { |
46 protected: | 48 protected: |
47 ~WebrtcLoggingPrivateFunctionWithGenericCallback() override {} | 49 ~WebrtcLoggingPrivateFunctionWithGenericCallback() override {} |
48 | 50 |
49 #if defined(ENABLE_WEBRTC) | 51 #if BUILDFLAG(ENABLE_WEBRTC) |
50 // Finds the appropriate logging handler for performing the task and prepares | 52 // Finds the appropriate logging handler for performing the task and prepares |
51 // a generic callback object for when the task is completed. | 53 // a generic callback object for when the task is completed. |
52 // If the logging handler can't be found for the given request+origin, the | 54 // If the logging handler can't be found for the given request+origin, the |
53 // returned ptr will be null. | 55 // returned ptr will be null. |
54 scoped_refptr<WebRtcLoggingHandlerHost> PrepareTask( | 56 scoped_refptr<WebRtcLoggingHandlerHost> PrepareTask( |
55 const api::webrtc_logging_private::RequestInfo& request, | 57 const api::webrtc_logging_private::RequestInfo& request, |
56 const std::string& security_origin, | 58 const std::string& security_origin, |
57 WebRtcLoggingHandlerHost::GenericDoneCallback* callback); | 59 WebRtcLoggingHandlerHost::GenericDoneCallback* callback); |
58 | 60 |
59 // Must be called on UI thread. | 61 // Must be called on UI thread. |
60 void FireCallback(bool success, const std::string& error_message); | 62 void FireCallback(bool success, const std::string& error_message); |
61 #endif | 63 #endif |
62 }; | 64 }; |
63 | 65 |
64 class WebrtcLoggingPrivateFunctionWithUploadCallback | 66 class WebrtcLoggingPrivateFunctionWithUploadCallback |
65 : public WebrtcLoggingPrivateFunction { | 67 : public WebrtcLoggingPrivateFunction { |
66 protected: | 68 protected: |
67 ~WebrtcLoggingPrivateFunctionWithUploadCallback() override {} | 69 ~WebrtcLoggingPrivateFunctionWithUploadCallback() override {} |
68 | 70 |
69 #if defined(ENABLE_WEBRTC) | 71 #if BUILDFLAG(ENABLE_WEBRTC) |
70 // Must be called on UI thread. | 72 // Must be called on UI thread. |
71 void FireCallback(bool success, const std::string& report_id, | 73 void FireCallback(bool success, const std::string& report_id, |
72 const std::string& error_message); | 74 const std::string& error_message); |
73 #endif | 75 #endif |
74 }; | 76 }; |
75 | 77 |
76 class WebrtcLoggingPrivateFunctionWithRecordingDoneCallback | 78 class WebrtcLoggingPrivateFunctionWithRecordingDoneCallback |
77 : public WebrtcLoggingPrivateFunction { | 79 : public WebrtcLoggingPrivateFunction { |
78 protected: | 80 protected: |
79 ~WebrtcLoggingPrivateFunctionWithRecordingDoneCallback() override {} | 81 ~WebrtcLoggingPrivateFunctionWithRecordingDoneCallback() override {} |
80 | 82 |
81 #if defined(ENABLE_WEBRTC) | 83 #if BUILDFLAG(ENABLE_WEBRTC) |
82 // Must be called on UI thread. | 84 // Must be called on UI thread. |
83 void FireErrorCallback(const std::string& error_message); | 85 void FireErrorCallback(const std::string& error_message); |
84 void FireCallback(const std::string& prefix_path, | 86 void FireCallback(const std::string& prefix_path, |
85 bool did_stop, | 87 bool did_stop, |
86 bool did_manual_stop); | 88 bool did_manual_stop); |
87 #endif | 89 #endif |
88 }; | 90 }; |
89 | 91 |
90 class WebrtcLoggingPrivateSetMetaDataFunction | 92 class WebrtcLoggingPrivateSetMetaDataFunction |
91 : public WebrtcLoggingPrivateFunctionWithGenericCallback { | 93 : public WebrtcLoggingPrivateFunctionWithGenericCallback { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 private: | 281 private: |
280 ~WebrtcLoggingPrivateStopWebRtcEventLoggingFunction() override {} | 282 ~WebrtcLoggingPrivateStopWebRtcEventLoggingFunction() override {} |
281 | 283 |
282 // ExtensionFunction overrides. | 284 // ExtensionFunction overrides. |
283 bool RunAsync() override; | 285 bool RunAsync() override; |
284 }; | 286 }; |
285 | 287 |
286 } // namespace extensions | 288 } // namespace extensions |
287 | 289 |
288 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_P
RIVATE_API_H_ | 290 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_P
RIVATE_API_H_ |
OLD | NEW |