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