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 "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr
ivate_api.h" | 5 #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_pr
ivate_api.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/hash.h" | 10 #include "base/hash.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 namespace StopWebRtcEventLogging = | 49 namespace StopWebRtcEventLogging = |
50 api::webrtc_logging_private::StopWebRtcEventLogging; | 50 api::webrtc_logging_private::StopWebRtcEventLogging; |
51 | 51 |
52 namespace { | 52 namespace { |
53 std::string HashIdWithOrigin(const std::string& security_origin, | 53 std::string HashIdWithOrigin(const std::string& security_origin, |
54 const std::string& log_id) { | 54 const std::string& log_id) { |
55 return base::UintToString(base::Hash(security_origin + log_id)); | 55 return base::UintToString(base::Hash(security_origin + log_id)); |
56 } | 56 } |
57 } // namespace | 57 } // namespace |
58 | 58 |
| 59 // TODO(hlundin): Consolidate with WebrtcAudioPrivateFunction and improve. |
| 60 // http://crbug.com/710371 |
59 content::RenderProcessHost* WebrtcLoggingPrivateFunction::RphFromRequest( | 61 content::RenderProcessHost* WebrtcLoggingPrivateFunction::RphFromRequest( |
60 const RequestInfo& request, const std::string& security_origin) { | 62 const RequestInfo& request, const std::string& security_origin) { |
61 // If |guest_process_id| is defined, directly use this id to find the | 63 // If |guest_process_id| is defined, directly use this id to find the |
62 // corresponding RenderProcessHost. | 64 // corresponding RenderProcessHost. |
63 if (request.guest_process_id.get()) | 65 if (request.guest_process_id.get()) |
64 return content::RenderProcessHost::FromID(*request.guest_process_id); | 66 return content::RenderProcessHost::FromID(*request.guest_process_id); |
65 | 67 |
66 // Otherwise, use the |tab_id|. If there's no |tab_id| and no | 68 // Otherwise, use the |tab_id|. If there's no |tab_id| and no |
67 // |guest_process_id|, we can't look up the RenderProcessHost. | 69 // |guest_process_id|, we can't look up the RenderProcessHost. |
68 if (!request.tab_id.get()) { | 70 if (!request.tab_id.get()) { |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 &WebrtcLoggingPrivateStopWebRtcEventLoggingFunction::FireCallback, | 512 &WebrtcLoggingPrivateStopWebRtcEventLoggingFunction::FireCallback, |
511 this), | 513 this), |
512 base::Bind(&WebrtcLoggingPrivateStopWebRtcEventLoggingFunction:: | 514 base::Bind(&WebrtcLoggingPrivateStopWebRtcEventLoggingFunction:: |
513 FireErrorCallback, | 515 FireErrorCallback, |
514 this)); | 516 this)); |
515 | 517 |
516 return true; | 518 return true; |
517 } | 519 } |
518 | 520 |
519 } // namespace extensions | 521 } // namespace extensions |
OLD | NEW |