Index: content/public/browser/web_contents_media_capture_id.h |
diff --git a/content/public/browser/web_contents_media_capture_id.h b/content/public/browser/web_contents_media_capture_id.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f96e09a5bd4d4b93923b0fceef9ecbbc40b76b30 |
--- /dev/null |
+++ b/content/public/browser/web_contents_media_capture_id.h |
@@ -0,0 +1,66 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
mark a. foltz
2016/01/04 20:11:41
s/2015/2016/
GeorgeZ
2016/01/06 22:41:39
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_MEDIA_CAPTURE_ID_H_ |
+#define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_MEDIA_CAPTURE_ID_H_ |
+ |
+#include <string> |
+ |
+#include "content/common/content_export.h" |
+ |
+namespace content { |
+const char kWebContentsCaptureScheme[] = "web-contents-media-stream"; |
+ |
+struct CONTENT_EXPORT WebContentsMediaCaptureId { |
mark a. foltz
2016/01/04 20:11:41
Where is the syntax of this ID defined? Can you i
miu
2016/01/05 01:43:09
mfoltz: There is none. Note that gyzhou@ has simp
|
+ public: |
+ // Represents an "unset" value for either |render_process_id| or |
+ // |main_render_frame_id|. |
+ static const int kInvalidId = -1; |
+ |
+ WebContentsMediaCaptureId() = default; |
+ WebContentsMediaCaptureId(int render_process_id, int main_render_frame_id) |
+ : render_process_id(render_process_id), |
+ main_render_frame_id(main_render_frame_id) {} |
+ |
+ WebContentsMediaCaptureId(int render_process_id, |
+ int main_render_frame_id, |
+ bool enable_auto_throttling) |
+ : render_process_id(render_process_id), |
+ main_render_frame_id(main_render_frame_id), |
+ enable_auto_throttling(enable_auto_throttling) {} |
+ |
+ bool operator<(const WebContentsMediaCaptureId& other) const; |
+ bool operator==(const WebContentsMediaCaptureId& other) const; |
+ |
+ // Return true if render_process_id or main_render_frame_id is invalid. |
+ bool is_null() const; |
+ |
+ std::string ToString() const; |
+ |
+ // Tab video and audio capture need render process id and render frame id. |
+ int render_process_id = kInvalidId; |
+ int main_render_frame_id = kInvalidId; |
+ |
+ bool enable_auto_throttling = false; |
Sergey Ulanov
2016/01/04 18:59:29
Why is this part of the window identifier?
GeorgeZ
2016/01/06 22:41:39
This file was moved from content/browser/media/cap
|
+ |
+ // Create WebContentsMediaCaptureId based on a string. |
+ static WebContentsMediaCaptureId Parse(const std::string& str); |
+ |
+ // Check whether the device id indicates that this is a web contents stream. |
+ static bool IsWebContentsDeviceId(const std::string& device_id); |
mark a. foltz
2016/01/04 20:11:41
Why static?
GeorgeZ
2016/01/06 22:41:39
This file was moved from
content/browser/media/cap
|
+ |
+ // Function to extract the target render frame id's from a media stream |
+ // request's device id. |
+ static bool ExtractTabCaptureTarget(const std::string& device_id, |
mark a. foltz
2016/01/04 20:11:41
Ditto
GeorgeZ
2016/01/06 22:41:39
same as previous.
|
+ int* render_process_id, |
+ int* main_render_frame_id); |
+ |
+ // Parses the media stream request |device_id| and returns true if both 1) the |
+ // format is valid, and 2) the throttling option is set to auto. |
+ static bool IsAutoThrottlingOptionSet(const std::string& device_id); |
mark a. foltz
2016/01/04 20:11:41
Ditto
GeorgeZ
2016/01/06 22:41:39
Same as previous.
|
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_MEDIA_CAPTURE_ID_H_ |