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 const char kWebContentsCaptureScheme[] = "web-contents-media-stream"; | |
Sergey Ulanov
2016/01/13 19:06:11
This doesn't need to be in .h file. Ideally it sho
GeorgeZ
2016/01/13 22:29:02
Good Point
| |
15 | |
16 struct CONTENT_EXPORT WebContentsMediaCaptureId { | |
17 public: | |
18 WebContentsMediaCaptureId() = default; | |
19 WebContentsMediaCaptureId(int render_process_id, int main_render_frame_id) | |
20 : render_process_id(render_process_id), | |
21 main_render_frame_id(main_render_frame_id) {} | |
22 | |
23 WebContentsMediaCaptureId(int render_process_id, | |
24 int main_render_frame_id, | |
25 bool enable_auto_throttling) | |
26 : render_process_id(render_process_id), | |
27 main_render_frame_id(main_render_frame_id), | |
28 enable_auto_throttling(enable_auto_throttling) {} | |
29 | |
30 bool operator<(const WebContentsMediaCaptureId& other) const; | |
31 bool operator==(const WebContentsMediaCaptureId& other) const; | |
32 | |
33 // Return true if render_process_id or main_render_frame_id is invalid. | |
34 bool is_null() const; | |
35 | |
36 std::string ToString() const; | |
37 | |
38 // Tab video and audio capture need render process id and render frame id. | |
39 int render_process_id = MSG_ROUTING_NONE; | |
40 int main_render_frame_id = MSG_ROUTING_NONE; | |
41 | |
42 bool enable_auto_throttling = false; | |
43 | |
44 // Create WebContentsMediaCaptureId based on a string. | |
45 static WebContentsMediaCaptureId Parse(const std::string& str); | |
46 | |
47 // Check whether the device id indicates that this is a web contents stream. | |
48 static bool IsWebContentsDeviceId(const std::string& device_id); | |
49 | |
50 // Function to extract the target render frame id's from a media stream | |
51 // request's device id. | |
52 static bool ExtractTabCaptureTarget(const std::string& device_id, | |
53 int* render_process_id, | |
54 int* main_render_frame_id); | |
55 | |
56 // Parses the media stream request |device_id| and returns true if both 1) the | |
57 // format is valid, and 2) the throttling option is set to auto. | |
58 static bool IsAutoThrottlingOptionSet(const std::string& device_id); | |
59 }; | |
60 | |
61 } // namespace content | |
62 | |
63 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_MEDIA_CAPTURE_ID_H_ | |
OLD | NEW |