Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: content/public/browser/web_contents_media_capture_id.h

Issue 1503563004: Desktop chrome tab capture-chooseDesktopMedia() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
Avi (use Gerrit) 2016/01/08 17:11:39 No (c)
GeorgeZ 2016/01/08 19:39:03 Done.
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 kWebContentsCaptureScheme[] = "web-contents-media-stream";
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;
Avi (use Gerrit) 2016/01/08 17:11:39 But those already have invalid constants: MSG_ROUT
GeorgeZ 2016/01/08 19:39:03 Done.
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 WebContentsMediaCaptureId(int render_process_id,
27 int main_render_frame_id,
28 bool enable_auto_throttling)
29 : render_process_id(render_process_id),
30 main_render_frame_id(main_render_frame_id),
31 enable_auto_throttling(enable_auto_throttling) {}
32
33 bool operator<(const WebContentsMediaCaptureId& other) const;
34 bool operator==(const WebContentsMediaCaptureId& other) const;
35
36 // Return true if render_process_id or main_render_frame_id is invalid.
37 bool is_null() const;
38
39 std::string ToString() const;
40
41 // Tab video and audio capture need render process id and render frame id.
42 int render_process_id = kInvalidId;
43 int main_render_frame_id = kInvalidId;
44
45 bool enable_auto_throttling = false;
46
47 // Create WebContentsMediaCaptureId based on a string.
48 static WebContentsMediaCaptureId Parse(const std::string& str);
49
50 // Check whether the device id indicates that this is a web contents stream.
51 static bool IsWebContentsDeviceId(const std::string& device_id);
52
53 // Function to extract the target render frame id's from a media stream
54 // request's device id.
55 static bool ExtractTabCaptureTarget(const std::string& device_id,
56 int* render_process_id,
57 int* main_render_frame_id);
58
59 // Parses the media stream request |device_id| and returns true if both 1) the
60 // format is valid, and 2) the throttling option is set to auto.
61 static bool IsAutoThrottlingOptionSet(const std::string& device_id);
62 };
63
64 } // namespace content
65
66 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_MEDIA_CAPTURE_ID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698