Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_MEDIA_CAPTURE_ID_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_MEDIA_CAPTURE_ID_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "ipc/ipc_message.h" | |
| 12 | |
| 13 namespace content { | |
| 14 struct CONTENT_EXPORT WebContentsMediaCaptureId { | |
|
Sergey Ulanov
2016/01/13 22:53:16
nit: add empty line here
GeorgeZ
2016/01/13 23:15:53
Done.
| |
| 15 public: | |
| 16 WebContentsMediaCaptureId() = default; | |
| 17 WebContentsMediaCaptureId(int render_process_id, int main_render_frame_id) | |
| 18 : render_process_id(render_process_id), | |
| 19 main_render_frame_id(main_render_frame_id) {} | |
| 20 | |
| 21 WebContentsMediaCaptureId(int render_process_id, | |
| 22 int main_render_frame_id, | |
| 23 bool enable_auto_throttling) | |
| 24 : render_process_id(render_process_id), | |
| 25 main_render_frame_id(main_render_frame_id), | |
| 26 enable_auto_throttling(enable_auto_throttling) {} | |
| 27 | |
| 28 bool operator<(const WebContentsMediaCaptureId& other) const; | |
| 29 bool operator==(const WebContentsMediaCaptureId& other) const; | |
| 30 | |
| 31 // Return true if render_process_id or main_render_frame_id is invalid. | |
| 32 bool is_null() const; | |
| 33 | |
| 34 std::string ToString() const; | |
| 35 | |
| 36 // Tab video and audio capture need render process id and render frame id. | |
| 37 int render_process_id = MSG_ROUTING_NONE; | |
| 38 int main_render_frame_id = MSG_ROUTING_NONE; | |
| 39 | |
| 40 bool enable_auto_throttling = false; | |
| 41 | |
| 42 // Create WebContentsMediaCaptureId based on a string. | |
| 43 static WebContentsMediaCaptureId Parse(const std::string& str); | |
| 44 | |
| 45 // Check whether the device id indicates that this is a web contents stream. | |
| 46 static bool IsWebContentsDeviceId(const std::string& device_id); | |
| 47 | |
| 48 // Function to extract the target render frame id's from a media stream | |
| 49 // request's device id. | |
| 50 static bool ExtractTabCaptureTarget(const std::string& device_id, | |
| 51 int* render_process_id, | |
| 52 int* main_render_frame_id); | |
| 53 | |
| 54 // Parses the media stream request |device_id| and returns true if both 1) the | |
| 55 // format is valid, and 2) the throttling option is set to auto. | |
| 56 static bool IsAutoThrottlingOptionSet(const std::string& device_id); | |
| 57 }; | |
| 58 | |
| 59 } // namespace content | |
| 60 | |
| 61 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_MEDIA_CAPTURE_ID_H_ | |
| OLD | NEW |