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

Side by Side Diff: chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h

Issue 927233005: Adding support for storing webrtc logs locally with an extension supplied unique id, for later uplo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/extensions/chrome_extension_function.h" 8 #include "chrome/browser/extensions/chrome_extension_function.h"
9 #if defined(ENABLE_WEBRTC)
10 #include "chrome/browser/media/webrtc_logging_handler_host.h"
11 #endif
9 #include "chrome/common/extensions/api/webrtc_logging_private.h" 12 #include "chrome/common/extensions/api/webrtc_logging_private.h"
10 13
11 namespace content { 14 namespace content {
12 15
13 class RenderProcessHost; 16 class RenderProcessHost;
14 17
15 } 18 }
16 19
17 namespace extensions { 20 namespace extensions {
18 21
19 class WebrtcLoggingPrivateFunction : public ChromeAsyncExtensionFunction { 22 class WebrtcLoggingPrivateFunction : public ChromeAsyncExtensionFunction {
20 protected: 23 protected:
21 ~WebrtcLoggingPrivateFunction() override {} 24 ~WebrtcLoggingPrivateFunction() override {}
22 25
26 #if defined(ENABLE_WEBRTC)
23 // Returns the RenderProcessHost associated with the given |request| 27 // Returns the RenderProcessHost associated with the given |request|
24 // authorized by the |security_origin|. Returns null if unauthorized or 28 // authorized by the |security_origin|. Returns null if unauthorized or
25 // the RPH does not exist. 29 // the RPH does not exist.
26 content::RenderProcessHost* RphFromRequest( 30 content::RenderProcessHost* RphFromRequest(
27 const api::webrtc_logging_private::RequestInfo& request, 31 const api::webrtc_logging_private::RequestInfo& request,
28 const std::string& security_origin); 32 const std::string& security_origin);
33
34 scoped_refptr<WebRtcLoggingHandlerHost> LoggingHandlerFromRequest(
35 const api::webrtc_logging_private::RequestInfo& request,
36 const std::string& security_origin);
37 #endif
38 };
39
40 class WebrtcLoggingPrivateFunctionWithGenericCallback
41 : public WebrtcLoggingPrivateFunction {
42 protected:
43 ~WebrtcLoggingPrivateFunctionWithGenericCallback() override {}
44
45 #if defined(ENABLE_WEBRTC)
46 // Finds the appropriate logging handler for performing the task and prepares
47 // a generic callback object for when the task is completed.
48 // If the logging handler can't be found for the given request+origin, the
49 // returned ptr will be null.
50 scoped_refptr<WebRtcLoggingHandlerHost> PrepareTask(
51 const api::webrtc_logging_private::RequestInfo& request,
52 const std::string& security_origin,
53 WebRtcLoggingHandlerHost::GenericDoneCallback* callback);
54
55 // Must be called on UI thread.
56 void FireCallback(bool success, const std::string& error_message);
57 #endif
58 };
59
60 class WebrtcLoggingPrivateFunctionWithUploadCallback
61 : public WebrtcLoggingPrivateFunction {
62 protected:
63 ~WebrtcLoggingPrivateFunctionWithUploadCallback() override {}
64
65 #if defined(ENABLE_WEBRTC)
66 // Must be called on UI thread.
67 void FireCallback(bool success, const std::string& report_id,
68 const std::string& error_message);
69 #endif
29 }; 70 };
30 71
31 class WebrtcLoggingPrivateSetMetaDataFunction 72 class WebrtcLoggingPrivateSetMetaDataFunction
32 : public WebrtcLoggingPrivateFunction { 73 : public WebrtcLoggingPrivateFunctionWithGenericCallback {
33 public: 74 public:
34 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.setMetaData", 75 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.setMetaData",
35 WEBRTCLOGGINGPRIVATE_SETMETADATA) 76 WEBRTCLOGGINGPRIVATE_SETMETADATA)
36 WebrtcLoggingPrivateSetMetaDataFunction(); 77 WebrtcLoggingPrivateSetMetaDataFunction() {}
37 78
38 private: 79 private:
39 ~WebrtcLoggingPrivateSetMetaDataFunction() override; 80 ~WebrtcLoggingPrivateSetMetaDataFunction() override {}
40 81
41 // ExtensionFunction overrides. 82 // ExtensionFunction overrides.
42 bool RunAsync() override; 83 bool RunAsync() override;
43
44 // Must be called on UI thread.
45 void SetMetaDataCallback(bool success, const std::string& error_message);
46 }; 84 };
47 85
48 class WebrtcLoggingPrivateStartFunction 86 class WebrtcLoggingPrivateStartFunction
49 : public WebrtcLoggingPrivateFunction { 87 : public WebrtcLoggingPrivateFunctionWithGenericCallback {
50 public: 88 public:
51 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.start", 89 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.start",
52 WEBRTCLOGGINGPRIVATE_START) 90 WEBRTCLOGGINGPRIVATE_START)
53 WebrtcLoggingPrivateStartFunction(); 91 WebrtcLoggingPrivateStartFunction() {}
54 92
55 private: 93 private:
56 ~WebrtcLoggingPrivateStartFunction() override; 94 ~WebrtcLoggingPrivateStartFunction() override {}
57 95
58 // ExtensionFunction overrides. 96 // ExtensionFunction overrides.
59 bool RunAsync() override; 97 bool RunAsync() override;
60
61 // Must be called on UI thread.
62 void StartCallback(bool success, const std::string& error_message);
63 }; 98 };
64 99
65 class WebrtcLoggingPrivateSetUploadOnRenderCloseFunction 100 class WebrtcLoggingPrivateSetUploadOnRenderCloseFunction
66 : public WebrtcLoggingPrivateFunction { 101 : public WebrtcLoggingPrivateFunction {
67 public: 102 public:
68 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.setUploadOnRenderClose", 103 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.setUploadOnRenderClose",
69 WEBRTCLOGGINGPRIVATE_SETUPLOADONRENDERCLOSE) 104 WEBRTCLOGGINGPRIVATE_SETUPLOADONRENDERCLOSE)
70 WebrtcLoggingPrivateSetUploadOnRenderCloseFunction(); 105 WebrtcLoggingPrivateSetUploadOnRenderCloseFunction() {}
71 106
72 private: 107 private:
73 ~WebrtcLoggingPrivateSetUploadOnRenderCloseFunction() override; 108 ~WebrtcLoggingPrivateSetUploadOnRenderCloseFunction() override {}
74 109
75 // ExtensionFunction overrides. 110 // ExtensionFunction overrides.
76 bool RunAsync() override; 111 bool RunAsync() override;
77 }; 112 };
78 113
79 class WebrtcLoggingPrivateStopFunction 114 class WebrtcLoggingPrivateStopFunction
80 : public WebrtcLoggingPrivateFunction { 115 : public WebrtcLoggingPrivateFunctionWithGenericCallback {
81 public: 116 public:
82 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.stop", 117 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.stop",
83 WEBRTCLOGGINGPRIVATE_STOP) 118 WEBRTCLOGGINGPRIVATE_STOP)
84 WebrtcLoggingPrivateStopFunction(); 119 WebrtcLoggingPrivateStopFunction() {}
85 120
86 private: 121 private:
87 ~WebrtcLoggingPrivateStopFunction() override; 122 ~WebrtcLoggingPrivateStopFunction() override {}
88 123
89 // ExtensionFunction overrides. 124 // ExtensionFunction overrides.
90 bool RunAsync() override; 125 bool RunAsync() override;
126 };
91 127
92 // Must be called on UI thread. 128 class WebrtcLoggingPrivateStoreFunction
93 void StopCallback(bool success, const std::string& error_message); 129 : public WebrtcLoggingPrivateFunctionWithGenericCallback {
130 public:
131 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.store",
132 WEBRTCLOGGINGPRIVATE_STORE)
133 WebrtcLoggingPrivateStoreFunction() {}
134
135 private:
136 ~WebrtcLoggingPrivateStoreFunction() override {}
137
138 // ExtensionFunction overrides.
139 bool RunAsync() override;
140 };
141
142 class WebrtcLoggingPrivateUploadStoredFunction
143 : public WebrtcLoggingPrivateFunctionWithUploadCallback {
144 public:
145 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.uploadStored",
146 WEBRTCLOGGINGPRIVATE_UPLOADSTORED)
147 WebrtcLoggingPrivateUploadStoredFunction() {}
148
149 private:
150 ~WebrtcLoggingPrivateUploadStoredFunction() override {}
151
152 // ExtensionFunction overrides.
153 bool RunAsync() override;
94 }; 154 };
95 155
96 class WebrtcLoggingPrivateUploadFunction 156 class WebrtcLoggingPrivateUploadFunction
97 : public WebrtcLoggingPrivateFunction { 157 : public WebrtcLoggingPrivateFunctionWithUploadCallback {
98 public: 158 public:
99 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.upload", 159 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.upload",
100 WEBRTCLOGGINGPRIVATE_UPLOAD) 160 WEBRTCLOGGINGPRIVATE_UPLOAD)
101 WebrtcLoggingPrivateUploadFunction(); 161 WebrtcLoggingPrivateUploadFunction() {}
102 162
103 private: 163 private:
104 ~WebrtcLoggingPrivateUploadFunction() override; 164 ~WebrtcLoggingPrivateUploadFunction() override {}
105 165
106 // ExtensionFunction overrides. 166 // ExtensionFunction overrides.
107 bool RunAsync() override; 167 bool RunAsync() override;
108
109 // Must be called on UI thread.
110 void UploadCallback(bool success, const std::string& report_id,
111 const std::string& error_message);
112 }; 168 };
113 169
114 class WebrtcLoggingPrivateDiscardFunction 170 class WebrtcLoggingPrivateDiscardFunction
115 : public WebrtcLoggingPrivateFunction { 171 : public WebrtcLoggingPrivateFunctionWithGenericCallback {
116 public: 172 public:
117 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.discard", 173 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.discard",
118 WEBRTCLOGGINGPRIVATE_DISCARD) 174 WEBRTCLOGGINGPRIVATE_DISCARD)
119 WebrtcLoggingPrivateDiscardFunction(); 175 WebrtcLoggingPrivateDiscardFunction() {}
120 176
121 private: 177 private:
122 ~WebrtcLoggingPrivateDiscardFunction() override; 178 ~WebrtcLoggingPrivateDiscardFunction() override {}
123 179
124 // ExtensionFunction overrides. 180 // ExtensionFunction overrides.
125 bool RunAsync() override; 181 bool RunAsync() override;
126
127 // Must be called on UI thread.
128 void DiscardCallback(bool success, const std::string& error_message);
129 }; 182 };
130 183
131 class WebrtcLoggingPrivateStartRtpDumpFunction 184 class WebrtcLoggingPrivateStartRtpDumpFunction
132 : public WebrtcLoggingPrivateFunction { 185 : public WebrtcLoggingPrivateFunctionWithGenericCallback {
133 public: 186 public:
134 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.startRtpDump", 187 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.startRtpDump",
135 WEBRTCLOGGINGPRIVATE_STARTRTPDUMP) 188 WEBRTCLOGGINGPRIVATE_STARTRTPDUMP)
136 WebrtcLoggingPrivateStartRtpDumpFunction(); 189 WebrtcLoggingPrivateStartRtpDumpFunction() {}
137 190
138 private: 191 private:
139 ~WebrtcLoggingPrivateStartRtpDumpFunction() override; 192 ~WebrtcLoggingPrivateStartRtpDumpFunction() override {}
140 193
141 // ExtensionFunction overrides. 194 // ExtensionFunction overrides.
142 bool RunAsync() override; 195 bool RunAsync() override;
143
144 // Must be called on UI thread.
145 void StartRtpDumpCallback(bool success, const std::string& error_message);
146 }; 196 };
147 197
148 class WebrtcLoggingPrivateStopRtpDumpFunction 198 class WebrtcLoggingPrivateStopRtpDumpFunction
149 : public WebrtcLoggingPrivateFunction { 199 : public WebrtcLoggingPrivateFunctionWithGenericCallback {
150 public: 200 public:
151 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.stopRtpDump", 201 DECLARE_EXTENSION_FUNCTION("webrtcLoggingPrivate.stopRtpDump",
152 WEBRTCLOGGINGPRIVATE_STOPRTPDUMP) 202 WEBRTCLOGGINGPRIVATE_STOPRTPDUMP)
153 WebrtcLoggingPrivateStopRtpDumpFunction(); 203 WebrtcLoggingPrivateStopRtpDumpFunction() {}
154 204
155 private: 205 private:
156 ~WebrtcLoggingPrivateStopRtpDumpFunction() override; 206 ~WebrtcLoggingPrivateStopRtpDumpFunction() override {}
157 207
158 // ExtensionFunction overrides. 208 // ExtensionFunction overrides.
159 bool RunAsync() override; 209 bool RunAsync() override;
160
161 // Must be called on UI thread.
162 void StopRtpDumpCallback(bool success, const std::string& error_message);
163 }; 210 };
164 211
165 } // namespace extensions 212 } // namespace extensions
166 213
167 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_P RIVATE_API_H_ 214 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_LOGGING_PRIVATE_WEBRTC_LOGGING_P RIVATE_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698