OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 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 | |
12 namespace content { | |
13 const char kTabPrefix[] = "web-contents-media-stream"; | |
miu
2015/12/14 20:21:08
naming nit: kWebContentsCaptureScheme
GeorgeZ
2015/12/14 21:50:27
Done.
| |
14 | |
15 struct CONTENT_EXPORT WebContentsMediaCaptureId { | |
16 public: | |
17 // Represents an "unset" value for either |render_process_id| or | |
18 // |main_render_frame_id|. | |
19 static const int kInvalidId = -1; | |
20 | |
21 WebContentsMediaCaptureId() = default; | |
22 WebContentsMediaCaptureId(int render_process_id, int main_render_frame_id) | |
23 : render_process_id(render_process_id), | |
24 main_render_frame_id(main_render_frame_id) {} | |
25 | |
26 bool operator<(const WebContentsMediaCaptureId& other) const; | |
27 bool operator==(const WebContentsMediaCaptureId& other) const; | |
28 | |
29 // Return true if render_process_id or main_render_frame_id is invalid. | |
30 bool is_null() const; | |
31 | |
32 std::string ToString() const; | |
33 | |
34 // Tab video and audio capture need render process id and render frame id. | |
35 int render_process_id = kInvalidId; | |
36 int main_render_frame_id = kInvalidId; | |
37 | |
38 bool enable_auto_throttling = false; | |
39 | |
40 // Create WebContentsMediaCaptureId based on a string. | |
41 static WebContentsMediaCaptureId Parse(const std::string& str); | |
42 | |
43 // Check whether the device id indicates that this is a web contents stream. | |
44 static bool IsWebContentsDeviceId(const std::string& device_id); | |
45 | |
46 // Function to extract the target render frame id's from a media stream | |
47 // request's device id. | |
48 static bool ExtractTabCaptureTarget(const std::string& device_id, | |
49 int* render_process_id, | |
50 int* main_render_frame_id); | |
51 | |
52 // Parses the media stream request |device_id| and returns true if both 1) the | |
53 // format is valid, and 2) the throttling option is set to auto. | |
54 static bool IsAutoThrottlingOptionSet(const std::string& device_id); | |
55 }; | |
56 | |
57 } // namespace content | |
58 | |
59 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_MEDIA_CAPTURE_ID_H_ | |
OLD | NEW |