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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr
ivate_api.h" | 7 #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr
ivate_api.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 return contents->GetRenderProcessHost(); | 58 return contents->GetRenderProcessHost(); |
59 } | 59 } |
60 | 60 |
61 WebrtcLoggingPrivateSetMetaDataFunction:: | 61 WebrtcLoggingPrivateSetMetaDataFunction:: |
62 WebrtcLoggingPrivateSetMetaDataFunction() {} | 62 WebrtcLoggingPrivateSetMetaDataFunction() {} |
63 | 63 |
64 WebrtcLoggingPrivateSetMetaDataFunction:: | 64 WebrtcLoggingPrivateSetMetaDataFunction:: |
65 ~WebrtcLoggingPrivateSetMetaDataFunction() {} | 65 ~WebrtcLoggingPrivateSetMetaDataFunction() {} |
66 | 66 |
67 bool WebrtcLoggingPrivateSetMetaDataFunction::RunImpl() { | 67 bool WebrtcLoggingPrivateSetMetaDataFunction::RunAsync() { |
68 scoped_ptr<SetMetaData::Params> params(SetMetaData::Params::Create(*args_)); | 68 scoped_ptr<SetMetaData::Params> params(SetMetaData::Params::Create(*args_)); |
69 EXTENSION_FUNCTION_VALIDATE(params.get()); | 69 EXTENSION_FUNCTION_VALIDATE(params.get()); |
70 | 70 |
71 content::RenderProcessHost* host = | 71 content::RenderProcessHost* host = |
72 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); | 72 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); |
73 if (!host) | 73 if (!host) |
74 return false; | 74 return false; |
75 | 75 |
76 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( | 76 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( |
77 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); | 77 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); |
(...skipping 19 matching lines...) Expand all Loading... |
97 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 97 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
98 if (!success) | 98 if (!success) |
99 SetError(error_message); | 99 SetError(error_message); |
100 SendResponse(success); | 100 SendResponse(success); |
101 } | 101 } |
102 | 102 |
103 WebrtcLoggingPrivateStartFunction::WebrtcLoggingPrivateStartFunction() {} | 103 WebrtcLoggingPrivateStartFunction::WebrtcLoggingPrivateStartFunction() {} |
104 | 104 |
105 WebrtcLoggingPrivateStartFunction::~WebrtcLoggingPrivateStartFunction() {} | 105 WebrtcLoggingPrivateStartFunction::~WebrtcLoggingPrivateStartFunction() {} |
106 | 106 |
107 bool WebrtcLoggingPrivateStartFunction::RunImpl() { | 107 bool WebrtcLoggingPrivateStartFunction::RunAsync() { |
108 scoped_ptr<Start::Params> params(Start::Params::Create(*args_)); | 108 scoped_ptr<Start::Params> params(Start::Params::Create(*args_)); |
109 EXTENSION_FUNCTION_VALIDATE(params.get()); | 109 EXTENSION_FUNCTION_VALIDATE(params.get()); |
110 | 110 |
111 content::RenderProcessHost* host = | 111 content::RenderProcessHost* host = |
112 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); | 112 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); |
113 if (!host) | 113 if (!host) |
114 return false; | 114 return false; |
115 | 115 |
116 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( | 116 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( |
117 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); | 117 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); |
(...skipping 15 matching lines...) Expand all Loading... |
133 SetError(error_message); | 133 SetError(error_message); |
134 SendResponse(success); | 134 SendResponse(success); |
135 } | 135 } |
136 | 136 |
137 WebrtcLoggingPrivateSetUploadOnRenderCloseFunction:: | 137 WebrtcLoggingPrivateSetUploadOnRenderCloseFunction:: |
138 WebrtcLoggingPrivateSetUploadOnRenderCloseFunction() {} | 138 WebrtcLoggingPrivateSetUploadOnRenderCloseFunction() {} |
139 | 139 |
140 WebrtcLoggingPrivateSetUploadOnRenderCloseFunction:: | 140 WebrtcLoggingPrivateSetUploadOnRenderCloseFunction:: |
141 ~WebrtcLoggingPrivateSetUploadOnRenderCloseFunction() {} | 141 ~WebrtcLoggingPrivateSetUploadOnRenderCloseFunction() {} |
142 | 142 |
143 bool WebrtcLoggingPrivateSetUploadOnRenderCloseFunction::RunImpl() { | 143 bool WebrtcLoggingPrivateSetUploadOnRenderCloseFunction::RunAsync() { |
144 scoped_ptr<SetUploadOnRenderClose::Params> params( | 144 scoped_ptr<SetUploadOnRenderClose::Params> params( |
145 SetUploadOnRenderClose::Params::Create(*args_)); | 145 SetUploadOnRenderClose::Params::Create(*args_)); |
146 EXTENSION_FUNCTION_VALIDATE(params.get()); | 146 EXTENSION_FUNCTION_VALIDATE(params.get()); |
147 | 147 |
148 content::RenderProcessHost* host = | 148 content::RenderProcessHost* host = |
149 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); | 149 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); |
150 if (!host) | 150 if (!host) |
151 return false; | 151 return false; |
152 | 152 |
153 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( | 153 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( |
154 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); | 154 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); |
155 | 155 |
156 webrtc_logging_handler_host->set_upload_log_on_render_close( | 156 webrtc_logging_handler_host->set_upload_log_on_render_close( |
157 params->should_upload); | 157 params->should_upload); |
158 | 158 |
159 return true; | 159 return true; |
160 } | 160 } |
161 | 161 |
162 WebrtcLoggingPrivateStopFunction::WebrtcLoggingPrivateStopFunction() {} | 162 WebrtcLoggingPrivateStopFunction::WebrtcLoggingPrivateStopFunction() {} |
163 | 163 |
164 WebrtcLoggingPrivateStopFunction::~WebrtcLoggingPrivateStopFunction() {} | 164 WebrtcLoggingPrivateStopFunction::~WebrtcLoggingPrivateStopFunction() {} |
165 | 165 |
166 bool WebrtcLoggingPrivateStopFunction::RunImpl() { | 166 bool WebrtcLoggingPrivateStopFunction::RunAsync() { |
167 scoped_ptr<Stop::Params> params(Stop::Params::Create(*args_)); | 167 scoped_ptr<Stop::Params> params(Stop::Params::Create(*args_)); |
168 EXTENSION_FUNCTION_VALIDATE(params.get()); | 168 EXTENSION_FUNCTION_VALIDATE(params.get()); |
169 | 169 |
170 content::RenderProcessHost* host = | 170 content::RenderProcessHost* host = |
171 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); | 171 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); |
172 if (!host) | 172 if (!host) |
173 return false; | 173 return false; |
174 | 174 |
175 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( | 175 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( |
176 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); | 176 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); |
(...skipping 13 matching lines...) Expand all Loading... |
190 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 190 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
191 if (!success) | 191 if (!success) |
192 SetError(error_message); | 192 SetError(error_message); |
193 SendResponse(success); | 193 SendResponse(success); |
194 } | 194 } |
195 | 195 |
196 WebrtcLoggingPrivateUploadFunction::WebrtcLoggingPrivateUploadFunction() {} | 196 WebrtcLoggingPrivateUploadFunction::WebrtcLoggingPrivateUploadFunction() {} |
197 | 197 |
198 WebrtcLoggingPrivateUploadFunction::~WebrtcLoggingPrivateUploadFunction() {} | 198 WebrtcLoggingPrivateUploadFunction::~WebrtcLoggingPrivateUploadFunction() {} |
199 | 199 |
200 bool WebrtcLoggingPrivateUploadFunction::RunImpl() { | 200 bool WebrtcLoggingPrivateUploadFunction::RunAsync() { |
201 scoped_ptr<Upload::Params> params(Upload::Params::Create(*args_)); | 201 scoped_ptr<Upload::Params> params(Upload::Params::Create(*args_)); |
202 EXTENSION_FUNCTION_VALIDATE(params.get()); | 202 EXTENSION_FUNCTION_VALIDATE(params.get()); |
203 | 203 |
204 content::RenderProcessHost* host = | 204 content::RenderProcessHost* host = |
205 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); | 205 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); |
206 if (!host) | 206 if (!host) |
207 return false; | 207 return false; |
208 | 208 |
209 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( | 209 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( |
210 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); | 210 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); |
(...skipping 19 matching lines...) Expand all Loading... |
230 } else { | 230 } else { |
231 SetError(error_message); | 231 SetError(error_message); |
232 } | 232 } |
233 SendResponse(success); | 233 SendResponse(success); |
234 } | 234 } |
235 | 235 |
236 WebrtcLoggingPrivateDiscardFunction::WebrtcLoggingPrivateDiscardFunction() {} | 236 WebrtcLoggingPrivateDiscardFunction::WebrtcLoggingPrivateDiscardFunction() {} |
237 | 237 |
238 WebrtcLoggingPrivateDiscardFunction::~WebrtcLoggingPrivateDiscardFunction() {} | 238 WebrtcLoggingPrivateDiscardFunction::~WebrtcLoggingPrivateDiscardFunction() {} |
239 | 239 |
240 bool WebrtcLoggingPrivateDiscardFunction::RunImpl() { | 240 bool WebrtcLoggingPrivateDiscardFunction::RunAsync() { |
241 scoped_ptr<Discard::Params> params(Discard::Params::Create(*args_)); | 241 scoped_ptr<Discard::Params> params(Discard::Params::Create(*args_)); |
242 EXTENSION_FUNCTION_VALIDATE(params.get()); | 242 EXTENSION_FUNCTION_VALIDATE(params.get()); |
243 | 243 |
244 content::RenderProcessHost* host = | 244 content::RenderProcessHost* host = |
245 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); | 245 RphFromTabIdAndSecurityOrigin(params->tab_id, params->security_origin); |
246 if (!host) | 246 if (!host) |
247 return false; | 247 return false; |
248 | 248 |
249 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( | 249 scoped_refptr<WebRtcLoggingHandlerHost> webrtc_logging_handler_host( |
250 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); | 250 base::UserDataAdapter<WebRtcLoggingHandlerHost>::Get(host, host)); |
(...skipping 10 matching lines...) Expand all Loading... |
261 | 261 |
262 void WebrtcLoggingPrivateDiscardFunction::DiscardCallback( | 262 void WebrtcLoggingPrivateDiscardFunction::DiscardCallback( |
263 bool success, const std::string& error_message) { | 263 bool success, const std::string& error_message) { |
264 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 264 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
265 if (!success) | 265 if (!success) |
266 SetError(error_message); | 266 SetError(error_message); |
267 SendResponse(success); | 267 SendResponse(success); |
268 } | 268 } |
269 | 269 |
270 } // namespace extensions | 270 } // namespace extensions |
OLD | NEW |